From 02ccfc21d5d4f767bbd92ecda89cdfcc3283728c Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期三, 11 六月 2025 08:38:26 +0800 Subject: [PATCH] Merge branch 'master' of http://118.89.139.230:10101/r/powerIntelligenceSystem into master --- src/main/java/com/whyc/service/BattRtstateService.java | 31 src/main/java/com/whyc/mapper/DevAlmparamMapper.java | 10 src/main/java/com/whyc/factory/ThreadPoolExecutorFactory.java | 2 src/main/java/com/whyc/mapper/PowerInfMapper.java | 5 src/main/java/com/whyc/constant/Capperformance.java | 47 src/main/java/com/whyc/controller/HistoryIdController.java | 41 src/main/java/com/whyc/webSocket/BattAlmRealSocket.java | 110 src/main/java/com/whyc/dto/InfoDto.java | 10 src/main/java/com/whyc/dto/Statistic/BattCompareStic.java | 29 src/main/java/com/whyc/mapper/BattalarmDataMapper.java | 11 src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java | 11 src/main/java/com/whyc/service/BattresdataInfService.java | 52 src/main/java/com/whyc/service/PwrdevAlarmParamStandService.java | 82 src/main/java/com/whyc/service/AlarmHisService.java | 88 src/main/java/com/whyc/service/PwrdevAcdcdataService.java | 22 src/main/resources/mapper/BatttestdataInfMapper.xml | 63 src/main/java/com/whyc/service/BattAlmparamService.java | 39 src/main/java/com/whyc/dto/Real/SticRealRtdataDto.java | 45 src/main/java/com/whyc/pojo/db_ram_db/AlmparamFromDevice.java | 6 src/main/java/com/whyc/service/PwrdevAlarmParamService.java | 42 src/main/java/com/whyc/pojo/db_ram_db/BattRtstate.java | 12 src/main/java/com/whyc/pojo/db_data_history/BattRealdataId.java | 115 src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java | 15 src/main/java/com/whyc/webSocket/PwrAlmRealSocket.java | 111 src/main/java/com/whyc/factory/BattCapFactory.java | 172 + src/main/java/com/whyc/controller/PwrdevAlarmParamStandController.java | 50 src/main/java/com/whyc/controller/StatisticController.java | 148 src/main/java/com/whyc/service/PowerInfService.java | 17 src/main/java/com/whyc/controller/AlmparamFromDeviceController.java | 29 src/main/resources/mapper/BattInfMapper.xml | 293 + src/main/java/com/whyc/mapper/AlmparamFromDeviceMapper.java | 6 src/main/java/com/whyc/service/StationInfService.java | 16 src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java | 30 src/main/java/com/whyc/constant/ChargeTypeEnum.java | 45 src/main/java/com/whyc/service/BatttestdataInfService.java | 868 +++++ src/main/java/com/whyc/controller/AlarmController.java | 68 src/main/java/com/whyc/mapper/BattAlmparamMapper.java | 12 src/main/java/com/whyc/mapper/BattresdataInfMapper.java | 6 src/main/java/com/whyc/dto/Real/AlmDto.java | 28 src/main/resources/mapper/CommonMapper.xml | 2 src/main/java/com/whyc/service/BatttestdataIdService.java | 34 src/main/resources/mapper/DevalarmDataMapper.xml | 46 src/main/java/com/whyc/dto/Statistic/SticDischarge6Res.java | 25 src/main/java/com/whyc/mapper/BattRtdataMapper.java | 6 src/main/java/com/whyc/util/CommonUtil.java | 4 src/main/java/com/whyc/constant/BattStateEnum.java | 48 src/main/resources/mapper/PwrdevAlarmParamMapper.xml | 37 src/main/java/com/whyc/dto/Real/BattHisRealDto.java | 29 pom.xml | 6 src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParam.java | 21 src/main/java/com/whyc/util/FileUtil.java | 300 + src/main/resources/mapper/UserMapper.xml | 3 src/main/java/com/whyc/service/BattInfService.java | 91 src/main/java/com/whyc/dto/Statistic/BanZu.java | 11 src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataInf.java | 67 src/main/java/com/whyc/controller/AlmParamController.java | 70 src/main/java/com/whyc/service/DevalarmDataService.java | 61 src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParamStand.java | 6 src/main/resources/mapper/DeviceStateMapper.xml | 38 src/main/java/com/whyc/pojo/db_ram_db/DeviceSetparam.java | 19 src/main/java/com/whyc/mapper/BattInfMapper.java | 21 src/main/java/com/whyc/pojo/db_alarm/BattalarmData.java | 17 src/main/java/com/whyc/dto/Statistic/SticMonRes.java | 14 src/main/java/com/whyc/service/PwrdevAlarmService.java | 61 src/main/java/com/whyc/dto/AlmHis/BattAlarmRes.java | 25 src/main/java/com/whyc/pojo/db_station/PowerInf.java | 12 src/main/java/com/whyc/mapper/DeviceSetparamMapper.java | 10 src/main/java/com/whyc/mapper/BatttestdataInfMapper.java | 16 src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java | 14 src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataId.java | 72 src/main/java/com/whyc/constant/PowerAlarmEnum.java | 236 + src/main/java/com/whyc/controller/ConditionController.java | 62 src/main/java/com/whyc/controller/StationInfController.java | 3 src/main/java/com/whyc/service/BaojigroupService.java | 12 src/main/java/com/whyc/util/MathUtil.java | 1 src/main/java/com/whyc/controller/RealContoller.java | 71 src/main/java/com/whyc/pojo/db_param/BattAlmparam.java | 18 src/main/resources/mapper/PwrdevAlarmMapper.xml | 47 src/main/java/com/whyc/service/DevAlmparamService.java | 44 src/main/java/com/whyc/mapper/PwrdevAcdcdataMapper.java | 6 src/main/java/com/whyc/dto/Real/PwrHisRealAcInDto.java | 52 src/main/java/com/whyc/mapper/PwrdevAlarmParamStandMapper.java | 6 src/main/java/com/whyc/service/BattRealdataIdService.java | 222 + src/main/java/com/whyc/constant/BattAlarmIdEnum.java | 51 src/main/java/com/whyc/mapper/DeviceStateMapper.java | 12 src/main/java/com/whyc/service/AlmparamFromDeviceService.java | 104 src/main/java/com/whyc/pojo/db_param/AppParam.java | 48 src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java | 28 src/main/java/com/whyc/util/SubTablePageInfoUtils.java | 312 + src/main/java/com/whyc/service/DeviceStateService.java | 41 src/main/java/com/whyc/service/SubTablePageInfoService.java | 1084 ++++- src/main/java/com/whyc/mapper/AppParamMapper.java | 6 src/main/java/com/whyc/dto/AlmHis/BattAlmPar.java | 28 src/main/java/com/whyc/dto/Real/CompareDto.java | 10 src/main/java/com/whyc/service/PwrdevHistorydataIdService.java | 73 src/main/java/com/whyc/constant/FailReasonEnum.java | 56 src/main/java/com/whyc/dto/AlmHis/PwrAlmPar.java | 28 src/main/java/com/whyc/dto/Statistic/SticDischarge5Res.java | 23 src/main/java/com/whyc/mapper/DevalarmDataMapper.java | 12 src/main/java/com/whyc/util/ActionUtil.java | 37 src/main/resources/mapper/BattAlmparamMapper.xml | 37 src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarm.java | 16 src/main/java/com/whyc/mapper/PwrdevAlarmParamMapper.java | 12 src/main/java/com/whyc/controller/DeviceSetparamController.java | 55 src/main/java/com/whyc/controller/AlarmHistoryController.java | 43 src/main/java/com/whyc/dto/Real/PwrHisRealDcoutInDto.java | 114 src/main/java/com/whyc/webSocket/RealTimeSocket.java | 470 ++ src/main/java/com/whyc/mapper/BattRtstateMapper.java | 6 src/main/java/com/whyc/constant/StopReasonEnum.java | 93 src/main/java/com/whyc/webSocket/DevAlmRealSocket.java | 111 src/main/java/com/whyc/dto/AlmHis/DevAlmPar.java | 29 src/main/java/com/whyc/mapper/CommonMapper.java | 2 src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java | 24 src/main/resources/mapper/BattalarmDataMapper.xml | 47 src/main/java/com/whyc/dto/Statistic/PerformanceStic.java | 22 src/main/java/com/whyc/constant/DevAlarmEnum.java | 51 src/main/java/com/whyc/pojo/db_station/BattInf.java | 25 src/main/java/com/whyc/dto/Real/QuarterDto.java | 15 src/main/java/com/whyc/dto/Real/TopDto.java | 67 src/main/java/com/whyc/util/ServletUtils.java | 14 src/main/java/com/whyc/dto/Statistic/MonStic.java | 25 src/main/java/com/whyc/dto/CmdDto/DevCmd.java | 31 src/main/java/com/whyc/controller/ExportFileController.java | 26 src/main/java/com/whyc/service/DeviceSetparamService.java | 120 src/main/java/com/whyc/dto/Real/RealDateDTO.java | 32 src/main/java/com/whyc/factory/InfoFactory.java | 7 src/main/resources/mapper/StationInfMapper.xml | 28 src/main/java/com/whyc/filter/CrossDomainFilter.java | 2 src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmHistory.java | 17 src/main/java/com/whyc/pojo/db_data_history/PwrdevHistorydataId.java | 904 +++++ src/main/java/com/whyc/service/AppParamService.java | 26 src/main/java/com/whyc/dto/Statistic/BattTinfStic.java | 22 src/main/java/com/whyc/pojo/db_alarm/DevalarmDataHistory.java | 14 src/main/java/com/whyc/controller/InfoContoller.java | 2 src/main/java/com/whyc/dto/Real/TestDataDto.java | 25 src/main/java/com/whyc/service/BattalarmDataService.java | 61 src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java | 19 src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java | 2 src/main/resources/mapper/DeviceSetparamMapper.xml | 31 src/main/java/com/whyc/mapper/StationInfMapper.java | 3 src/main/java/com/whyc/dto/Statistic/DisChargeStic.java | 25 /dev/null | 352 -- src/main/java/com/whyc/dto/Statistic/StationStic.java | 18 src/main/java/com/whyc/service/BattRtdataService.java | 32 src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java | 30 src/main/java/com/whyc/service/ExportService.java | 172 + src/main/resources/mapper/PowerInfMapper.xml | 44 src/main/java/com/whyc/dto/Statistic/PerformanceRes.java | 19 src/main/java/com/whyc/constant/DevStateEnum.java | 50 src/main/java/com/whyc/constant/BattSingalIdEnum.java | 61 src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java | 44 151 files changed, 9,506 insertions(+), 697 deletions(-) diff --git a/pom.xml b/pom.xml index 16e29d8..2a1ccf4 100644 --- a/pom.xml +++ b/pom.xml @@ -142,6 +142,12 @@ <artifactId>spring-context-support</artifactId> <version>5.3.9</version> </dependency> + <!--poi--> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>3.10.1</version> + </dependency> <!--<dependency> <groupId>org.springframework.plugin</groupId> diff --git a/powerIntelligenceSystem.iml b/powerIntelligenceSystem.iml deleted file mode 100644 index 322e40a..0000000 --- a/powerIntelligenceSystem.iml +++ /dev/null @@ -1,174 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="web" name="Web"> - <configuration> - <webroots /> - </configuration> - </facet> - <facet type="Spring" name="Spring"> - <configuration /> - </facet> - </component> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> - <output url="file://$MODULE_DIR$/target/classes" /> - <output-test url="file://$MODULE_DIR$/target/test-classes" /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/webapp" type="java-resource" /> - <excludeFolder url="file://$MODULE_DIR$/target" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.10.2" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.10" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.10" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.10" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.10" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.10" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.30" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.30" level="project" /> - <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" /> - <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" /> - <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.3.Final" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: com.sun.mail:javax.mail:1.6.2" level="project" /> - <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.5" level="project" /> - <orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.11" level="project" /> - <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.5" level="project" /> - <orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" /> - <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.0" level="project" /> - <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" /> - <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.5" level="project" /> - <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" /> - <orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-websocket:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-websocket:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.2.5" level="project" /> - <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.1.4" level="project" /> - <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:1.0" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.3" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-annotations:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-core:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: org.javassist:javassist:3.25.0-GA" level="project" /> - <orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.22" level="project" /> - <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.22" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.16" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" /> - <orderEntry type="library" name="Maven: io.springfox:springfox-bean-validators:2.9.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:2.0.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.1" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba:druid:1.1.10" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring-boot-web-starter:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring-boot-starter:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.5.3" level="project" /> - <orderEntry type="library" name="Maven: org.owasp.encoder:encoder:1.2.2" level="project" /> - <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" /> - <orderEntry type="library" name="Maven: com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4" level="project" /> - <orderEntry type="library" name="Maven: com.github.ulisesbocchio:jasypt-spring-boot:3.0.4" level="project" /> - <orderEntry type="library" name="Maven: org.jasypt:jasypt:1.9.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: com.github.ben-manes.caffeine:caffeine:2.6.2" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.9" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.13.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.4" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.6.1" level="project" /> - <orderEntry type="library" name="Maven: com.zaxxer:SparseBitSet:1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:3.1.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.19" level="project" /> - <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.06" level="project" /> - <orderEntry type="module-library"> - <library name="Maven: org.apache.tomcat.embed:tomcat-embed-core:0.0.0"> - <CLASSES> - <root url="jar://$MODULE_DIR$/src/main/resources/lib/tomcat-embed-core-9.0.30.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Maven: com.whyc.hik:jna:0.0.0"> - <CLASSES> - <root url="jar://$MODULE_DIR$/src/main/resources/lib/hik/jna.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library name="Maven: com.whyc.hik:examples:0.0.0"> - <CLASSES> - <root url="jar://$MODULE_DIR$/src/main/resources/lib/hik/examples.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.10" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.12.RELEASE" level="project" /> - <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" /> - <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" /> - <orderEntry type="library" name="Maven: commons-io:commons-io:2.15.0" level="project" /> - </component> -</module> \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/BattAlarmIdEnum.java b/src/main/java/com/whyc/constant/BattAlarmIdEnum.java new file mode 100644 index 0000000..2edd1cb --- /dev/null +++ b/src/main/java/com/whyc/constant/BattAlarmIdEnum.java @@ -0,0 +1,51 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum BattAlarmIdEnum { + ALARM_119001(119001,"鍦ㄧ嚎鐢靛帇鍛婅"), + ALARM_119002(119002,"缁勭鐢靛帇鍛婅"), + ALARM_119003(119003,"鍏呯數鐢垫祦鍛婅"), + ALARM_119004(119004,"鏀剧數鐢垫祦鍛婅"), + ALARM_119005(119005,"鍗曚綋鐢靛帇鍛婅"), + ALARM_119006(119006,"鍗曚綋娓╁害鍛婅"), + ALARM_119007(119007,"鍗曚綋鍐呴樆鍛婅") + ; + + private Integer stateId; + private String stateName; + + BattAlarmIdEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (BattAlarmIdEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (BattAlarmIdEnum logOpEnum : BattAlarmIdEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/BattSingalIdEnum.java b/src/main/java/com/whyc/constant/BattSingalIdEnum.java new file mode 100644 index 0000000..aabc7e7 --- /dev/null +++ b/src/main/java/com/whyc/constant/BattSingalIdEnum.java @@ -0,0 +1,61 @@ +package com.whyc.constant; + +public enum BattSingalIdEnum { + ALARM_1(1,"鍦ㄧ嚎鐢靛帇涓婁笂闄愬憡璀�"), + ALARM_2(2,"鍦ㄧ嚎鐢靛帇涓婇檺鍛婅"), + ALARM_3(3,"鍦ㄧ嚎鐢靛帇涓嬮檺鍛婅"), + ALARM_4(4,"鍦ㄧ嚎鐢靛帇涓嬩笅闄愬憡璀�"), + ALARM_5(5,"缁勭鐢靛帇涓婁笂闄愬憡璀�"), + ALARM_6(6,"缁勭鐢靛帇涓婇檺鍛婅"), + ALARM_7(7,"缁勭鐢靛帇涓嬮檺鍛婅"), + ALARM_8(8,"缁勭鐢靛帇涓嬩笅闄愬憡璀�"), + ALARM_9(9,"鍏呯數鐢垫祦涓婁笂闄愬憡璀�"), + ALARM_10(10,"鍏呯數鐢垫祦涓婇檺鍛婅"), + ALARM_11(11,"鍏呯數鐢垫祦涓嬮檺鍛婅"), + ALARM_12(12,"鍏呯數鐢垫祦涓嬩笅闄愬憡璀�"), + ALARM_13(13,"鏀剧數鐢垫祦涓婁笂闄愬憡璀�"), + ALARM_14(14,"鏀剧數鐢垫祦涓婇檺鍛婅"), + ALARM_15(15,"鏀剧數鐢垫祦涓嬮檺鍛婅"), + ALARM_16(16,"鏀剧數鐢垫祦涓嬩笅闄愬憡璀�"), + ALARM_17(17,"鍗曚綋鐢靛帇涓婁笂闄愬憡璀�"), + ALARM_18(18,"鍗曚綋鐢靛帇涓婇檺鍛婅"), + ALARM_19(19,"鍗曚綋鐢靛帇涓嬮檺鍛婅"), + ALARM_20(20,"鍗曚綋鐢靛帇涓嬩笅闄愬憡璀�"), + ALARM_21(21,"鍗曚綋娓╁害涓婁笂闄愬憡璀�"), + ALARM_22(22,"鍗曚綋娓╁害涓婇檺鍛婅"), + ALARM_23(23,"鍗曚綋娓╁害涓嬮檺鍛婅"), + ALARM_24(24,"鍗曚綋娓╁害涓嬩笅闄愬憡璀�"), + ALARM_25(25,"鍗曚綋鍐呴樆涓婁笂闄愬憡璀�"), + ALARM_26(26,"鍗曚綋鍐呴樆涓婇檺鍛婅"), + ALARM_27(27,"鍗曚綋鍐呴樆涓嬮檺鍛婅"), + ALARM_28(28,"鍗曚綋鍐呴樆涓嬩笅闄愬憡璀�"), + ; + + private Integer stateId; + private String stateName; + + BattSingalIdEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (BattSingalIdEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/BattStateEnum.java b/src/main/java/com/whyc/constant/BattStateEnum.java new file mode 100644 index 0000000..228f035 --- /dev/null +++ b/src/main/java/com/whyc/constant/BattStateEnum.java @@ -0,0 +1,48 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum BattStateEnum { + BATTSTATE_0(0,"鏈煡"), + BATTSTATE_1(1,"娴厖"), + BATTSTATE_2(2,"鍏呯數"), + BATTSTATE_3(3,"鏀剧數"), + BATTSTATE_4(4,"鍐呴樆娴嬭瘯") + ; + + private Integer stateId; + private String stateName; + + BattStateEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (BattStateEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (BattStateEnum logOpEnum : BattStateEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/Capperformance.java b/src/main/java/com/whyc/constant/Capperformance.java new file mode 100644 index 0000000..d498c8d --- /dev/null +++ b/src/main/java/com/whyc/constant/Capperformance.java @@ -0,0 +1,47 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum Capperformance { + BATTSTATE_1(1,"浼樼"), + BATTSTATE_2(2,"鍔e寲"), + BATTSTATE_3(3,"鎹熷潖"), + BATTSTATE_4(4,"鏈斁鐢�"), + ; + + private Integer stateId; + private String stateName; + + Capperformance(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (Capperformance ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (Capperformance logOpEnum : Capperformance.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/ChargeTypeEnum.java b/src/main/java/com/whyc/constant/ChargeTypeEnum.java new file mode 100644 index 0000000..ad30470 --- /dev/null +++ b/src/main/java/com/whyc/constant/ChargeTypeEnum.java @@ -0,0 +1,45 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum ChargeTypeEnum { + ChargeType_1(1,"宸叉斁鐢�"), + ChargeTyp_2(2,"鏈斁鐢�"), + ; + + private Integer stateId; + private String stateName; + + ChargeTypeEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (ChargeTypeEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (ChargeTypeEnum logOpEnum : ChargeTypeEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/DevAlarmEnum.java b/src/main/java/com/whyc/constant/DevAlarmEnum.java new file mode 100644 index 0000000..e4decaa --- /dev/null +++ b/src/main/java/com/whyc/constant/DevAlarmEnum.java @@ -0,0 +1,51 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum DevAlarmEnum { + ALARM_119020(119020,"閫氫俊鏁呴殰"), + ALARM_119021(119021,"璁惧楂樻俯鍛婅"), + ALARM_618501(618501,"缁х數鍣ㄥ憡璀�"), + ALARM_618502(618502,"姹囬泦鍣ㄩ�氳鏁呴殰鍛婅"), + ALARM_618503(618503,"璁惧杩囨俯鍛婅"), + ALARM_618504(618504,"浜屾瀬绠1鍛婅"), + ALARM_618505(618505,"骞叉帴鐐瑰憡璀�") + ; + + private Integer stateId; + private String stateName; + + DevAlarmEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (DevAlarmEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (DevAlarmEnum logOpEnum : DevAlarmEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/DevStateEnum.java b/src/main/java/com/whyc/constant/DevStateEnum.java new file mode 100644 index 0000000..5f49e8a --- /dev/null +++ b/src/main/java/com/whyc/constant/DevStateEnum.java @@ -0,0 +1,50 @@ +package com.whyc.constant; + + +import java.util.HashMap; +import java.util.Map; + +public enum DevStateEnum { + DEVSTATE_0(0,"鐩磋繛鍏呯數"), + DEVSTATE_1(1,"鍏呯數娴嬭瘯"), + DEVSTATE_2(2,"鏀剧數娴嬭瘯"), + DEVSTATE_3(3,"鍋滅數鏀剧數"), + DEVSTATE_4(4,"鍐呴樆娴嬭瘯") + ; + + private Integer stateId; + private String stateName; + + DevStateEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (DevStateEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (DevStateEnum logOpEnum : DevStateEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/FailReasonEnum.java b/src/main/java/com/whyc/constant/FailReasonEnum.java new file mode 100644 index 0000000..c316404 --- /dev/null +++ b/src/main/java/com/whyc/constant/FailReasonEnum.java @@ -0,0 +1,56 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum FailReasonEnum { + FAILREASON_3(3,"鍐呴儴閫氫俊鏁呴殰"), + FAILREASON_4(4,"绯荤粺瀛樺湪鍛婅"), + FAILREASON_5(5,"绯荤粺娴嬭瘯涓�"), + FAILREASON_6(6,"杈撳叆鐢靛帇杩囬珮"), + FAILREASON_7(7,"杈撳叆鐢靛帇杩囦綆"), + FAILREASON_8(8,"璐熻浇鍔熺巼澶皬"), + FAILREASON_9(9,"涓ゆ鐩存祦姣嶇嚎鍘嬪樊澶�"), + FAILREASON_10(10,"涓ゆ鐢垫睜缁勫帇宸ぇ"), + FAILREASON_11(11,"杩滅▼闂攣鐘舵��"), + FAILREASON_12(12,"鎬ュ仠鐘舵��"), + FAILREASON_13(13,"鍒囨崲寮�鍏崇矘杩炴垨鐢垫簮鐘舵�佸紓甯�"), + FAILREASON_14(14,"鍚姩棰戠箒"), + FAILREASON_15(15,"绯荤粺姝e湪鍐呴樆娴嬭瘯"), + ; + + private Integer stateId; + private String stateName; + + FailReasonEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (FailReasonEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<Integer,String> getOpInfo() { + Map<Integer,String> map=new HashMap<>(); + for (FailReasonEnum logOpEnum : FailReasonEnum.values()) { + map.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/PowerAlarmEnum.java b/src/main/java/com/whyc/constant/PowerAlarmEnum.java new file mode 100644 index 0000000..d205280 --- /dev/null +++ b/src/main/java/com/whyc/constant/PowerAlarmEnum.java @@ -0,0 +1,236 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum PowerAlarmEnum { + + ALARM_3000001(3000001,"鐢垫簮鍛婅"), + ALARM_3000002(3000002,"闃查浄鍣ㄦ晠闅滃憡璀�"), + ALARM_3000003(3000003,"璐熻浇鐔旀柇鍛婅"), + ALARM_3000004(3000004,"浜ゆ祦鎬绘晠闅滃憡璀�"), + ALARM_3000005(3000005,"鐩戞帶鍣ㄦ晠闅滃憡璀�"), + ALARM_3000006(3000006,"寮�鍏虫煖鎬绘姤璀�"), + ALARM_3000007(3000007,"鍗忚浆閫氫俊鏁呴殰鍛婅"), + ALARM_3000008(3000008,"鐢垫簮閫氫俊鏁呴殰鍛婅"), + + + ALARM_3100001(3100001,"浜ゆ祦杈撳叆1璺抽椄鍛婅"), + ALARM_3100002(3100002,"浜ゆ祦杈撳叆2璺抽椄鍛婅"), + ALARM_3100003(3100003,"浜ゆ祦杈撳叆1鐔斾笣鍛婅"), + ALARM_3100004(3100004,"浜ゆ祦杈撳叆2鐔斾笣鍛婅"), + ALARM_3100005(3100005,"浜ゆ祦杈撳叆1涓夌浉涓嶅钩琛″憡璀�"), + ALARM_3100006(3100006,"浜ゆ祦杈撳叆2涓夌浉涓嶅钩琛″憡璀�"), + ALARM_3100007(3100007,"浜ゆ祦杈撳叆1棰戠巼寮傚父鍛婅"), + ALARM_3100008(3100008,"浜ゆ祦杈撳叆2棰戠巼寮傚父鍛婅"), + ALARM_3100009(3100009,"浜ゆ祦杈撳叆1鍋滅數鍛婅"), + ALARM_3100010(3100010,"浜ゆ祦杈撳叆2鍋滅數鍛婅"), + ALARM_3100011(3100011,"浜ゆ祦1閲囬泦閫氫俊鏁呴殰鍛婅"), + ALARM_3100012(3100012,"浜ゆ祦2閲囬泦閫氫俊鏁呴殰鍛婅"), + ALARM_3100013(3100013,"浜ゆ祦鍋滅數閫氫俊鏁呴殰"), + ALARM_3100014(3100014,"浜ゆ祦鍋滅數鍛婅"), + + ALARM_3200001(3200001,"1璺氦娴丄鐩歌繃鍘嬪憡璀�"), + ALARM_3200002(3200002,"1璺氦娴丄鐩告瑺鍘嬪憡璀�"), + ALARM_3200003(3200003,"1璺氦娴丄鐩哥己鐩稿憡璀�"), + ALARM_3200004(3200004,"1璺氦娴丅鐩歌繃鍘嬪憡璀�"), + ALARM_3200005(3200005,"1璺氦娴丅鐩告瑺鍘嬪憡璀�"), + ALARM_3200006(3200006,"1璺氦娴丅鐩哥己鐩稿憡璀�"), + ALARM_3200007(3200007,"1璺氦娴丆鐩歌繃鍘嬪憡璀�"), + ALARM_3200008(3200008,"1璺氦娴丆鐩告瑺鍘嬪憡璀�"), + ALARM_3200009(3200009,"1璺氦娴丆鐩哥己鐩稿憡璀�"), + ALARM_3200010(3200010,"2璺氦娴丄鐩歌繃鍘嬪憡璀�"), + ALARM_3200011(3200011,"2璺氦娴丄鐩告瑺鍘嬪憡璀�"), + ALARM_3200012(3200012,"2璺氦娴丄鐩哥己鐩稿憡璀�"), + ALARM_3200013(3200013,"2璺氦娴丅鐩歌繃鍘嬪憡璀�"), + ALARM_3200014(3200014,"2璺氦娴丅鐩告瑺鍘嬪憡璀�"), + ALARM_3200015(3200015,"2璺氦娴丅鐩哥己鐩稿憡璀�"), + ALARM_3200016(3200016,"2璺氦娴丆鐩歌繃鍘嬪憡璀�"), + ALARM_3200017(3200017,"2璺氦娴丆鐩告瑺鍘嬪憡璀�"), + ALARM_3200018(3200018,"2璺氦娴丆鐩哥己鐩稿憡璀�"), + ALARM_3200019(3200019,"浜ゆ祦A鐩歌繃娴佸憡璀�"), + ALARM_3200020(3200020,"浜ゆ祦B鐩歌繃娴佸憡璀�"), + ALARM_3200021(3200021,"浜ゆ祦C鐩歌繃娴佸憡璀�"), + + ALARM_3300001(3300001,"鏁存祦鍣�1鎬绘晠闅滃憡璀�"), + ALARM_3300002(3300002,"鏁存祦鍣�2鎬绘晠闅滃憡璀�"), + ALARM_3300003(3300003,"鏁存祦鍣�3鎬绘晠闅滃憡璀�"), + ALARM_3300004(3300004,"鏁存祦鍣�4鎬绘晠闅滃憡璀�"), + ALARM_3300005(3300005,"鏁存祦鍣�5鎬绘晠闅滃憡璀�"), + ALARM_3300006(3300006,"鏁存祦鍣�6鎬绘晠闅滃憡璀�"), + ALARM_3300007(3300007,"鏁存祦鍣�7鎬绘晠闅滃憡璀�"), + ALARM_3300008(3300008,"鏁存祦鍣�8鎬绘晠闅滃憡璀�"), + ALARM_3300009(3300009,"鏁存祦鍣�9鎬绘晠闅滃憡璀�"), + ALARM_3300010(3300010,"鏁存祦鍣�10鎬绘晠闅滃憡璀�"), + ALARM_3300011(3300011,"鏁存祦鍣�11鎬绘晠闅滃憡璀�"), + ALARM_3300012(3300012,"鏁存祦鍣�12鎬绘晠闅滃憡璀�"), + ALARM_3300013(3300013,"鏁存祦鍣�13鎬绘晠闅滃憡璀�"), + ALARM_3300014(3300014,"鏁存祦鍣�14鎬绘晠闅滃憡璀�"), + ALARM_3300015(3300015,"鏁存祦鍣�15鎬绘晠闅滃憡璀�"), + ALARM_3300016(3300016,"鏁存祦鍣�16鎬绘晠闅滃憡璀�"), + ALARM_3300017(3300017,"鏁存祦鍣�1杩囧帇鍛婅"), + ALARM_3300018(3300018,"鏁存祦鍣�2杩囧帇鍛婅"), + ALARM_3300019(3300019,"鏁存祦鍣�3杩囧帇鍛婅"), + ALARM_3300020(3300020,"鏁存祦鍣�4杩囧帇鍛婅"), + ALARM_3300021(3300021,"鏁存祦鍣�5杩囧帇鍛婅"), + ALARM_3300022(3300022,"鏁存祦鍣�6杩囧帇鍛婅"), + ALARM_3300023(3300023,"鏁存祦鍣�7杩囧帇鍛婅"), + ALARM_3300024(3300024,"鏁存祦鍣�8杩囧帇鍛婅"), + ALARM_3300025(3300025,"鏁存祦鍣�9杩囧帇鍛婅"), + ALARM_3300026(3300026,"鏁存祦鍣�10杩囧帇鍛婅"), + ALARM_3300027(3300027,"鏁存祦鍣�11杩囧帇鍛婅"), + ALARM_3300028(3300028,"鏁存祦鍣�12杩囧帇鍛婅"), + ALARM_3300029(3300029,"鏁存祦鍣�13杩囧帇鍛婅"), + ALARM_3300030(3300030,"鏁存祦鍣�14杩囧帇鍛婅"), + ALARM_3300031(3300031,"鏁存祦鍣�15杩囧帇鍛婅"), + ALARM_3300032(3300032,"鏁存祦鍣�16杩囧帇鍛婅"), + ALARM_3300033(3300033,"鏁存祦鍣�1娆犲帇鍛婅"), + ALARM_3300034(3300034,"鏁存祦鍣�2娆犲帇鍛婅"), + ALARM_3300035(3300035,"鏁存祦鍣�3娆犲帇鍛婅"), + ALARM_3300036(3300036,"鏁存祦鍣�4娆犲帇鍛婅"), + ALARM_3300037(3300037,"鏁存祦鍣�5娆犲帇鍛婅"), + ALARM_3300038(3300038,"鏁存祦鍣�6娆犲帇鍛婅"), + ALARM_3300039(3300039,"鏁存祦鍣�7娆犲帇鍛婅"), + ALARM_3300040(3300040,"鏁存祦鍣�8娆犲帇鍛婅"), + ALARM_3300041(3300041,"鏁存祦鍣�9娆犲帇鍛婅"), + ALARM_3300042(3300042,"鏁存祦鍣�10娆犲帇鍛婅"), + ALARM_3300043(3300043,"鏁存祦鍣�11娆犲帇鍛婅"), + ALARM_3300044(3300044,"鏁存祦鍣�12娆犲帇鍛婅"), + ALARM_3300045(3300045,"鏁存祦鍣�13娆犲帇鍛婅"), + ALARM_3300046(3300046,"鏁存祦鍣�14娆犲帇鍛婅"), + ALARM_3300047(3300047,"鏁存祦鍣�15娆犲帇鍛婅"), + ALARM_3300048(3300048,"鏁存祦鍣�16娆犲帇鍛婅"), + ALARM_3300049(3300049,"鏁存祦鍣�1杩囨祦鍛婅"), + ALARM_3300050(3300050,"鏁存祦鍣�2杩囨祦鍛婅"), + ALARM_3300051(3300051,"鏁存祦鍣�3杩囨祦鍛婅"), + ALARM_3300052(3300052,"鏁存祦鍣�4杩囨祦鍛婅"), + ALARM_3300053(3300053,"鏁存祦鍣�5杩囨祦鍛婅"), + ALARM_3300054(3300054,"鏁存祦鍣�6杩囨祦鍛婅"), + ALARM_3300055(3300055,"鏁存祦鍣�7杩囨祦鍛婅"), + ALARM_3300056(3300056,"鏁存祦鍣�8杩囨祦鍛婅"), + ALARM_3300057(3300057,"鏁存祦鍣�9杩囨祦鍛婅"), + ALARM_3300058(3300058,"鏁存祦鍣�10杩囨祦鍛婅"), + ALARM_3300059(3300059,"鏁存祦鍣�11杩囨祦鍛婅"), + ALARM_3300060(3300060,"鏁存祦鍣�12杩囨祦鍛婅"), + ALARM_3300061(3300061,"鏁存祦鍣�13杩囨祦鍛婅"), + ALARM_3300062(3300062,"鏁存祦鍣�14杩囨祦鍛婅"), + ALARM_3300063(3300063,"鏁存祦鍣�15杩囨祦鍛婅"), + ALARM_3300064(3300064,"鏁存祦鍣�16杩囨祦鍛婅"), + ALARM_3300065(3300065,"鏁存祦鍣�1浜ゆ祦寮傚父鍛婅"), + ALARM_3300066(3300066,"鏁存祦鍣�2浜ゆ祦寮傚父鍛婅"), + ALARM_3300067(3300067,"鏁存祦鍣�3浜ゆ祦寮傚父鍛婅"), + ALARM_3300068(3300068,"鏁存祦鍣�4浜ゆ祦寮傚父鍛婅"), + ALARM_3300069(3300069,"鏁存祦鍣�5浜ゆ祦寮傚父鍛婅"), + ALARM_3300070(3300070,"鏁存祦鍣�6浜ゆ祦寮傚父鍛婅"), + ALARM_3300071(3300071,"鏁存祦鍣�7浜ゆ祦寮傚父鍛婅"), + ALARM_3300072(3300072,"鏁存祦鍣�8浜ゆ祦寮傚父鍛婅"), + ALARM_3300073(3300073,"鏁存祦鍣�9浜ゆ祦寮傚父鍛婅"), + ALARM_3300074(3300074,"鏁存祦鍣�10浜ゆ祦寮傚父鍛婅"), + ALARM_3300075(3300075,"鏁存祦鍣�11浜ゆ祦寮傚父鍛婅"), + ALARM_3300076(3300076,"鏁存祦鍣�12浜ゆ祦寮傚父鍛婅"), + ALARM_3300077(3300077,"鏁存祦鍣�13浜ゆ祦寮傚父鍛婅"), + ALARM_3300078(3300078,"鏁存祦鍣�14浜ゆ祦寮傚父鍛婅"), + ALARM_3300079(3300079,"鏁存祦鍣�15浜ゆ祦寮傚父鍛婅"), + ALARM_3300080(3300080,"鏁存祦鍣�16浜ゆ祦寮傚父鍛婅"), + + ALARM_3400001(3400001,"鐢垫睜缁�1鐔旀柇鍛婅"), + ALARM_3400002(3400002,"鐢垫睜缁�2鐔旀柇鍛婅"), + ALARM_3400003(3400003,"鐢垫睜缁�1鐢靛帇浣庡憡璀�"), + ALARM_3400004(3400004,"鐢垫睜缁�2鐢靛帇浣庡憡璀�"), + ALARM_3400005(3400005,"鐢垫睜缁�1涓嬬數鍛婅"), + ALARM_3400006(3400006,"鐢垫睜缁�2涓嬬數鍛婅"), + ALARM_3400007(3400007,"鐢垫睜缁�1鍏呯數杩囨祦鍛婅"), + ALARM_3400008(3400008,"鐢垫睜缁�2鍏呯數杩囨祦鍛婅"), + + ALARM_3500001(3500001,"娓╂劅1閫氫俊鏁呴殰鍛婅"), + ALARM_3500002(3500002,"娓╂劅2閫氫俊鏁呴殰鍛婅"), + ALARM_3500003(3500003,"娓╂劅3閫氫俊鏁呴殰鍛婅"), + ALARM_3500004(3500004,"婀挎劅1閫氫俊鏁呴殰鍛婅"), + ALARM_3500005(3500005,"婀挎劅2閫氫俊鏁呴殰鍛婅"), + ALARM_3500006(3500006,"婀挎劅3閫氫俊鏁呴殰鍛婅"), + ALARM_3500007(3500007,"鐑熸劅1鎶ヨ鍛婅"), + ALARM_3500008(3500008,"鐑熸劅2鎶ヨ鍛婅"), + ALARM_3500009(3500009,"鐑熸劅3鎶ヨ鍛婅"), + ALARM_3500010(3500010,"鐑熸劅1閫氫俊鏁呴殰鍛婅"), + ALARM_3500011(3500011,"鐑熸劅2閫氫俊鏁呴殰鍛婅"), + ALARM_3500012(3500012,"鐑熸劅3閫氫俊鏁呴殰鍛婅"), + + + + ALARM_3600001(3600001,"鐩存祦鐢靛帇杩囬珮鍛婅"), + ALARM_3600002(3600002,"鐩存祦鐢靛帇杩囦綆鍛婅"), + ALARM_3600003(3600003,"鐩存祦鎬绘晠闅滃憡璀�"), + ALARM_3600004(3600004,"鐩存祦杩囨祦鍛婅") + + ; + + private Integer stateId; + private String stateName; + + PowerAlarmEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (PowerAlarmEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + + public static Map<String,Map<Integer,String>> getOpInfo() { + Map<String,Map<Integer,String>> map=new HashMap<>(); + Map<Integer,String> almmap30=new HashMap<>(); + Map<Integer,String> almmap31=new HashMap<>(); + Map<Integer,String> almmap32=new HashMap<>(); + Map<Integer,String> almmap33=new HashMap<>(); + Map<Integer,String> almmap34=new HashMap<>(); + Map<Integer,String> almmap35=new HashMap<>(); + Map<Integer,String> almmap36=new HashMap<>(); + for (PowerAlarmEnum logOpEnum : PowerAlarmEnum.values()) { + if(logOpEnum.getStateId()/100000==30){ + almmap30.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("鏁呴殰鍛婅",almmap30); + } + if(logOpEnum.getStateId()/100000==31){ + almmap31.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("浜ゆ祦杈撳叆鍛婅",almmap31); + } + if(logOpEnum.getStateId()/100000==32){ + almmap32.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("浜ゆ祦ABC鍛婅",almmap32); + } + if(logOpEnum.getStateId()/100000==33){ + almmap33.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("鏁存祦鍣ㄥ憡璀�",almmap33); + } + if(logOpEnum.getStateId()/100000==34){ + almmap34.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("钃勭數姹犲憡璀�",almmap34); + } + if(logOpEnum.getStateId()/100000==35){ + almmap35.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("娓╂箍搴︾儫鎰熷憡璀�",almmap35); + } + if(logOpEnum.getStateId()/100000==36){ + almmap36.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("鐩存祦鍛婅",almmap36); + } + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/constant/StopReasonEnum.java b/src/main/java/com/whyc/constant/StopReasonEnum.java new file mode 100644 index 0000000..bf218b6 --- /dev/null +++ b/src/main/java/com/whyc/constant/StopReasonEnum.java @@ -0,0 +1,93 @@ +package com.whyc.constant; + +import java.util.HashMap; +import java.util.Map; + +public enum StopReasonEnum { + STOPREASON_1001(1001,"鏀剧數鏃堕棿鍒扮粓姝�"), + STOPREASON_1002(1001,"鏀剧數瀹归噺鍒扮粓姝�"), + STOPREASON_1003(1001,"鍗曚綋鐢靛帇涓嬮檺鍒扮粓姝�"), + STOPREASON_1004(1004,"缁勭鐢靛帇涓嬮檺鍒扮粓姝�"), + + STOPREASON_2001(2001,"璁惧鎺夌數缁堟"), + STOPREASON_2002(2002,"鎵嬪姩缁堟"), + STOPREASON_2003(2003,"鍗曚綋娓╁害涓婇檺鍒扮粓姝�"), + STOPREASON_2004(2004,"甯傜數涓柇缁堟"), + STOPREASON_2005(2005,"鍗曚綋閫氫俊寮傚父缁堟"), + STOPREASON_2006(2006,"瀛樺偍鏁版嵁婊$粓姝�"), + STOPREASON_2007(2007,"鏈哄唴娓╁害寮傚父缁堟"), + STOPREASON_2008(2008,"鏀剧數鐢垫祦寮傚父缁堟"), + STOPREASON_2009(2009,"鍚庡彴閫氫俊涓柇缁堟"), + STOPREASON_2010(2010,"鍐呴儴绋嬪簭寮傚父缁堟"), + STOPREASON_2011(2011,"鐢垫簮鐢靛帇楂樼粓姝�"), + STOPREASON_2012(2012,"鍗忚浆閫氫俊寮傚父"), + STOPREASON_2013(2013,"鍒囨崲瑁呯疆閫氫俊鏁呴殰"), + STOPREASON_2014(2014,"鍒囨崲瑁呯疆鏁呴殰"), + STOPREASON_2015(2015,"閫嗗彉鍣ㄦā鍧楁晠闅�"), + STOPREASON_2016(2016,"璐熻浇鍔熺巼灏�"), + STOPREASON_2017(2017,"骞叉帴鐐硅緭鍏ユ晠闅�"), + STOPREASON_2018(2018,"姣嶈仈閫氫俊寮傚父"), + STOPREASON_2019(2019,"姣嶈仈鎵嬪姩鍏抽棴鎴栦俊鍙峰紓甯�"), + STOPREASON_2020(2020,"閫嗗彉鍣ㄩ�氫俊鏁呴殰"), + STOPREASON_2021(2021,"闃查浄鍣ㄦ晠闅�"), + STOPREASON_2022(2022,"鏈烘煖琛ㄥご閫氫俊鏁呴殰"), + STOPREASON_2023(2023,"闄愭祦鍏呯數妯″潡鏁呴殰"), + STOPREASON_2024(2024,"绱ф�ュ仠姝�"), + STOPREASON_2025(2025,"杩滅▼闂攣"), + STOPREASON_2026(2026,"鍒囨崲瑁呯疆寮�鍏冲紓甯�"), + STOPREASON_2027(2027,"浜ゆ祦绌哄紑寮傚父"), + STOPREASON_2028(2028,"浜ゆ祦鎺ヨЕ鍣ㄥ紓甯�"), + STOPREASON_2029(2029,"鐩存祦绌哄紑寮傚父"), + STOPREASON_2030(2030,"鍒囨崲寮�鍏崇矘杩炴垨鐢垫簮鐘舵�佸紓甯�"), + STOPREASON_2031(2031,"鐢甸樆绠辨俯搴﹁繃楂�"), + STOPREASON_2032(2032,"闄嶅帇妯″潡杩囨俯闄愭祦"), + STOPREASON_2033(2033,"闄嶅帇妯″潡椋庢墖鏁呴殰"), + STOPREASON_2034(2034,"闄嶅帇妯″潡杩囨祦鏁呴殰"), + STOPREASON_2035(2035,"鍏呯數鎴鍒�"), + STOPREASON_2036(2036,"鍦ㄧ嚎鎺ヨЕ鍣ㄧ姸鎬佸紓甯�") + ; + + private Integer stateId; + private String stateName; + + StopReasonEnum(Integer stateId, String stateName) { + this.stateId = stateId; + this.stateName = stateName; + } + + public Integer getStateId() { + return stateId; + } + + public String getStateName() { + return stateName; + } + + public static String getValue(Integer stateId) { + if(stateId==null){ + return ""; + } + for (StopReasonEnum ele : values()) { + if(ele.getStateId().equals(stateId)) { + return ele.getStateName(); + } + } + return null; + } + public static Map<String,Map<Integer,String>> getOpInfo() { + Map<String,Map<Integer,String>> map=new HashMap<>(); + Map<Integer,String> almmap1=new HashMap<>(); + Map<Integer,String> almmap2=new HashMap<>(); + for (StopReasonEnum logOpEnum : StopReasonEnum.values()) { + if(logOpEnum.getStateId()/1000==1){ + almmap1.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("姝e父鏍稿缁堟",almmap1); + } + if(logOpEnum.getStateId()/1000==2){ + almmap2.put(logOpEnum.getStateId(),logOpEnum.getStateName()); + map.put("寮傚父鏍稿缁堟",almmap2); + } + } + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/AlarmController.java b/src/main/java/com/whyc/controller/AlarmController.java new file mode 100644 index 0000000..cfbf417 --- /dev/null +++ b/src/main/java/com/whyc/controller/AlarmController.java @@ -0,0 +1,68 @@ +package com.whyc.controller; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_alarm.BattalarmData; +import com.whyc.pojo.db_alarm.DevalarmData; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; +import com.whyc.service.BattalarmDataService; +import com.whyc.service.DevalarmDataService; +import com.whyc.service.PwrdevAlarmService; +import com.whyc.util.ActionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@Api(tags = "鍛婅绠$悊") +@RequestMapping("alm") +public class AlarmController { + @Autowired + private BattalarmDataService battalarmDataService; + + @Autowired + private DevalarmDataService devalarmDataService; + + @Autowired + private PwrdevAlarmService pwrdevAlarmService; + + @PostMapping("getBattAlmReal") + @ApiOperation("鑾峰彇鐢垫睜缁勫疄鏃跺憡璀︿俊鎭�") + public Response getBattAlmReal(@RequestBody AlmDto almDto){ + almDto.setUid(ActionUtil.getUser().getId()); + return battalarmDataService.getBattAlmReal(almDto); + } + + @PostMapping("getDevAlmReal") + @ApiOperation("鑾峰彇璁惧瀹炴椂鍛婅淇℃伅") + public Response getDevAlmReal(@RequestBody AlmDto almDto){ + almDto.setUid(ActionUtil.getUser().getId()); + return devalarmDataService.getDevAlmReal(almDto); + } + + @PostMapping("getPwrAlmReal") + @ApiOperation("鑾峰彇鐢垫簮瀹炴椂鍛婅淇℃伅") + public Response getPwrAlmReal(@RequestBody AlmDto almDto){ + almDto.setUid(ActionUtil.getUser().getId()); + return pwrdevAlarmService.getPwrAlmReal(almDto); + } + + @GetMapping("updateBattConfrim") + @ApiOperation(value = "纭鐢垫睜鍛婅") + public Response updateBattConfrim(@RequestParam Integer num){ + return battalarmDataService.updateBattConfrim(num); + } + + @GetMapping("updateDevConfrim") + @ApiOperation(value = "纭璁惧鍛婅") + public Response updateDevConfrim(@RequestParam Integer num){ + return devalarmDataService.updateDevConfrim(num); + } + + @GetMapping("updatePwrConfrim") + @ApiOperation(value = "纭鐢垫簮鍛婅") + public Response updatePwrConfrim(@RequestParam Integer num){ + return pwrdevAlarmService.updatePwrConfrim(num); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/AlarmHistoryController.java b/src/main/java/com/whyc/controller/AlarmHistoryController.java new file mode 100644 index 0000000..fbd00b5 --- /dev/null +++ b/src/main/java/com/whyc/controller/AlarmHistoryController.java @@ -0,0 +1,43 @@ +package com.whyc.controller; + +import com.whyc.dto.AlmHis.BattAlmPar; +import com.whyc.dto.AlmHis.DevAlmPar; +import com.whyc.dto.AlmHis.PwrAlmPar; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.service.AlarmHisService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; + +@RestController +@Api(tags = "鍛婅鍘嗗彶绠$悊") +@RequestMapping("almHis") +public class AlarmHistoryController { + @Autowired + private AlarmHisService service; + + @PostMapping("getBattAlmHis") + @ApiOperation(value = "鐢垫睜鍛婅鍘嗗彶璁板綍鏌ヨ") + public Response serchByInfo(@RequestBody BattAlmPar almDto) throws ParseException, InterruptedException { + return service.getBattAlmHis(almDto); + } + + @PostMapping("getDevAlmHis") + @ApiOperation(value = "璁惧鍛婅鍘嗗彶璁板綍鏌ヨ") + public Response getDevAlmHis(@RequestBody DevAlmPar almDto) throws ParseException, InterruptedException { + return service.getDevAlmHis(almDto); + } + + @PostMapping("getPwrAlmHis") + @ApiOperation(value = "鐢垫簮鍛婅鍘嗗彶璁板綍鏌ヨ") + public Response getPwrAlmHis(@RequestBody PwrAlmPar almDto) throws ParseException, InterruptedException { + return service.getPwrAlmHis(almDto); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/AlmParamController.java b/src/main/java/com/whyc/controller/AlmParamController.java new file mode 100644 index 0000000..3979bc2 --- /dev/null +++ b/src/main/java/com/whyc/controller/AlmParamController.java @@ -0,0 +1,70 @@ +package com.whyc.controller; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_param.BattAlmparam; +import com.whyc.pojo.db_param.DevAlmparam; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; +import com.whyc.service.BattAlmparamService; +import com.whyc.service.DevAlmparamService; +import com.whyc.service.PwrdevAlarmParamService; +import com.whyc.util.ActionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@Api(tags = "鍛婅鍙傛暟绠$悊") +@RequestMapping("almParam") +public class AlmParamController { + @Autowired + private BattAlmparamService battAlmparamService; + + @Autowired + private DevAlmparamService devAlmparamService; + + @Autowired + private PwrdevAlarmParamService pwrAlmparamService; + + + @PostMapping("getBattAlmParam") + @ApiOperation("鑾峰彇鐢垫睜鍛婅鍙傛暟") + public Response getBattAlmParam(@RequestBody AlmDto almDto){ + almDto.setUid(ActionUtil.getUser().getId()); + return battAlmparamService.getBattAlmParam(almDto); + } + + @PostMapping("setBattAlmParam") + @ApiOperation("淇敼鐢垫睜鍛婅鍙傛暟") + public Response setBattAlmParam(@RequestBody List<BattAlmparam> almparamList){ + return battAlmparamService.setBattAlmParam(almparamList); + } + + @GetMapping("getDevAlmParam") + @ApiOperation("鑾峰彇璁惧鍛婅鍙傛暟") + public Response getDevAlmParam(@RequestParam(required = false) Integer almId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){ + return devAlmparamService.getDevAlmParam(almId,pageNum,pageSize); + } + + @PostMapping("setDevAlmParam") + @ApiOperation("淇敼璁惧鍛婅鍙傛暟") + public Response setDevAlmParam(@RequestBody List<DevAlmparam> almparamList){ + return devAlmparamService.setDevAlmParam(almparamList); + } + + @PostMapping("getPwrAlmParam") + @ApiOperation("鑾峰彇鐢垫簮鍛婅鍙傛暟") + public Response getPwrAlmParam(@RequestBody AlmDto almDto){ + almDto.setUid(ActionUtil.getUser().getId()); + return pwrAlmparamService.getPwrAlmParam(almDto); + } + + @PostMapping("setPwrAlmParam") + @ApiOperation("淇敼鐢垫簮鍛婅鍙傛暟") + public Response setPwrAlmParam(@RequestBody List<PwrdevAlarmParam> almparamList){ + return pwrAlmparamService.setPwrAlmParam(almparamList); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/AlmparamFromDeviceController.java b/src/main/java/com/whyc/controller/AlmparamFromDeviceController.java new file mode 100644 index 0000000..04dbac6 --- /dev/null +++ b/src/main/java/com/whyc/controller/AlmparamFromDeviceController.java @@ -0,0 +1,29 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.pojo.db_ram_db.AlmparamFromDevice; +import com.whyc.service.AlmparamFromDeviceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RequestMapping("almparamFromDevice") +@RestController +@Api(tags = "璁惧鐨勫憡璀﹀弬鏁扮鐞�") +public class AlmparamFromDeviceController { + @Autowired + private AlmparamFromDeviceService service; + + @ApiOperation(value = "璁惧鐨勫憡璀﹀弬鏁拌缃�") + @PostMapping("setAlarmFromDevice") + public Response setAlarmFromDevice(@RequestBody AlmparamFromDevice par){ + return service.setAlarmFromDevice(par); + } + + @ApiOperation(value = "璁惧鐨勫憡璀﹀弬鏁拌鍙�") + @GetMapping("getAlarmFromDevice") + public Response getAlarmFromDevice(@RequestParam int devId){ + return service.getAlarmFromDevice(devId); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/ConditionController.java b/src/main/java/com/whyc/controller/ConditionController.java index 4ed1bd9..efd7b9d 100644 --- a/src/main/java/com/whyc/controller/ConditionController.java +++ b/src/main/java/com/whyc/controller/ConditionController.java @@ -2,10 +2,7 @@ import com.whyc.dto.Response; import com.whyc.pojo.db_user.User; -import com.whyc.service.BaojigroupService; -import com.whyc.service.BattInfService; -import com.whyc.service.PowerInfService; -import com.whyc.service.StationInfService; +import com.whyc.service.*; import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -27,6 +24,24 @@ @Autowired private BattInfService binfService; + + @Autowired + private BattalarmDataService almDataService; + + @Autowired + private DevalarmDataService devAlmService; + + @Autowired + private PwrdevAlarmService pwrAlmService; + + @Autowired + private DeviceStateService deviceStateService; + + @Autowired + private BattRtstateService rtstateService; + + @Autowired + private BatttestdataInfService tinfService; @ApiOperation("鑾峰彇鎵�鏈夌殑鐪佷唤(涓嬫媺)") @GetMapping("getProviceByUid") @@ -134,6 +149,45 @@ return bjGroupService.getBaojiUserByUid(uinf.getId()); } + @ApiOperation(value = "鑾峰彇鐢垫睜鍛婅绫诲瀷(涓嬫媺)") + @GetMapping("getAlarmIdType") + public Response getAlarmIdType(){ + return almDataService.getAlarmIdType(); + } + + @ApiOperation(value = "鑾峰彇璁惧鍛婅绫诲瀷(涓嬫媺)") + @GetMapping("getDevAlmIdType") + public Response getDevAlmIdType(){ + return devAlmService.getDevAlmIdType(); + } + @ApiOperation(value = "鑾峰彇鐢垫簮鍛婅绫诲瀷(涓嬫媺)") + @GetMapping("getPwrAlmIdType") + public Response getPwrAlmIdType(){ + return pwrAlmService.getPwrAlmIdType(); + } + @ApiOperation(value = "鑾峰彇鏍稿鍋滄鍘熷洜绫诲瀷(涓嬫媺)") + @GetMapping("getStopReasonType") + public Response getStopReasonType(){ + return tinfService.getStopReasonType(); + } + + @ApiOperation(value = "鑾峰彇瀹归噺鎬ц兘(涓嬫媺)") + @GetMapping("getCapperformance") + public Response getCapperformance(){ + return binfService.getCapperformance(); + } + + @ApiOperation(value = "鑾峰彇璁惧宸ヤ綔绫诲瀷(涓嬫媺)") + @GetMapping("getDevState") + public Response getDevState(){ + return deviceStateService.getDevState(); + } + @ApiOperation(value = "鑾峰彇鐢垫睜缁勫伐浣滅姸鎬佺被鍨�(涓嬫媺)") + @GetMapping("getBattState") + public Response getBattState(){ + return rtstateService.getBattState(); + } + } \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/DeviceSetparamController.java b/src/main/java/com/whyc/controller/DeviceSetparamController.java new file mode 100644 index 0000000..1227ad4 --- /dev/null +++ b/src/main/java/com/whyc/controller/DeviceSetparamController.java @@ -0,0 +1,55 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.pojo.db_ram_db.DeviceSetparam; +import com.whyc.pojo.db_user.User; +import com.whyc.service.DeviceSetparamService; +import com.whyc.util.ActionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@Api(tags = "璁惧杩滅▼鎺у埗绠$悊") +@RequestMapping("devSetparam") +public class DeviceSetparamController { + @Autowired + private DeviceSetparamService service; + + + @ApiOperation("璁剧疆鏀剧數鍙傛暟") + @PostMapping("updateParam") + public Response updateParam(@RequestBody DeviceSetparam param) { + return service.updateParam(param); + } + @ApiOperation("璇诲彇鏀剧數鍙傛暟") + @GetMapping("getParam") + public Response getParam(@RequestParam int devId, @RequestParam int battGroupNum) { + return service.getParam(devId, battGroupNum); + } + + @ApiOperation("杩滅▼閲嶅惎") + @GetMapping("restart") + public Response restart(@RequestParam int devId, @RequestParam int battGroupNum) { + return service.restart(devId, battGroupNum); + } + + @ApiOperation("杩滅▼鏍稿") + @GetMapping("startDis") + public Response startDis(@RequestParam int devId, @RequestParam int battGroupNum) { + return service.startDis(devId, battGroupNum); + } + + @ApiOperation("鍐呴樆娴嬭瘯") + @GetMapping("startRes") + public Response startRes(@RequestParam int devId, @RequestParam int battGroupNum) { + return service.startRes(devId, battGroupNum); + } + + @ApiOperation("鍋滄鍐呴樆娴嬭瘯") + @GetMapping("stopRes") + public Response stopRes(@RequestParam int devId, @RequestParam int battGroupNum) { + return service.stopRes(devId, battGroupNum); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/ExportFileController.java b/src/main/java/com/whyc/controller/ExportFileController.java new file mode 100644 index 0000000..00e6f84 --- /dev/null +++ b/src/main/java/com/whyc/controller/ExportFileController.java @@ -0,0 +1,26 @@ +package com.whyc.controller; + +import com.whyc.dto.Statistic.MonStic; +import com.whyc.service.ExportService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; + +@RestController +@Api(tags = "瀵煎嚭鏂囦欢") +@RequestMapping("export") +public class ExportFileController { + @Autowired + private ExportService service; + + @PostMapping("exportBattTinfStatistic") + @ApiOperation(value = "鍗曡妭鏁伴噺缁熻瀵煎嚭锛�1.2.14锛�") + public void exportBattTinfStatistic(HttpServletRequest req, HttpServletResponse resp ,@RequestBody MonStic stic) throws ParseException { + service.exportBattTinfStatistic(req,resp,stic); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/HistoryIdController.java b/src/main/java/com/whyc/controller/HistoryIdController.java new file mode 100644 index 0000000..22e9fd8 --- /dev/null +++ b/src/main/java/com/whyc/controller/HistoryIdController.java @@ -0,0 +1,41 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.pojo.db_user.User; +import com.whyc.service.BattRealdataIdService; +import com.whyc.service.StationInfService; +import com.whyc.util.ActionUtil; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Api(tags = "鍘嗗彶瀹炴椂绠$悊") +@RequestMapping("hisId") +public class HistoryIdController { + @Autowired + private BattRealdataIdService battHisIdService; + + + @ApiOperation("鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勭數鍘嬫暟鎹�") + @GetMapping("getBattQuarterVol") + public Response getBattQuarterVol(@RequestParam Integer battgroupId) { + return battHisIdService.getBattQuarterVol(battgroupId); + } + + @ApiOperation("鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勫唴闃绘暟鎹�") + @GetMapping("getBattQuarterRes") + public Response getBattQuarterRes(@RequestParam Integer battgroupId) { + return battHisIdService.getBattQuarterRes(battgroupId); + } + + @ApiOperation("鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勬俯搴︽暟鎹�") + @GetMapping("getBattQuarterTmp") + public Response getBattQuarterTmp(@RequestParam Integer battgroupId) { + return battHisIdService.getBattQuarterTmp(battgroupId); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/InfoContoller.java b/src/main/java/com/whyc/controller/InfoContoller.java index 4153705..79b94bd 100644 --- a/src/main/java/com/whyc/controller/InfoContoller.java +++ b/src/main/java/com/whyc/controller/InfoContoller.java @@ -18,7 +18,7 @@ @RestController @Api(tags = "鏈烘埧锛岀數婧愶紝鐢垫睜缁勭鐞�") -@RequestMapping("condition") +@RequestMapping("info") public class InfoContoller { @Autowired diff --git a/src/main/java/com/whyc/controller/PwrdevAlarmParamStandController.java b/src/main/java/com/whyc/controller/PwrdevAlarmParamStandController.java new file mode 100644 index 0000000..9050004 --- /dev/null +++ b/src/main/java/com/whyc/controller/PwrdevAlarmParamStandController.java @@ -0,0 +1,50 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParamStand; +import com.whyc.service.PwrdevAlarmParamStandService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +@RestController +@Api(tags = "鏍囧噯鍙傛暟绠$悊") +@RequestMapping("stand") +public class PwrdevAlarmParamStandController { + @Autowired + private PwrdevAlarmParamStandService service; + + @ApiOperation(value = "鏌ヨ鏍囧噯鍙傛暟") + @GetMapping("getPwrStandParam") + public Response getPwrStandParam(@RequestParam Integer powerType){ + return service.getPwrStandParam(powerType); + } + + @ApiOperation(value = "璁剧疆鏍囧噯鍙傛暟") + @PostMapping("setPwrStandParam") + public Response setPwrStandParam(@RequestBody PwrdevAlarmParamStand stand){ + return service.setPwrStandParam(stand); + } + + @ApiOperation(value = "鏌ヨ瑙勮寖鏂囦欢") + @GetMapping("getStandFile") + public Response getStandFile(@RequestParam Integer powerType,@RequestParam String fileName){ + return service.getStandFile(powerType,fileName); + } + @ApiOperation(value = "涓婁紶瑙勮寖鏂囦欢") + @PostMapping("uploadStandFile") + public Response uploadStandFile(@RequestParam MultipartFile multipartFile,@RequestParam String num) throws IOException { + return service.uploadStandFile(multipartFile,num); + } + + @ApiOperation(value = "娣诲姞鏍囧噯鍙傛暟") + @PostMapping("addPwrStandParam") + public Response addPwrStandParam(@RequestBody PwrdevAlarmParamStand stand){ + return service.addPwrStandParam(stand); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/RealContoller.java b/src/main/java/com/whyc/controller/RealContoller.java new file mode 100644 index 0000000..356358e --- /dev/null +++ b/src/main/java/com/whyc/controller/RealContoller.java @@ -0,0 +1,71 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.pojo.db_data_history.PwrdevHistorydataId; +import com.whyc.pojo.db_user.User; +import com.whyc.service.*; +import com.whyc.util.ActionUtil; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; + +@RestController +@Api(tags = "瀹炴椂椤甸潰") +@RequestMapping("real") +public class RealContoller { + @Autowired + private PwrdevHistorydataIdService pwrdevHistorydataIdService; + + @Autowired + private BattRealdataIdService battRealdataIdService; + + @Autowired + private BatttestdataInfService tinfService; + + @Autowired + private BatttestdataIdService tdataIdService; + + @ApiOperation(value = "绯荤粺姒傝鑾峰彇鍗婂皬鏃朵氦娴佽緭鍏ョ粺璁�") + @GetMapping("getHalfHourPwrHisAcinData") + public Response getHalfHourPwrHisAcinData(@RequestParam Integer powerId,@RequestParam Integer granularity){ + return pwrdevHistorydataIdService.getHalfHourPwrHisAcinData(powerId,granularity); + } + + @ApiOperation(value = "绯荤粺姒傝鑾峰彇鍗婂皬鏃剁洿娴佽緭鍑虹粺璁�") + @GetMapping("getHalfHourPwrHisDcoutData") + public Response getHalfHourPwrHisDcoutData(@RequestParam Integer powerId,@RequestParam Integer granularity){ + return pwrdevHistorydataIdService.getHalfHourPwrHisDcoutData(powerId,granularity); + } + + @ApiOperation(value = "绯荤粺姒傝鑾峰彇鍗婂皬鏃舵牳瀹硅澶囦俊鎭�") + @GetMapping("getHalfHourBattDevData") + public Response getHalfHourBattDevData(@RequestParam Integer battgroupId,@RequestParam Integer granularity){ + return battRealdataIdService.getHalfHourBattDevData(battgroupId,granularity); + } + + @ApiOperation(value = "鍘嗗彶娴嬭瘯璁板綍") + @GetMapping("getBattTinf") + public Response getBattTinf(@RequestParam Integer battgroupId){ + return tinfService.getBattTinf(battgroupId); + } + + @ApiOperation(value = "鍘嗗彶娴嬭瘯璁板綍鍏蜂綋鏌愪竴娆℃斁鐢垫暟鎹鎯�") + @GetMapping("getTinfDataWithTestRecordCount") + public Response getTinfDataWithTestRecordCount(@RequestParam Integer battgroupId,@RequestParam Integer testRecordCount + ,@RequestParam Integer recordNum,@RequestParam Integer granularity){ + return tdataIdService.getTinfDataWithTestRecordCount(battgroupId,testRecordCount,recordNum,granularity); + } + + @ApiOperation(value = "鍘嗗彶瀹炴椂鏌ヨ") + @GetMapping("getBattRealDataHis") + public Response getBattRealDataHis(@RequestParam Integer battgroupId,@RequestParam Integer granularity + ,@RequestParam String startTime,@RequestParam String endTime) throws ParseException, InterruptedException { + return battRealdataIdService.getBattRealDataHis(battgroupId,granularity,startTime,endTime); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/StationInfController.java b/src/main/java/com/whyc/controller/StationInfController.java index 1e15652..001370e 100644 --- a/src/main/java/com/whyc/controller/StationInfController.java +++ b/src/main/java/com/whyc/controller/StationInfController.java @@ -1,6 +1,8 @@ package com.whyc.controller; import com.whyc.dto.Response; +import com.whyc.dto.Statistic.StationStic; +import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_user.User; import com.whyc.service.StationInfService; import com.whyc.util.ActionUtil; @@ -23,4 +25,5 @@ return service.getLeftStation(uinf.getId()); } + } \ No newline at end of file diff --git a/src/main/java/com/whyc/controller/StatisticController.java b/src/main/java/com/whyc/controller/StatisticController.java new file mode 100644 index 0000000..a071479 --- /dev/null +++ b/src/main/java/com/whyc/controller/StatisticController.java @@ -0,0 +1,148 @@ +package com.whyc.controller; + +import com.whyc.dto.Response; +import com.whyc.dto.Statistic.*; +import com.whyc.pojo.db_user.User; +import com.whyc.service.*; +import com.whyc.util.ActionUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@RestController +@Api(tags = "缁熻绠$悊") +@RequestMapping("statistic") +public class StatisticController { + @Autowired + private StationInfService stationInfService; + + @Autowired + private BatttestdataInfService battTinfService; + + @Autowired + private BattInfService battService; + + @Autowired + private PowerInfService powerInfService; + + @Autowired + private DeviceStateService deviceStateService; + + @ApiOperation(value = "鐢垫簮淇℃伅缁熻(1.2.1/1.2.13)") + @PostMapping("getPowerStatistic") + public Response getPowerStatistic(@RequestBody StationStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return powerInfService.getPowerStatistic(stic); + } + + @ApiOperation(value = "璁惧淇℃伅缁熻(1.2.2)") + @PostMapping("getDevStatistic") + public Response getDevStatistic(@RequestBody StationStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battService.getDevStatistic(stic); + } + + @ApiOperation(value = "钃勭數姹犵粍淇℃伅缁熻(1.2.3/1.2.12)") + @PostMapping("getBattStatistic") + public Response getBattStatistic(@RequestBody StationStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battService.getBattStatistic(stic); + } + + @ApiOperation(value = "鍗曡妭鏁伴噺缁熻(1.2.4)") + @PostMapping("getMonStatistic") + public Response getMonStatistic(@RequestBody MonStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + Map<String,Object> map= battTinfService.getMonStatistic(stic); + return new Response().setII(1,true,map,"鍗曡妭鏁伴噺缁熻"); + } + + @ApiOperation(value = "鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5)") + @PostMapping("getDischr5Statistic") + public Response getDischr5Statistic(@RequestBody DisChargeStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getDischr5Statistic(stic); + } + + @ApiOperation(value = "鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6)") + @PostMapping("getDischr6Statistic") + public Response getDischr6Statistic(@RequestBody DisChargeStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + if(stic.getTypeList()==null||stic.getTypeList().size()==0){ + stic.setStopReasonType(0); + }else{ + stic.setStopReasonType(1); + } + return battTinfService.getDischr6Statistic(stic); + } + + @ApiOperation(value = "鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)") + @PostMapping("getPerformanceStatistic") + public Response getPerformanceStatistic(@RequestBody PerformanceStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getPerformanceStatistic(stic); + } + + + @ApiOperation(value = "绔欑偣淇℃伅缁熻(1.2.11)") + @PostMapping("getStationStatistic") + public Response getStationStatistic(@RequestBody StationStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return stationInfService.getStationStatistic(stic); + } + + @ApiOperation(value = "钃勭數姹犳牳瀹逛俊鎭粺璁�(1.2.14)") + @PostMapping("getBattTinfStatistic") + public Response getBattTinfStatistic(@RequestBody BattTinfStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getBattTinfStatistic(stic); + } + @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�(1.2.15)") + @PostMapping("getBattCompare15Statistic") + public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getBattCompare15Statistic(stic); + } + + @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堜笉鍚屽搧鐗屽悓涓�鏃堕棿锛�(1.2.16)") + @PostMapping("getBattCompare16Statistic") + public Response getBattCompare16Statistic(@RequestBody BattCompareStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getBattCompare16Statistic(stic); + } + + @ApiOperation(value = "钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝涓嶅悓鏃堕棿锛�(1.2.17)") + @PostMapping("getBattCompare17Statistic") + public Response getBattCompare17Statistic(@RequestBody BattCompareStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return battTinfService.getBattCompare17Statistic(stic); + } + + @ApiOperation(value = "璁惧宸ヤ綔鐘舵�佺粺璁�(1.2.21)") + @PostMapping("getDeviceStateStatistic") + public Response getDeviceStateStatistic(@RequestBody DeviceStateStic stic){ + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + return deviceStateService.getDeviceStateStatistic(stic); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/AlmHis/BattAlarmRes.java b/src/main/java/com/whyc/dto/AlmHis/BattAlarmRes.java new file mode 100644 index 0000000..52fa40a --- /dev/null +++ b/src/main/java/com/whyc/dto/AlmHis/BattAlarmRes.java @@ -0,0 +1,25 @@ +package com.whyc.dto.AlmHis; + +import com.whyc.pojo.db_alarm.BattalarmDataHistory; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class BattAlarmRes implements Serializable { + private int battgroupId;//鐢垫睜缁刬d + private String stationName;//鏈烘埧鍚嶇О + private String provice;//鏈烘埧鍚嶇О + private String city;//鏈烘埧鍚嶇О + private String country;//鏈烘埧鍚嶇О + private String stationId;//鏈烘埧id + private String battGroupName;//鐢垫睜缁勫悕绉� + private List<BattalarmDataHistory> adataHs;//鍘嗗彶鍛婅淇℃伅 +} diff --git a/src/main/java/com/whyc/dto/AlmHis/BattAlmPar.java b/src/main/java/com/whyc/dto/AlmHis/BattAlmPar.java new file mode 100644 index 0000000..99e812d --- /dev/null +++ b/src/main/java/com/whyc/dto/AlmHis/BattAlmPar.java @@ -0,0 +1,28 @@ +package com.whyc.dto.AlmHis; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; +@Data +public class BattAlmPar { + private String provice; + private String city; + private String country; + private String stationName; + private List<Integer> almIds; + private Integer almLevel; + private Integer pageNum; + private Integer pageSize; + private Integer uid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almEndTime;//缁撴潫鏃堕棿 + + private String recordYear; + private Integer limitStart; + private Integer limitEnd; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/AlmHis/DevAlmPar.java b/src/main/java/com/whyc/dto/AlmHis/DevAlmPar.java new file mode 100644 index 0000000..0ca9529 --- /dev/null +++ b/src/main/java/com/whyc/dto/AlmHis/DevAlmPar.java @@ -0,0 +1,29 @@ +package com.whyc.dto.AlmHis; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class DevAlmPar { + private String provice; + private String city; + private String country; + private String stationName; + private List<Integer> almIds; + private Integer almLevel; + private Integer pageNum; + private Integer pageSize; + private Integer uid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almEndTime;//缁撴潫鏃堕棿 + + private String recordYear; + private Integer limitStart; + private Integer limitEnd; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/AlmHis/PwrAlmPar.java b/src/main/java/com/whyc/dto/AlmHis/PwrAlmPar.java new file mode 100644 index 0000000..a27ffbc --- /dev/null +++ b/src/main/java/com/whyc/dto/AlmHis/PwrAlmPar.java @@ -0,0 +1,28 @@ +package com.whyc.dto.AlmHis; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; +@Data +public class PwrAlmPar { + private String provice; + private String city; + private String country; + private String stationName; + private List<Integer> almIds; + private Integer almLevel; + private Integer pageNum; + private Integer pageSize; + private Integer uid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almEndTime;//缁撴潫鏃堕棿 + + private String recordYear; + private Integer limitStart; + private Integer limitEnd; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/CmdDto/DevCmd.java b/src/main/java/com/whyc/dto/CmdDto/DevCmd.java new file mode 100644 index 0000000..e675833 --- /dev/null +++ b/src/main/java/com/whyc/dto/CmdDto/DevCmd.java @@ -0,0 +1,31 @@ +package com.whyc.dto.CmdDto; + +public class DevCmd { + + final public static int CMD_Start=81; + final public static int CMD_Stop=83; + final public static int CMD_StartAck=82; + final public static int CMD_StopAck=84; + final public static int CMD_SetDischargeParm=40; //璁剧疆鍙傛暟 + final public static int CMD_GetDischargeParm=41; //璇诲彇鍙傛暟 + final public static int CMD_SetDischargeParmAck=39; + final public static int CMD_GetDischargeParmAck=48; + + final public static int CMD_StartResDischarge = 0x32; //鍚姩鍐呴樆娴嬭瘯 + final public static int CMD_StopResDischarge = 0x33; //鍋滄鍐呴樆娴嬭瘯 + + public static final int CMD_StartDischarge = 0x25; //鍚姩鏀剧數37 + public static final int CMD_StartDischargeAck = 0x26; //鍚姩鏀剧數鎴愬姛38 + public static final int CMD_StopDischarge = 0x23; //鍋滄鏀剧數35 + public static final int CMD_StopDischargeAck = 0x24; //鍋滄鏀剧數鎴愬姛36 + + public static final int CMD_ResetSystemAck = 0x0F;//15 + public static final int CMD_ResetSystem = 0x10;//閲嶅惎16 + + + //鏍稿6185涓撳睘鍛婅閰嶇疆 + public static final int CMD_ReadAlarmParam = 0xC5; //璇诲彇鍛婅197 + public static final int CMD_ReadAlarmParam_ACK = 0xC6; //璇诲彇鍛婅鎴愬姛198 + public static final int CMD_WriteAlarmParam = 0xC7; //璁剧疆鍛婅199 + public static final int CMD_WriteAlarmParam_ACK = 0xC8; //璁剧疆鍛婅鎴愬姛200 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/InfoDto.java b/src/main/java/com/whyc/dto/InfoDto.java index feab3ae..d436502 100644 --- a/src/main/java/com/whyc/dto/InfoDto.java +++ b/src/main/java/com/whyc/dto/InfoDto.java @@ -63,6 +63,12 @@ @ApiModelProperty(value = "鐢垫簮绫诲瀷:1:鐩存祦锛�2锛氶�氳锛�3閰嶇綉") private Integer powerType; + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date powerInuseTime; + + @ApiModelProperty(value = "鏁存祦鍣ㄤ娇鑳絒bit0-妯″潡1 bit15-妯″潡16]銆�1-鍙敤 0-涓嶅彲浠ャ��") + private Long modelCfg; + @ApiModelProperty(value = "璁惧id") @@ -108,10 +114,10 @@ @ApiModelProperty(value = "鍨嬪彿") private String battModel; - @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") private Date createTime; - + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date inuseTime; @ApiModelProperty(value = "鏍囪瘑鏄惁鍔犲叆鐢垫睜缁�1:娣诲姞锛�0涓嶆坊鍔�") private Integer addBinfFlag; diff --git a/src/main/java/com/whyc/dto/Real/AlmDto.java b/src/main/java/com/whyc/dto/Real/AlmDto.java new file mode 100644 index 0000000..d764ca4 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/AlmDto.java @@ -0,0 +1,28 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class AlmDto { + private String provice; + private String city; + private String country; + private String stationName; + private String powerName; + private String battgroupName; + private List<Integer> almIds; + private Integer almLevel; + private Integer pageNum; + private Integer pageSize; + private Integer uid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date almEndTime;//缁撴潫鏃堕棿 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/BattHisRealDto.java b/src/main/java/com/whyc/dto/Real/BattHisRealDto.java new file mode 100644 index 0000000..e59607f --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/BattHisRealDto.java @@ -0,0 +1,29 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class BattHisRealDto { + @ApiModelProperty(value = "璁板綍鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + private Date recordTime; + + @ApiModelProperty(value = "缁勭鐢靛帇") + private Float groupVol; + + @ApiModelProperty(value = "鍦ㄧ嚎鐢靛帇") + private Float onlineVol; + + @ApiModelProperty(value = "鐢垫睜鐢垫祦") + private Float groupCurr; + + @ApiModelProperty(value = "璁惧娓╁害") + private Float groupTmp; + + @ApiModelProperty(value = "璐熻浇鐢垫祦") + private Float loadCurr; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/CompareDto.java b/src/main/java/com/whyc/dto/Real/CompareDto.java new file mode 100644 index 0000000..0c0f9a8 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/CompareDto.java @@ -0,0 +1,10 @@ +package com.whyc.dto.Real; + +import lombok.Data; + +@Data +public class CompareDto { + private Float maxData; + private Float minData; + private Float avgData; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/PwrHisRealAcInDto.java b/src/main/java/com/whyc/dto/Real/PwrHisRealAcInDto.java new file mode 100644 index 0000000..9dd0802 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/PwrHisRealAcInDto.java @@ -0,0 +1,52 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class PwrHisRealAcInDto { + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + private Date recordDatetime; + + @ApiModelProperty(value = "1璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin1Vola; + + @ApiModelProperty(value = "1璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin1Volb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數鍘�") + private Float acin1Volc; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Vola; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Volb; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Volc; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Curra; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Currb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Currc; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Curra; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Currb; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Currc; + + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/PwrHisRealDcoutInDto.java b/src/main/java/com/whyc/dto/Real/PwrHisRealDcoutInDto.java new file mode 100644 index 0000000..d126033 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/PwrHisRealDcoutInDto.java @@ -0,0 +1,114 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +public class PwrHisRealDcoutInDto { + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + private Date recordDatetime; + + @ApiModelProperty(value = "鏁存祦妯″潡鎬昏緭鍑虹數鍘�") + private Float mOutputvol; + + @ApiModelProperty(value = "妯″潡1杈撳嚭鐢垫祦") + private Float m1Outcurr; + + @ApiModelProperty(value = "妯″潡2杈撳嚭鐢垫祦") + private Float m2Outcurr; + + @ApiModelProperty(value = "妯″潡3杈撳嚭鐢垫祦") + private Float m3Outcurr; + + @ApiModelProperty(value = "妯″潡4杈撳嚭鐢垫祦") + private Float m4Outcurr; + + @ApiModelProperty(value = "妯″潡5杈撳嚭鐢垫祦") + private Float m5Outcurr; + + @ApiModelProperty(value = "妯″潡6杈撳嚭鐢垫祦") + private Float m6Outcurr; + + @ApiModelProperty(value = "妯″潡7杈撳嚭鐢垫祦") + private Float m7Outcurr; + + @ApiModelProperty(value = "妯″潡8杈撳嚭鐢垫祦") + private Float m8Outcurr; + + @ApiModelProperty(value = "妯″潡9杈撳嚭鐢垫祦") + private Float m9Outcurr; + + @ApiModelProperty(value = "妯″潡10杈撳嚭鐢垫祦") + private Float m10Outcurr; + + @ApiModelProperty(value = "妯″潡11杈撳嚭鐢垫祦") + private Float m11Outcurr; + + @ApiModelProperty(value = "妯″潡12杈撳嚭鐢垫祦") + private Float m12Outcurr; + + @ApiModelProperty(value = "妯″潡13杈撳嚭鐢垫祦") + private Float m13Outcurr; + + @ApiModelProperty(value = "妯″潡14杈撳嚭鐢垫祦") + private Float m14Outcurr; + + @ApiModelProperty(value = "妯″潡15杈撳嚭鐢垫祦") + private Float m15Outcurr; + + @ApiModelProperty(value = "妯″潡16杈撳嚭鐢垫祦") + private Float m16Outcurr; + + @ApiModelProperty(value = "妯″潡1杈撳嚭鐢靛帇") + private Float m1OutVol; + + @ApiModelProperty(value = "妯″潡2杈撳嚭鐢靛帇") + private Float m2OutVol; + + @ApiModelProperty(value = "妯″潡3杈撳嚭鐢靛帇") + private Float m3OutVol; + + @ApiModelProperty(value = "妯″潡4杈撳嚭鐢靛帇") + private Float m4OutVol; + + @ApiModelProperty(value = "妯″潡5杈撳嚭鐢靛帇") + private Float m5OutVol; + + @ApiModelProperty(value = "妯″潡6杈撳嚭鐢靛帇") + private Float m6OutVol; + + @ApiModelProperty(value = "妯″潡7杈撳嚭鐢靛帇") + private Float m7OutVol; + + @ApiModelProperty(value = "妯″潡8杈撳嚭鐢靛帇") + private Float m8OutVol; + + @ApiModelProperty(value = "妯″潡9杈撳嚭鐢靛帇") + private Float m9OutVol; + + @ApiModelProperty(value = "妯″潡10杈撳嚭鐢靛帇") + private Float m10OutVol; + + @ApiModelProperty(value = "妯″潡11杈撳嚭鐢靛帇") + private Float m11OutVol; + + @ApiModelProperty(value = "妯″潡12杈撳嚭鐢靛帇") + private Float m12OutVol; + + @ApiModelProperty(value = "妯″潡13杈撳嚭鐢靛帇") + private Float m13OutVol; + + @ApiModelProperty(value = "妯″潡14杈撳嚭鐢靛帇") + private Float m14OutVol; + + @ApiModelProperty(value = "妯″潡15杈撳嚭鐢靛帇") + private Float m15OutVol; + + @ApiModelProperty(value = "妯″潡16杈撳嚭鐢靛帇") + private Float m16OutVol; + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/QuarterDto.java b/src/main/java/com/whyc/dto/Real/QuarterDto.java new file mode 100644 index 0000000..69a23c7 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/QuarterDto.java @@ -0,0 +1,15 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.sql.Timestamp; +import java.util.Date; + +@Data +public class QuarterDto { + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private Date recordTime; + private Integer monNum; + private Float numValue; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/RealDateDTO.java b/src/main/java/com/whyc/dto/Real/RealDateDTO.java new file mode 100644 index 0000000..d97ba68 --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/RealDateDTO.java @@ -0,0 +1,32 @@ +package com.whyc.dto.Real; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RealDateDTO { + @ApiModelProperty(value = "璁板綍鏃堕棿") + private Date recordTime; + @ApiModelProperty(value = "缁勭鐢靛帇") + private Float groupVol; + @ApiModelProperty(value = "鍦ㄧ嚎鐢靛帇") + private Float onlineVol; + @ApiModelProperty(value = "缁勭鐢垫祦") + private Float groupCurr; + @ApiModelProperty(value = "鍗曚綋鐢靛帇") + private Float monVol; + @ApiModelProperty(value = "鍗曚綋娓╁害") + private Float monTmp; + @ApiModelProperty(value = "鍗曚綋鍐呴樆") + private Float monRes; + @ApiModelProperty(value = "鍗曚綋缂栧彿") + private Integer monNum; + @ApiModelProperty(value = "鍗曚綋缂栧彿") + private Integer recordNum; +} diff --git a/src/main/java/com/whyc/dto/Real/SticRealRtdataDto.java b/src/main/java/com/whyc/dto/Real/SticRealRtdataDto.java new file mode 100644 index 0000000..352bbca --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/SticRealRtdataDto.java @@ -0,0 +1,45 @@ +package com.whyc.dto.Real; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class SticRealRtdataDto { + private Float maxCap; + private Float minCap; + private List<Integer> maxCapNumList; + private List<Integer> minCapNumList; + private Float maxVol; + private Float minVol; + private List<Integer> maxVolNumList; + private List<Integer> minVolNumList; + private Float maxTmp; + private Float minTmp; + private List<Integer> maxTmpNumList; + private List<Integer> minTmpNumList; + private Float maxRes; + private Float minRes; + private List<Integer> maxResNumList; + private List<Integer> minResNumList; + + public SticRealRtdataDto() { + maxCap = 0.0f; + minCap = 0.0f; + maxVol = 0.0f; + minVol = 0.0f; + maxTmp = 0.0f; + minTmp = 0.0f; + maxRes = 0.0f; + minRes = 0.0f; + maxCapNumList = new ArrayList<>(); + minCapNumList = new ArrayList<>(); + maxVolNumList = new ArrayList<>(); + minVolNumList = new ArrayList<>(); + maxTmpNumList = new ArrayList<>(); + minTmpNumList = new ArrayList<>(); + maxResNumList = new ArrayList<>(); + minResNumList = new ArrayList<>(); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/TestDataDto.java b/src/main/java/com/whyc/dto/Real/TestDataDto.java new file mode 100644 index 0000000..3de8a4c --- /dev/null +++ b/src/main/java/com/whyc/dto/Real/TestDataDto.java @@ -0,0 +1,25 @@ +package com.whyc.dto.Real; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class TestDataDto { + private Float onlineVol; //绗竴绗旀斁鐢佃褰曠殑鍦ㄧ嚎鐢靛帇 + private Float groupCurr; //绗竴绗旀斁鐢佃褰曠殑鐢垫睜鐢垫睜 + private Integer testTimeLong; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date testStarttime; + private Float testCap; + private Float realCap; + private Float restTime; + private Float monCount; + private Float moncapstd; + private Float monvolstd; + private Integer battgroupId; + private Integer recordNum; + private Integer testRecordCount; + private Float floatchartVol; //娴厖鐢靛帇 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Real/TopDto.java b/src/main/java/com/whyc/dto/Real/TopDto.java index e6a0b0d..5ac8f55 100644 --- a/src/main/java/com/whyc/dto/Real/TopDto.java +++ b/src/main/java/com/whyc/dto/Real/TopDto.java @@ -4,7 +4,68 @@ @Data public class TopDto { - private Integer systemState; - private Integer devState; - private Integer battState; + private Integer systemState; //绯荤粺鐘舵�� + private String systemStateName; + private Integer devState; //璁惧鐘舵�� + private String devStateName; + private Integer battState; //鐢垫睜鐘舵�� + private String battStateName; + private Integer pwrState; //鐢垫簮鐘舵�� + private String pwrStateName; + private Float vbusVol; //姣嶇嚎鐢靛帇 + private Float onlineVol; //鍦ㄧ嚎鐢靛帇 + private Integer battALmNum;//鐢垫睜缁勫疄鏃跺憡璀︽暟 + private Integer devALmNum; //璁惧瀹炴椂鍛婅鏁� + private Integer pwrALmNum; //鐢垫簮瀹炴椂鍛婅鏁� + private Integer allALmNum; //鎬诲疄鏃跺憡璀︽暟 + //浠呭湪璁惧鐘舵�佷负鏍稿娴嬭瘯鏈夋晥 + private Float captestGroupvol; //缁勭鐢靛帇 + private Float captestCurr; //鐢垫睜鐢垫祦 + private Integer captestTimelong; //娴嬭瘯鏃堕暱 + private Float captestCap; //娴嬭瘯瀹归噺 + private Float restCap; //棰勪及鍓╀綑瀹归噺 + private Float restTime; //棰勪及鍓╀綑缁埅鏃堕棿 + private String recordtime; //鏇存柊鏃堕棿 + private String stationName; + private String provice; + private String city; + private String county; + private String fullName; + private String powerName; + private String devName; + private String battGroupName; + + + public TopDto() { + this.systemState = 0; + this.systemStateName = ""; + this.devState = 0; + this.devStateName = ""; + this.battState = 0; + this.battStateName = ""; + this.pwrState = 0; + this.pwrStateName=""; + this.vbusVol = 0.0f; + this.onlineVol = 0.0f; + this.battALmNum = 0; + this.devALmNum = 0; + this.pwrALmNum = 0; + this.allALmNum = 0; + this.captestGroupvol = 0.0f; + this.captestCurr = 0.0f; + this.captestTimelong = 0; + this.captestCap = 0.0f; + this.restCap = 0.0f; + this.restTime = 0.0f; + this.allALmNum = 0; + this.recordtime = "1972-01-01 00:00:00"; + this.stationName = ""; + this.provice = ""; + this.city = ""; + this.county = ""; + this.fullName = ""; + this.powerName = ""; + this.devName = ""; + this.battGroupName = ""; + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/BanZu.java b/src/main/java/com/whyc/dto/Statistic/BanZu.java new file mode 100644 index 0000000..7965a0a --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/BanZu.java @@ -0,0 +1,11 @@ +package com.whyc.dto.Statistic; + +import lombok.Data; + +@Data +public class BanZu { + private Integer baojiGroupId; + private String baojiGroupName; + private Integer dischargeNum; + private Integer nochargeNum; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/BattCompareStic.java b/src/main/java/com/whyc/dto/Statistic/BattCompareStic.java new file mode 100644 index 0000000..34814c2 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/BattCompareStic.java @@ -0,0 +1,29 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class BattCompareStic { + private String provice; + private String city; + private String country; + private String stationName; + private Integer uid; + private Integer pageNum; + private Integer pageSize; + private Integer performance;//鐢垫睜鎬ц兘锛�1浼樼锛�2鍔e寲锛�3鎹熷潖 4鏈斁鐢� 涓嶄紶鍏ㄩ儴 + private String product; + private Float moncapstd;//鏍囩О瀹归噺 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testEndTime;//缁撴潫鏃堕棿 + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inuseStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date inuseEndTime;//缁撴潫鏃堕棿 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/BattTinfStic.java b/src/main/java/com/whyc/dto/Statistic/BattTinfStic.java new file mode 100644 index 0000000..30a70aa --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/BattTinfStic.java @@ -0,0 +1,22 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class BattTinfStic { + private String provice; + private String city; + private String country; + private String stationName; + private Integer uid; + private Integer pageNum; + private Integer pageSize; + private Integer testType; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testEndTime;//缁撴潫鏃堕棿 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java b/src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java new file mode 100644 index 0000000..8a7eadb --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/DeviceStateStic.java @@ -0,0 +1,15 @@ +package com.whyc.dto.Statistic; + +import lombok.Data; + +@Data +public class DeviceStateStic { + private String provice; + private String city; + private String country; + private String stationName; + private Integer uid; + private Integer pageNum; + private Integer pageSize; + private Integer devWorkstate; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/DisChargeStic.java b/src/main/java/com/whyc/dto/Statistic/DisChargeStic.java new file mode 100644 index 0000000..ae9496e --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/DisChargeStic.java @@ -0,0 +1,25 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class DisChargeStic { + private String provice; + private String city; + private String country; + private String stationName; + private Integer disChargeType; //1.宸叉斁鐢� 2.鏈斁鐢� 涓嶄紶鍏ㄩ儴 + private Integer uid; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testEndTime;//缁撴潫鏃堕棿 + private Integer pageNum; + private Integer pageSize; + private List<Integer> typeList; //鍋滄鍘熷洜闆嗗悎 + private Integer stopReasonType; //0鍏ㄩ儴锛�1绗﹀悎绛涢�夋潯浠剁殑鏀剧數璁板綍 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/MonStic.java b/src/main/java/com/whyc/dto/Statistic/MonStic.java new file mode 100644 index 0000000..30343f6 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/MonStic.java @@ -0,0 +1,25 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class MonStic { + private String product; + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date startTime; + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date endTime; + private Float moncapstd; + private Float monvolstd; + private Integer uid; + private String topPic; //澶撮儴鏌辩姸鍥� + private String goodVolPic ; //浼樼鐢靛帇鍥� + private String goodResPic ; //浼樼鍐呴樆 + private String badVolPic ; //鍔e寲鐢靛帇鍥� + private String badResPic ; //鍔e寲鍐呴樆 + private String damageVolPic ; //鎹熷潖鐢靛帇鍥� + private String damageResPic ; //鎹熷潖鍐呴樆 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/PerformanceRes.java b/src/main/java/com/whyc/dto/Statistic/PerformanceRes.java new file mode 100644 index 0000000..4c931cb --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/PerformanceRes.java @@ -0,0 +1,19 @@ +package com.whyc.dto.Statistic; + +import lombok.Data; + +@Data +public class PerformanceRes { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private Float monvolstd; + private Float moncapstd; + private Float moncount; + private String product; + private Integer inuseYear; + private Float realCap; //瀹為檯瀹归噺 + private String capperformance; //鎬ц兘 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/PerformanceStic.java b/src/main/java/com/whyc/dto/Statistic/PerformanceStic.java new file mode 100644 index 0000000..f2908db --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/PerformanceStic.java @@ -0,0 +1,22 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class PerformanceStic { + private String provice; + private String city; + private String country; + private String stationName; + private Integer performance;//鐢垫睜鎬ц兘锛�1浼樼锛�2鍔e寲锛�3鎹熷潖 4鏈斁鐢� 涓嶄紶鍏ㄩ儴 + private Integer uid; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testStartTime;//寮�濮嬫椂闂� + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testEndTime;//缁撴潫鏃堕棿 + private Integer pageNum; + private Integer pageSize; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/StationStic.java b/src/main/java/com/whyc/dto/Statistic/StationStic.java new file mode 100644 index 0000000..e9998de --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/StationStic.java @@ -0,0 +1,18 @@ +package com.whyc.dto.Statistic; + +import lombok.Data; + +@Data +public class StationStic { + private String provice; + private String city; + private String country; + private String stationName; + private String product; + private Float monvolstd; + private Integer uid; + private String stationType; + private Integer pageNum; + private Integer pageSize; + private String company; //鐢垫簮鍘傚鍝佺墝 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java b/src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java new file mode 100644 index 0000000..7a5ccd6 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticCompare15Res.java @@ -0,0 +1,30 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class SticCompare15Res { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private String devName; + private String product; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date inuseTime; + private Float monvolstd; + private List<Integer> monNums; //鎹熷潖鍗曚綋缂栧彿 + private Float realCap; //瀹為檯瀹归噺 + private String precentCap; //瀹归噺鐧惧垎姣� + private String capperformance; //鎬ц兘 + private Integer stationId; + private Integer powerId; + private Integer devId; + private Integer battgroupId; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java b/src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java new file mode 100644 index 0000000..5ec1f6f --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticCompare16Res.java @@ -0,0 +1,30 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class SticCompare16Res { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private String devName; + private String product; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date inuseTime; + private Float monvolstd; + private Float moncapstd; + private String stopReason; + private Float score; //璇勫垎 + private Float realCap; //瀹為檯瀹归噺 + private String precentCap; //瀹归噺鐧惧垎姣� + private String capperformance; //鎬ц兘 + private Integer stationId; + private Integer powerId; + private Integer devId; + private Integer battgroupId; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java b/src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java new file mode 100644 index 0000000..8ef4c2f --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticCompare17Res.java @@ -0,0 +1,28 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class SticCompare17Res { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private String devName; + private String product; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date inuseTime; + private Float monvolstd; + private Integer monNum;//鍗曚綋缂栧彿 + private Float monrealCap; //鍗曚綋瀹為檯瀹归噺 + private String monprecentCap; //鍗曚綋瀹归噺鐧惧垎姣� + private String moncapperformance; //鍗曚綋鎬ц兘 + private Integer stationId; + private Integer powerId; + private Integer devId; + private Integer battgroupId; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticDischarge5Res.java b/src/main/java/com/whyc/dto/Statistic/SticDischarge5Res.java new file mode 100644 index 0000000..5321168 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticDischarge5Res.java @@ -0,0 +1,23 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class SticDischarge5Res { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date testStartTime; + private Float realCap; //瀹為檯瀹归噺 + private Integer testTimelong; //娴嬭瘯鏃堕暱 + private Float testCap; //娴嬭瘯瀹归噺 + private String stopReason; //鍋滄鍘熷洜 + private String capperformance; //鐢垫睜鎬ц兘 + private Integer disChargeType; //1.宸叉斁鐢� 2.鏈斁鐢� 涓嶄紶鍏ㄩ儴 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticDischarge6Res.java b/src/main/java/com/whyc/dto/Statistic/SticDischarge6Res.java new file mode 100644 index 0000000..686b037 --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticDischarge6Res.java @@ -0,0 +1,25 @@ +package com.whyc.dto.Statistic; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.whyc.pojo.db_batt_testdata.BatttestdataInf; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class SticDischarge6Res { + private String provice; + private String city; + private String country; + private String stationName; + private String battgroupName; + private Float monvolstd; + private Float moncapstd; + private Float moncount; + private String product; + private Integer errorNum; + private List<String> stopList; + private BatttestdataInf tinf; + private Integer stopReasonType; //0鍏ㄩ儴锛�1绗﹀悎绛涢�夋潯浠剁殑鏀剧數璁板綍 +} \ No newline at end of file diff --git a/src/main/java/com/whyc/dto/Statistic/SticMonRes.java b/src/main/java/com/whyc/dto/Statistic/SticMonRes.java new file mode 100644 index 0000000..006d76d --- /dev/null +++ b/src/main/java/com/whyc/dto/Statistic/SticMonRes.java @@ -0,0 +1,14 @@ +package com.whyc.dto.Statistic; + +import lombok.Data; + +@Data +public class SticMonRes { + private Integer battgroupId; + private String stationName; + private String devName; + private String battgroupName; + private Integer monNum; + private Float monVol; + private Float monRes; +} \ No newline at end of file diff --git a/src/main/java/com/whyc/factory/BattCapFactory.java b/src/main/java/com/whyc/factory/BattCapFactory.java new file mode 100644 index 0000000..b07d90c --- /dev/null +++ b/src/main/java/com/whyc/factory/BattCapFactory.java @@ -0,0 +1,172 @@ +package com.whyc.factory; + +public class BattCapFactory { + public static int CapType_Rest = 0; //褰撴煡璇㈠墿浣欏閲忔椂浼犻�� + public static int CapType_Real = 1; //褰撴煡璇㈠疄闄呭閲忔椂浼犻�� + + public static int CapType_type=2; //瀹归噺 + public static int CapType_name=1; //娆′綆 + public static int CapType_method=0; //鏍囩О + // 鑾峰彇鏍囩函鐢垫祦 + public static double GetFDCurrent(double stdcap, int hourrate) + { + double res = 0.055; + switch(hourrate) + { + case 1: res = 0.514; break; + case 2: res = 0.306; break; + case 3: res = 0.250; break; + case 4: res = 0.200; break; + case 5: res = 0.166; break; + case 6: res = 0.146; break; + case 7: res = 0.131; break; + case 8: res = 0.118; break; + case 9: res = 0.108; break; + case 10: res = 0.100; break; + case 20: res = 0.055; break; + default: res = 0.055; break; + } + + return (stdcap * res); + } + //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ + // 鑾峰彇鏀剧數灏忔椂鐜� stdah锛氭爣绾閲� current:褰撳墠鐢垫祦 + public static int GetHourRate(double stdah, double current) + { + int index = 0; + double value[]={5.14, 3.06, 2.50, 2.00, 1.66, 1.46, 1.31, 1.18, 1.08, 1.00, 0.55, 0.40}; + double res; + current = Math.abs(current); + res = current/(stdah/10); + if(res >= 5.14) return 1; + else if(res <= 0.55) return 20; + else + { + for(index=0; index<10; index++) + { + if((res<=value[index]) && (res>value[index+1])) + break; + else continue; + } + if((value[index]-res) < (res-value[index+1])) + { + return (index+1); + } + else + { + if(index+2 > 10) return (20); + else return (index+2); + } + } + } + //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ + public static double N_TO_10H(int n_H) + { + switch(n_H) + { + case 1 : return(1/0.55); + case 2 : return(1/0.61); + case 3 : return(1/0.75); + case 4 : return(1/0.79); + case 5 : return(1/0.833); + case 6 : return(1/0.876); + case 7 : return(1/0.917); + case 8 : return(1/0.944); + case 9 : return(1/0.974); + case 10: return(1/1); + case 20: return(1/1.1); + } + return 1.0; + } + //------------------------------------------------------------------------------- + //------------------------------------------------------------------------------- + //鑾峰彇鍓╀綑瀹归噺 STDAH锛氭爣绉板閲� HourRate锛氭斁鐢靛皬鏃剁巼 SumAH锛氭祴璇曞閲� MaxMonomerVol锛氭渶澶х數姹犵數鍘� MonomerVol锛氬綋鍓嶇數姹犵粍鐨勬渶浣庡崟浣撶數鍘� + //MonomerVolType:鐢垫睜鐢靛帇绫诲瀷 鐢垫睜鏍囩О鐢靛帇 2v,6v,12v CapType:瀹归噺绫诲瀷锛堝畾鍊兼槸甯搁噺锛� + + //灏忔椂鐜� 宸叉祴璇曞閲� 鏈�瀹归噺 + public static double GetMonomerCap(double STDAH, int HourRate, double SumAH, double MaxMonomerVol, + + double MonomerVol, double MonomerVolType, int CapType) + { + if((MaxMonomerVol - MonomerVolType*0.9) <= 0) + return 0; + + if(SumAH < 0) + SumAH *= (-1); + + double tmp_cap; + tmp_cap = MonomerVol - MonomerVolType * 0.9; + tmp_cap *= (STDAH - SumAH * N_TO_10H(HourRate)); + double dt_vol = MaxMonomerVol - MonomerVolType*0.9; + if(dt_vol < 0.01) + dt_vol = 0.01; + tmp_cap = tmp_cap/dt_vol; + if(tmp_cap < 0) + tmp_cap = 0; + + if(CapType == CapType_Rest) + return tmp_cap; + else if(CapType == CapType_Real) + return (tmp_cap + SumAH * N_TO_10H(HourRate)); + else + return ((tmp_cap + SumAH * N_TO_10H(HourRate))*100 / STDAH); + } + //---------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------- + //鑾峰彇鍚庡鏃堕棿 + public static int GetRestTimeSecond(double restcap, double curr) + { + double tmp_curr = Math.abs(curr); + if(tmp_curr < 0.1) + tmp_curr = 0.1; + + int rest_time = (int)((restcap / tmp_curr) * 3600); + if(rest_time > (99*3600)) + rest_time = (99*3600); + + return rest_time; + } + /*//鍒ゆ柇閫氳繃瀹為檯瀹归噺鍒ゆ柇鏌愭鏀剧數娴嬭瘯鏄惁鏈夋晥 + *//* + * STDAH:鏍囧瓨瀹归噺 + * param:瀹归噺鏈夋晥鍙傛暟*//* + public static int Judge(double realCap,float param,double STDAH){ + int flag=0; + if(Math.abs(realCap)>(param*STDAH)){ + flag=1; + }else{ + flag=0; + } + return flag; + } + //鍒ゆ柇閫氳繃瀹為檯瀹归噺鍒ゆ柇鏌愭鏀剧數娴嬭瘯鏄惁鏈夋晥 + *//* + * STDAH:鏍囧瓨瀹归噺 + * param:瀹归噺鍛婅鍙傛暟*//* + public static int JudgeAlarm(double realCap,float param,float Cparam,double STDAH){ + int flag=0; + if(realCap>(param*STDAH)){ + flag=1; + }else{ + if(realCap<(Cparam*STDAH)){ + flag=AlarmDaoFactory.Alarm_CapChange; + }else{ + flag=AlarmDaoFactory.Alarm_CapAlarm; + } + + } + return flag; + }*/ + + /** + * 鐢垫睜缁勭殑缁埅鏃堕暱璁$畻,鍗曚綅:鍒嗛挓 + */ + public static float getTheoryTime(float loadCurr, float restcap, float battGroupCapStd){ + double realCurr = 53*loadCurr/45; + double hourRate = N_TO_10H(GetHourRate((int) Math.floor(battGroupCapStd), realCurr)); + float theoryTimeHour = realCurr == 0?0: (float) (restcap / hourRate / realCurr); + return theoryTimeHour*60; + } +} diff --git a/src/main/java/com/whyc/factory/InfoFactory.java b/src/main/java/com/whyc/factory/InfoFactory.java index ad6ea0c..8ba5086 100644 --- a/src/main/java/com/whyc/factory/InfoFactory.java +++ b/src/main/java/com/whyc/factory/InfoFactory.java @@ -13,7 +13,9 @@ .setPowerType(info.getPowerType()) .setPowerModel(info.getPowerModel()) .setProtocol(info.getProtocol()) - .setPowerIp(info.getPowerIp()); + .setPowerIp(info.getPowerIp()) + .setModelCfg(info.getModelCfg()) + .setPowerInuseTime(info.getPowerInuseTime()); if(info.getPowerId()!=null){ pinf.setPowerId(info.getPowerId()); } @@ -85,6 +87,9 @@ if(info.getDevName()!=null){ binf.setDevName(info.getDevName()); } + if(info.getInuseTime()!=null){ + binf.setInuseTime(info.getInuseTime()); + } return binf; } } \ No newline at end of file diff --git a/src/main/java/com/whyc/factory/ThreadPoolExecutorFactory.java b/src/main/java/com/whyc/factory/ThreadPoolExecutorFactory.java index 7645737..57bcd20 100644 --- a/src/main/java/com/whyc/factory/ThreadPoolExecutorFactory.java +++ b/src/main/java/com/whyc/factory/ThreadPoolExecutorFactory.java @@ -11,7 +11,7 @@ private static ThreadPoolExecutor init() { //绾跨▼姹犲垵濮嬪寲,鎷掔粷绛栫暐涓轰涪寮� UserThreadFactory userThreadFactory = new UserThreadFactory("br"); - ThreadPoolExecutor pool = new ThreadPoolExecutor(8, 48, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<>(16), userThreadFactory,new ThreadPoolExecutor.AbortPolicy()); + ThreadPoolExecutor pool = new ThreadPoolExecutor(10, 48, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<>(16), userThreadFactory,new ThreadPoolExecutor.AbortPolicy()); poolExecutor = pool; return pool; } diff --git a/src/main/java/com/whyc/filter/CrossDomainFilter.java b/src/main/java/com/whyc/filter/CrossDomainFilter.java index ada0dd0..f0f0871 100644 --- a/src/main/java/com/whyc/filter/CrossDomainFilter.java +++ b/src/main/java/com/whyc/filter/CrossDomainFilter.java @@ -74,7 +74,7 @@ resp.setHeader("X-XSS-Protection","1; mode=block"); resp.setHeader("X-Download-Options","noopen"); resp.setHeader("Strict-Transport-Security","max-age=63072000; includeSubdomains; preload"); - + resp.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); //鍗曢〉闈㈠簲鐢�,鍙厑璁镐竴涓〉闈ndex.html String servletPath = req.getServletPath(); if(servletPath.contains(".html")){ diff --git a/src/main/java/com/whyc/mapper/AlmparamFromDeviceMapper.java b/src/main/java/com/whyc/mapper/AlmparamFromDeviceMapper.java new file mode 100644 index 0000000..b95c356 --- /dev/null +++ b/src/main/java/com/whyc/mapper/AlmparamFromDeviceMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_ram_db.AlmparamFromDevice; + +public interface AlmparamFromDeviceMapper extends CustomMapper<AlmparamFromDevice>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/AppParamMapper.java b/src/main/java/com/whyc/mapper/AppParamMapper.java new file mode 100644 index 0000000..5b27911 --- /dev/null +++ b/src/main/java/com/whyc/mapper/AppParamMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_param.AppParam; + +public interface AppParamMapper extends CustomMapper<AppParam>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattAlmparamMapper.java b/src/main/java/com/whyc/mapper/BattAlmparamMapper.java new file mode 100644 index 0000000..ebfc057 --- /dev/null +++ b/src/main/java/com/whyc/mapper/BattAlmparamMapper.java @@ -0,0 +1,12 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_param.BattAlmparam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface BattAlmparamMapper extends CustomMapper<BattAlmparam>{ + //鑾峰彇鐢垫睜鍛婅鍙傛暟 + List<BattAlmparam> getBattAlmParam(@Param("almDto") AlmDto almDto); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattInfMapper.java b/src/main/java/com/whyc/mapper/BattInfMapper.java index cb81c69..b214255 100644 --- a/src/main/java/com/whyc/mapper/BattInfMapper.java +++ b/src/main/java/com/whyc/mapper/BattInfMapper.java @@ -2,6 +2,7 @@ import com.whyc.dto.BattDto; import com.whyc.dto.InfoDto; +import com.whyc.dto.Statistic.*; import com.whyc.pojo.db_station.BattInf; import org.apache.ibatis.annotations.Param; @@ -30,4 +31,24 @@ //鑾峰彇鏍囩О鍐呴樆(涓嬫媺) List<Float> getMonResByUid(@Param("uid") Integer uid); + //璁惧淇℃伅缁熻 + List<BattInf> getDevStatistic(@Param("stic") StationStic stic); + //鑾峰彇璁惧涓嬬數姹犵粍涓暟 + Integer getBattCountBydevId(Integer devId); + //钃勭數姹犵粍淇℃伅缁熻 + List<BattInf> getBattStatistic(@Param("stic") StationStic stic); + //鍗曚綋缁熻鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> getMonStatistic(@Param("stic") MonStic stic); + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰 + List<BattInf> getBattCompare15Statistic(@Param("stic") BattCompareStic stic); + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰 + List<BattInf> getBattCompare16Statistic(@Param("stic") BattCompareStic stic); + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰 + List<BattInf> getBattCompare17Statistic(@Param("stic") BattCompareStic stic); + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + List<BattInf> getDischr5Statistic(@Param("stic") DisChargeStic stic); + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.6) + List<BattInf> getDischr6Statistic(@Param("stic") DisChargeStic stic); + //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10) + List<BattInf> getPerformanceStatistic(@Param("stic") PerformanceStic stic); } \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattRtdataMapper.java b/src/main/java/com/whyc/mapper/BattRtdataMapper.java new file mode 100644 index 0000000..aed4cbb --- /dev/null +++ b/src/main/java/com/whyc/mapper/BattRtdataMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_ram_db.BattRtdata; + +public interface BattRtdataMapper extends CustomMapper<BattRtdata>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattRtstateMapper.java b/src/main/java/com/whyc/mapper/BattRtstateMapper.java new file mode 100644 index 0000000..4c8fe8d --- /dev/null +++ b/src/main/java/com/whyc/mapper/BattRtstateMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_ram_db.BattRtstate; + +public interface BattRtstateMapper extends CustomMapper<BattRtstate>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattalarmDataMapper.java b/src/main/java/com/whyc/mapper/BattalarmDataMapper.java new file mode 100644 index 0000000..e5e062c --- /dev/null +++ b/src/main/java/com/whyc/mapper/BattalarmDataMapper.java @@ -0,0 +1,11 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_alarm.BattalarmData; + +import java.util.List; + +public interface BattalarmDataMapper extends CustomMapper<BattalarmData>{ + //鑾峰彇鐢垫睜缁勫疄鏃跺憡璀︿俊鎭� + List<BattalarmData> getBattAlmReal(AlmDto almDto); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BattresdataInfMapper.java b/src/main/java/com/whyc/mapper/BattresdataInfMapper.java new file mode 100644 index 0000000..0e9a199 --- /dev/null +++ b/src/main/java/com/whyc/mapper/BattresdataInfMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_batt_testdata.BattresdataInf; + +public interface BattresdataInfMapper extends CustomMapper<BattresdataInf>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/BatttestdataInfMapper.java b/src/main/java/com/whyc/mapper/BatttestdataInfMapper.java new file mode 100644 index 0000000..bff2b84 --- /dev/null +++ b/src/main/java/com/whyc/mapper/BatttestdataInfMapper.java @@ -0,0 +1,16 @@ +package com.whyc.mapper; + +import com.whyc.dto.Statistic.BattTinfStic; +import com.whyc.pojo.db_batt_testdata.BatttestdataInf; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +public interface BatttestdataInfMapper extends CustomMapper<BatttestdataInf>{ + //钃勭數姹犳牳瀹逛俊鎭粺璁� + List<BatttestdataInf> getBattTinfStatistic(@Param("stic") BattTinfStic stic); + //鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + List<BatttestdataInf> getNoDischargeData(@Param("battgroupId") Integer battgroupId,@Param("testStartTime") Date testStartTime + , @Param("testEndTime") Date testEndTime, @Param("typeList") List<Integer> typeList); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/CommonMapper.java b/src/main/java/com/whyc/mapper/CommonMapper.java index 0ecd11a..9c7724c 100644 --- a/src/main/java/com/whyc/mapper/CommonMapper.java +++ b/src/main/java/com/whyc/mapper/CommonMapper.java @@ -19,7 +19,7 @@ //Object getMaxValue(String schema,String table,String field,String valuePrefix); Object getMaxValue(@Param("schema") String schema,@Param("table") String table,@Param("field") String field); - boolean existTable(String dbName, String tableName); + String existTable(String dbName, String tableName); //void truncate(String dbName, String tableName); diff --git a/src/main/java/com/whyc/mapper/DevAlmparamMapper.java b/src/main/java/com/whyc/mapper/DevAlmparamMapper.java new file mode 100644 index 0000000..ee34e0d --- /dev/null +++ b/src/main/java/com/whyc/mapper/DevAlmparamMapper.java @@ -0,0 +1,10 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_param.BattAlmparam; +import com.whyc.pojo.db_param.DevAlmparam; + +import java.util.List; + +public interface DevAlmparamMapper extends CustomMapper<DevAlmparam>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/DevalarmDataMapper.java b/src/main/java/com/whyc/mapper/DevalarmDataMapper.java new file mode 100644 index 0000000..6a234af --- /dev/null +++ b/src/main/java/com/whyc/mapper/DevalarmDataMapper.java @@ -0,0 +1,12 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_alarm.BattalarmData; +import com.whyc.pojo.db_alarm.DevalarmData; + +import java.util.List; + +public interface DevalarmDataMapper extends CustomMapper<DevalarmData>{ + //鑾峰彇璁惧瀹炴椂鍛婅淇℃伅 + List<DevalarmData> getDevAlmReal(AlmDto almDto); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/DeviceSetparamMapper.java b/src/main/java/com/whyc/mapper/DeviceSetparamMapper.java new file mode 100644 index 0000000..f8308ff --- /dev/null +++ b/src/main/java/com/whyc/mapper/DeviceSetparamMapper.java @@ -0,0 +1,10 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_ram_db.DeviceSetparam; + +public interface DeviceSetparamMapper extends CustomMapper<DeviceSetparam>{ + //璁剧疆鏀剧數鍙傛暟 + Boolean updateParam(DeviceSetparam param); + //璇诲彇鏀剧數鍙傛暟 + DeviceSetparam getParam(int devId, int battGroupNum); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/DeviceStateMapper.java b/src/main/java/com/whyc/mapper/DeviceStateMapper.java new file mode 100644 index 0000000..8270098 --- /dev/null +++ b/src/main/java/com/whyc/mapper/DeviceStateMapper.java @@ -0,0 +1,12 @@ +package com.whyc.mapper; + +import com.whyc.dto.Statistic.DeviceStateStic; +import com.whyc.pojo.db_ram_db.DeviceState; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface DeviceStateMapper extends CustomMapper<DeviceState>{ + //璁惧宸ヤ綔鐘舵�佺粺璁� + List<DeviceState> getDeviceStateStatistic(@Param("stic") DeviceStateStic stic); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PowerInfMapper.java b/src/main/java/com/whyc/mapper/PowerInfMapper.java index 16111b5..d4a31dc 100644 --- a/src/main/java/com/whyc/mapper/PowerInfMapper.java +++ b/src/main/java/com/whyc/mapper/PowerInfMapper.java @@ -1,6 +1,7 @@ package com.whyc.mapper; import com.whyc.dto.PowerDto; +import com.whyc.dto.Statistic.StationStic; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import org.apache.ibatis.annotations.Param; @@ -21,4 +22,8 @@ List<String> getPowerModelByUid(Integer uid); //鑾峰彇鐢垫簮鍗忚(涓嬫媺) List<String> getProtocolByUid(Integer uid); + //鐢垫簮淇℃伅缁熻 + List<PowerInf> getPowerStatistic(@Param("stic") StationStic stic); + //鏌ヨ鏈烘埧鎵�鍦ㄧ殑鐝粍 + String getGroupName(Integer powerId); } \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PwrdevAcdcdataMapper.java b/src/main/java/com/whyc/mapper/PwrdevAcdcdataMapper.java new file mode 100644 index 0000000..567c24d --- /dev/null +++ b/src/main/java/com/whyc/mapper/PwrdevAcdcdataMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_ram_db.PwrdevAcdcdata; + +public interface PwrdevAcdcdataMapper extends CustomMapper<PwrdevAcdcdata>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java b/src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java new file mode 100644 index 0000000..516f0ba --- /dev/null +++ b/src/main/java/com/whyc/mapper/PwrdevAlarmMapper.java @@ -0,0 +1,11 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; + +import java.util.List; + +public interface PwrdevAlarmMapper extends CustomMapper<PwrdevAlarm>{ + //鑾峰彇鐢垫簮瀹炴椂鍛婅淇℃伅 + List<PwrdevAlarm> getPwrAlmReal(AlmDto almDto); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PwrdevAlarmParamMapper.java b/src/main/java/com/whyc/mapper/PwrdevAlarmParamMapper.java new file mode 100644 index 0000000..46b3ced --- /dev/null +++ b/src/main/java/com/whyc/mapper/PwrdevAlarmParamMapper.java @@ -0,0 +1,12 @@ +package com.whyc.mapper; + +import com.whyc.dto.Real.AlmDto; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface PwrdevAlarmParamMapper extends CustomMapper<PwrdevAlarmParam>{ + //鑾峰彇鐢垫簮鍛婅鍙傛暟 + List<PwrdevAlarmParam> getPwrAlmParam(@Param("almDto") AlmDto almDto); +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/PwrdevAlarmParamStandMapper.java b/src/main/java/com/whyc/mapper/PwrdevAlarmParamStandMapper.java new file mode 100644 index 0000000..f3ee525 --- /dev/null +++ b/src/main/java/com/whyc/mapper/PwrdevAlarmParamStandMapper.java @@ -0,0 +1,6 @@ +package com.whyc.mapper; + +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParamStand; + +public interface PwrdevAlarmParamStandMapper extends CustomMapper<PwrdevAlarmParamStand>{ +} \ No newline at end of file diff --git a/src/main/java/com/whyc/mapper/StationInfMapper.java b/src/main/java/com/whyc/mapper/StationInfMapper.java index 5c9b4d1..7d25a57 100644 --- a/src/main/java/com/whyc/mapper/StationInfMapper.java +++ b/src/main/java/com/whyc/mapper/StationInfMapper.java @@ -1,6 +1,7 @@ package com.whyc.mapper; import com.whyc.dto.Station.Provice; +import com.whyc.dto.Statistic.StationStic; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import org.apache.ibatis.annotations.Param; @@ -24,4 +25,6 @@ List<PowerInf> getPowerByUid(@Param("uid") Integer uid, @Param("provice") String provice, @Param("city") String city, @Param("country") String country, @Param("stationName") String stationName); //鑾峰彇鐢靛帇绛夌骇(涓嬫媺) List<String> getStationTypeByUid(@Param("uid") Integer uid); + //绔欑偣淇℃伅缁熻 + List<StationInf> getStationStatistic(@Param("stic") StationStic stic); } \ No newline at end of file diff --git a/src/main/java/com/whyc/pojo/db_alarm/BattalarmData.java b/src/main/java/com/whyc/pojo/db_alarm/BattalarmData.java index 8508e7a..a96c287 100644 --- a/src/main/java/com/whyc/pojo/db_alarm/BattalarmData.java +++ b/src/main/java/com/whyc/pojo/db_alarm/BattalarmData.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -44,6 +45,9 @@ @ApiModelProperty(value = "鍛婅绫诲瀷") private Integer almSignalId; + @TableField(exist = false) + private String almName; + @ApiModelProperty(value = "鍛婅绛夌骇") private Integer almLevel; @@ -77,5 +81,18 @@ @ApiModelProperty(value = "鍛婅閲嶈绛夌骇[0:閲嶈锛�1:绱ф�") private Integer almSeverity; + @TableField(exist = false) + private String battgroupName; + + @TableField(exist = false) + private String stationName; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; } diff --git a/src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java b/src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java index 3e7dd6f..8cde084 100644 --- a/src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java +++ b/src/main/java/com/whyc/pojo/db_alarm/BattalarmDataHistory.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -40,6 +41,9 @@ @ApiModelProperty(value = "鐢垫睜鍛婅ID") private Integer almId; + @TableField(exist = false) + private String almName; + @ApiModelProperty(value = "鍛婅绫诲瀷") private Integer almSignalId; @@ -76,5 +80,15 @@ @ApiModelProperty(value = "鍛婅閲嶈绛夌骇[0:閲嶈锛�1:绱ф�") private Integer almSeverity; + @TableField(exist = false) + private String stationName;//鏈烘埧鍚嶇О + @TableField(exist = false) + private String provice;//鏈烘埧鍚嶇О + @TableField(exist = false) + private String city;//鏈烘埧鍚嶇О + @TableField(exist = false) + private String country;//鏈烘埧鍚嶇О + @TableField(exist = false) + private String battgroupName;//鐢垫睜缁勫悕绉� } diff --git a/src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java b/src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java index 06363d3..3506084 100644 --- a/src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java +++ b/src/main/java/com/whyc/pojo/db_alarm/DevalarmData.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -41,6 +42,9 @@ @ApiModelProperty(value = "鍛婅ID") private Integer almId; + @TableField(exist = false) + private String almName; + @ApiModelProperty(value = "鍛婅绛夌骇") private Integer almLevel; @@ -75,4 +79,19 @@ private Integer almSeverity; + @TableField(exist = false) + private String devName; + + @TableField(exist = false) + private String stationName; + + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; + } diff --git a/src/main/java/com/whyc/pojo/db_alarm/DevalarmDataHistory.java b/src/main/java/com/whyc/pojo/db_alarm/DevalarmDataHistory.java index 703b2f9..a11e48a 100644 --- a/src/main/java/com/whyc/pojo/db_alarm/DevalarmDataHistory.java +++ b/src/main/java/com/whyc/pojo/db_alarm/DevalarmDataHistory.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -40,6 +41,9 @@ @ApiModelProperty(value = "鍛婅ID") private Integer almId; + @TableField(exist = false) + private String almName; + @ApiModelProperty(value = "鍛婅绛夌骇") private Integer almLevel; @@ -73,5 +77,15 @@ @ApiModelProperty(value = "鍛婅閲嶈绛夌骇[0:閲嶈锛�1:绱ф�") private Integer almSeverity; + @TableField(exist = false) + private String stationName; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String devName; } diff --git a/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataId.java b/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataId.java new file mode 100644 index 0000000..5fdbb8d --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataId.java @@ -0,0 +1,72 @@ +package com.whyc.pojo.db_batt_testdata; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 鐢垫睜缁勫唴闃绘祴璇曡鎯呰〃 + * </p> + * + * @author lxw + * @since 2025-05-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="BattresdataId", description="鐢垫睜缁勫唴闃绘祴璇曡鎯呰〃") +public class BattresdataId implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "鑷涓婚敭") + @TableId(value = "num", type = IdType.AUTO) + private Long num; + + @ApiModelProperty(value = "鐢垫睜缁処D") + private Integer battgroupId; + + @ApiModelProperty(value = "娴嬭瘯娆℃暟") + private Integer testRecordCount; + + @ApiModelProperty(value = "娴嬭瘯绫诲瀷") + private Integer testType; + + @ApiModelProperty(value = "鏄惁鏄渶鏂版暟鎹�") + private Integer dataNew; + + @ApiModelProperty(value = "鏁版嵁鏄惁鏈夋晥") + private Integer dataAvailable; + + @ApiModelProperty(value = "娴嬭瘯寮�濮嬫椂闂�") + private Date testStarttime; + + @ApiModelProperty(value = "缁勭鐢靛帇") + private Float groupVol; + + @ApiModelProperty(value = "娴嬭瘯鐢垫祦") + private Float testCurr; + + @ApiModelProperty(value = "鍗曚綋缂栧彿") + private Integer monNum; + + @ApiModelProperty(value = "鍗曚綋鐢靛帇") + private Float monVol; + + @ApiModelProperty(value = "鍗曚綋娓╁害") + private Float monTmp; + + @ApiModelProperty(value = "鍗曚綋鍐呴樆") + private Float monRes; + + +} diff --git a/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataInf.java b/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataInf.java new file mode 100644 index 0000000..87ecf26 --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_batt_testdata/BattresdataInf.java @@ -0,0 +1,67 @@ +package com.whyc.pojo.db_batt_testdata; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 鍐呴樆娴嬭瘯鎬昏〃 + * </p> + * + * @author lxw + * @since 2025-05-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName(schema = "db_batt_testdata",value ="tb_battresdata_inf") +@ApiModel(value="BattresdataInf瀵硅薄", description="鍐呴樆娴嬭瘯鎬昏〃") +public class BattresdataInf implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "鑷涓婚敭") + @TableId(value = "num", type = IdType.AUTO) + private Long num; + + @ApiModelProperty(value = "鐢垫睜缁処D") + private Integer battgroupId; + + @ApiModelProperty(value = "娴嬭瘯娆℃暟") + private Integer testRecordCount; + + @ApiModelProperty(value = "涓嬩竴娆℃祴璇曟鏁�") + private Integer testRecordCountEx; + + @ApiModelProperty(value = "娴嬭瘯绫诲瀷") + private Integer testType; + + @ApiModelProperty(value = "鏄惁鏄渶鏂版暟鎹�") + private Integer dataNew; + + @ApiModelProperty(value = "鏁版嵁鏄惁鏈夋晥") + private Integer dataAvailable; + + @ApiModelProperty(value = "娴嬭瘯寮�濮嬫椂闂�") + private Date testStarttime; + + @ApiModelProperty(value = "璁板綍鏃堕棿") + private Date recordTime; + + @ApiModelProperty(value = "缁勭鐢靛帇") + private Float groupVol; + + @ApiModelProperty(value = "娴嬭瘯鐢垫祦") + private Float testCurr; + + +} diff --git a/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java b/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java index c7935f3..d37a080 100644 --- a/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java +++ b/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java @@ -29,7 +29,7 @@ private static final long serialVersionUID = 1L; @TableId(value = "num", type = IdType.AUTO) - private Long num; + private Integer num; @ApiModelProperty(value = "鐢垫睜缁処D") private Integer battgroupId; diff --git a/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java b/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java index 5d16bc1..a145a63 100644 --- a/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java +++ b/src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataInf.java @@ -1,12 +1,15 @@ package com.whyc.pojo.db_batt_testdata; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; @@ -23,6 +26,8 @@ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) +@AllArgsConstructor +@NoArgsConstructor @TableName(schema = "db_batt_testdata",value ="tb_batttestdata_inf") @ApiModel(value="BatttestdataInf瀵硅薄", description="鐢垫睜缁勫巻鍙叉祴璇曟暟鎹�昏〃") public class BatttestdataInf implements Serializable { @@ -71,6 +76,10 @@ @ApiModelProperty(value = "娴嬭瘯鍋滄鍘熷洜") private Integer testStoptype; + @ApiModelProperty(value = "娴嬭瘯鍋滄鍘熷洜") + @TableField(exist = false) + private String testStoptypeReason; + @ApiModelProperty(value = "鍦ㄧ嚎鐢靛帇") private Float onlineVol; @@ -104,5 +113,40 @@ @ApiModelProperty(value = "灞辫タ61850鐩戞祴鏀剧數鏁版嵁鏍囪瘑銆�0锛氱洃娴嬫斁鐢碉紱1鍋滅數鏀剧數銆�") private Integer testDatatype; + @TableField(exist = false) + private String stationName; + + @TableField(exist = false) + private Integer stationId; + + @TableField(exist = false) + private Integer powerId; + + @TableField(exist = false) + private Integer devId; + + @TableField(exist = false) + private String battgroupName; + + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; + + @TableField(exist = false) + private Float restCap; + @TableField(exist = false) + private Float restTime; + + @TableField(exist = false) + private Float realCap; + + @TableField(exist = false) + private String precentCap; + } diff --git a/src/main/java/com/whyc/pojo/db_data_history/BattRealdataId.java b/src/main/java/com/whyc/pojo/db_data_history/BattRealdataId.java new file mode 100644 index 0000000..fcc6386 --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_data_history/BattRealdataId.java @@ -0,0 +1,115 @@ +package com.whyc.pojo.db_data_history; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 鐢垫睜缁�1000288_2025_04鍘嗗彶瀹炴椂鏁版嵁琛� + * </p> + * + * @author lxw + * @since 2025-05-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="BattRealdataId", description="鐢垫睜缁勫巻鍙插疄鏃舵暟鎹〃") +public class BattRealdataId implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "num", type = IdType.AUTO) + private Long num; + + @ApiModelProperty(value = "鐢垫睜缁処D") + private Integer battgroupId; + + @ApiModelProperty(value = "缂栧彿") + private Integer recordNum; + + @ApiModelProperty(value = "璁板綍鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + private Date recordTime; + + @ApiModelProperty(value = "璁板綍鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + @TableField(exist = false) + private Date recordTime1; + + @ApiModelProperty(value = "缁勭鐢靛帇") + private Float groupVol; + + @ApiModelProperty(value = "鍦ㄧ嚎鐢靛帇") + private Float onlineVol; + + @ApiModelProperty(value = "鐢垫睜鐢垫祦") + private Float groupCurr; + + @ApiModelProperty(value = "璁惧娓╁害") + private Float groupTmp; + + @ApiModelProperty(value = "鐢垫睜鐘舵��") + private Integer battState; + + @ApiModelProperty(value = "鐢垫睜娴嬭瘯绫诲瀷") + private Integer battTestType; + + @ApiModelProperty(value = "娴嬭瘯寮�濮嬫椂闂�") + private Date battTestStarttime; + + @ApiModelProperty(value = "娴嬭瘯鏃堕暱") + private Integer battTestTlong; + + @ApiModelProperty(value = "娴嬭瘯瀹归噺") + private Float battTestCap; + + @ApiModelProperty(value = "鍗曚綋缂栧彿") + private Integer monNum; + + @ApiModelProperty(value = "鍗曚綋鐢靛帇") + private Float monVol; + + @ApiModelProperty(value = "鍗曚綋娓╁害") + private Float monTmp; + + @ApiModelProperty(value = "鍗曚綋鍐呴樆") + private Float monRes; + + @ApiModelProperty(value = "鍗曚綋鐢靛") + private Float monSer; + + @ApiModelProperty(value = "鍗曚綋瀹归噺") + private Float monCap; + + @ApiModelProperty(value = "鍗曚綋鍧囪 鐢垫祦") + private Float monJhCurr; + + @ApiModelProperty(value = "澶囨敞") + private String note; + + @ApiModelProperty(value = "鎺ヨЕ鍣ㄩ樆鎶�") + private Float dev_conresist; + + @ApiModelProperty(value = "瀵奸�氬帇闄�") + private Float dev_condvoldp; + + @ApiModelProperty(value = "璐熻浇鐢垫祦") + private Float loadCurr; + + @TableField(exist = false) + private String tableName; + + +} diff --git a/src/main/java/com/whyc/pojo/db_data_history/PwrdevHistorydataId.java b/src/main/java/com/whyc/pojo/db_data_history/PwrdevHistorydataId.java new file mode 100644 index 0000000..e7bce5d --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_data_history/PwrdevHistorydataId.java @@ -0,0 +1,904 @@ +package com.whyc.pojo.db_data_history; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * <p> + * 鐢垫簮110000005_2024_03鍘嗗彶瀹炴椂鏁版嵁琛� + * </p> + * + * @author lxw + * @since 2025-05-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="PwrdevHistorydataId", description="鐢垫簮鍘嗗彶瀹炴椂鏁版嵁琛�") +public class PwrdevHistorydataId implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "num", type = IdType.AUTO) + private Long num; + + @ApiModelProperty(value = "鐢垫簮ID") + private Long powerId; + + @ApiModelProperty(value = "鏇存柊鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") + private Date recordDatetime; + + @ApiModelProperty(value = "缂栧彿") + private Integer recordNum; + + @ApiModelProperty(value = "1璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin1Vola; + + @ApiModelProperty(value = "1璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin1Volb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數鍘�") + private Float acin1Volc; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Vola; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Volb; + + @ApiModelProperty(value = "2璺氦娴佽緭鍏鐩哥數鍘�") + private Float acin2Volc; + + @ApiModelProperty(value = "浜ゆ祦A鐩歌緭鍑虹數鍘�") + private Float acoutVola; + + @ApiModelProperty(value = "浜ゆ祦B鐩歌緭鍑虹數鍘�") + private Float acoutVolb; + + @ApiModelProperty(value = "浜ゆ祦C鐩歌緭鍑虹數鍘�") + private Float acoutVolc; + + @ApiModelProperty(value = "浜ゆ祦A鐩歌緭鍑虹數娴�") + private Float acoutCurra; + + @ApiModelProperty(value = "浜ゆ祦B鐩歌緭鍑虹數娴�") + private Float acoutCurrb; + + @ApiModelProperty(value = "浜ゆ祦C鐩歌緭鍑虹數娴�") + private Float acoutCurrc; + + @ApiModelProperty(value = "鐩存祦杈撳嚭鐢靛帇") + private Float dcoutVol; + + @ApiModelProperty(value = "鐩存祦杈撳嚭鐢垫祦") + private Float dcoutCurr; + + @ApiModelProperty(value = "鐢垫睜缁�1缁勭鐢靛帇") + private Float battgroup1Vol; + + @ApiModelProperty(value = "鐢垫睜缁�1鐢垫祦") + private Float battgroup1Curr; + + @ApiModelProperty(value = "鐢垫睜缁�2缁勭鐢靛帇") + private Float battgroup2Vol; + + @ApiModelProperty(value = "鐢垫睜缁�2鐢垫祦") + private Float battgroup2Curr; + + @ApiModelProperty(value = "鐜娓╁害") + private Float temprature; + + @ApiModelProperty(value = "鏁存祦妯″潡鎬昏緭鍑虹數鍘�") + private Float mOutputvol; + + @ApiModelProperty(value = "妯″潡1杈撳嚭鐢垫祦") + private Float m1Outcurr; + + @ApiModelProperty(value = "妯″潡2杈撳嚭鐢垫祦") + private Float m2Outcurr; + + @ApiModelProperty(value = "妯″潡3杈撳嚭鐢垫祦") + private Float m3Outcurr; + + @ApiModelProperty(value = "妯″潡4杈撳嚭鐢垫祦") + private Float m4Outcurr; + + @ApiModelProperty(value = "妯″潡5杈撳嚭鐢垫祦") + private Float m5Outcurr; + + @ApiModelProperty(value = "妯″潡6杈撳嚭鐢垫祦") + private Float m6Outcurr; + + @ApiModelProperty(value = "妯″潡7杈撳嚭鐢垫祦") + private Float m7Outcurr; + + @ApiModelProperty(value = "妯″潡8杈撳嚭鐢垫祦") + private Float m8Outcurr; + + @ApiModelProperty(value = "妯″潡9杈撳嚭鐢垫祦") + private Float m9Outcurr; + + @ApiModelProperty(value = "妯″潡10杈撳嚭鐢垫祦") + private Float m10Outcurr; + + @ApiModelProperty(value = "妯″潡11杈撳嚭鐢垫祦") + private Float m11Outcurr; + + @ApiModelProperty(value = "妯″潡12杈撳嚭鐢垫祦") + private Float m12Outcurr; + + @ApiModelProperty(value = "妯″潡13杈撳嚭鐢垫祦") + private Float m13Outcurr; + + @ApiModelProperty(value = "妯″潡14杈撳嚭鐢垫祦") + private Float m14Outcurr; + + @ApiModelProperty(value = "妯″潡15杈撳嚭鐢垫祦") + private Float m15Outcurr; + + @ApiModelProperty(value = "妯″潡16杈撳嚭鐢垫祦") + private Float m16Outcurr; + + @ApiModelProperty(value = "绗竴璺氦娴丄鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin1OverVola; + + @ApiModelProperty(value = "绗竴璺氦娴丄鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin1UnderVola; + + @ApiModelProperty(value = "绗竴璺氦娴丄鐩歌緭鍏ョ己鐩�") + private Integer isAcin1LessA; + + @ApiModelProperty(value = "绗竴璺氦娴丅鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin1OverVolb; + + @ApiModelProperty(value = "绗竴璺氦娴丅鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin1UnderVolb; + + @ApiModelProperty(value = "绗竴璺氦娴丅鐩歌緭鍏ョ己鐩�") + private Integer isAcin1LessB; + + @ApiModelProperty(value = "绗竴璺氦娴丆鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin1OverVolc; + + @ApiModelProperty(value = "绗竴璺氦娴丆鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin1UnderVolc; + + @ApiModelProperty(value = "绗竴璺氦娴丆鐩歌緭鍏ョ己鐩�") + private Integer isAcin1LessC; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1闃查浄鍣ㄦ晠闅�") + private Integer isAcin1ThunderErr; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1鍋滅數") + private Integer isAcin1Powerdown; + + @ApiModelProperty(value = "绗簩璺氦娴丄鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin2OverVola; + + @ApiModelProperty(value = "绗簩璺氦娴丄鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin2UnderVola; + + @ApiModelProperty(value = "绗簩璺氦娴丄鐩歌緭鍏ョ己鐩�") + private Integer isAcin2LessA; + + @ApiModelProperty(value = "绗簩璺氦娴丅鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin2OverVolb; + + @ApiModelProperty(value = "绗簩璺氦娴丅鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin2UnderVolb; + + @ApiModelProperty(value = "绗簩璺氦娴丅鐩歌緭鍏ョ己鐩�") + private Integer isAcin2LessB; + + @ApiModelProperty(value = "绗簩璺氦娴丆鐩歌緭鍏ヨ繃鍘�") + private Integer isAcin2OverVolc; + + @ApiModelProperty(value = "绗簩璺氦娴丆鐩歌緭鍏ユ瑺鍘�") + private Integer isAcin2UnderVolc; + + @ApiModelProperty(value = "绗簩璺氦娴丆鐩歌緭鍏ョ己鐩�") + private Integer isAcin2LessC; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1闃查浄鍣ㄦ晠闅�") + private Integer isAcin2ThunderErr; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2鍋滅數") + private Integer isAcin2Powerdown; + + @ApiModelProperty(value = "鐩戞帶鍣ㄦ晠闅�") + private Integer isAcinMonitorerr; + + @ApiModelProperty(value = "鐩存祦杈撳嚭杩囧帇") + private Integer isDcoutOverVol; + + @ApiModelProperty(value = "鐩存祦杈撳嚭娆犲帇") + private Integer isDcoutUnderVol; + + @ApiModelProperty(value = "鐢垫睜缁�1涓嬬數鍛婅") + private Integer isBattgroup1Down; + + @ApiModelProperty(value = "鐢垫簮鍧囧厖") + private Integer isJunCharge; + + @ApiModelProperty(value = "鏁存祦妯″潡1鏁呴殰") + private Float isAcdcmod1Err; + + @ApiModelProperty(value = "鏁存祦妯″潡1鍏虫満") + private Float isAcdcmod1Off; + + @ApiModelProperty(value = "鏁存祦妯″潡2鏁呴殰") + private Float isAcdcmod2Err; + + @ApiModelProperty(value = "鏁存祦妯″潡2鍏虫満") + private Float isAcdcmod2Off; + + @ApiModelProperty(value = "鏁存祦妯″潡3鏁呴殰") + private Float isAcdcmod3Err; + + @ApiModelProperty(value = "鏁存祦妯″潡3鍏虫満") + private Float isAcdcmod3Off; + + @ApiModelProperty(value = "鏁存祦妯″潡4鏁呴殰") + private Float isAcdcmod4Err; + + @ApiModelProperty(value = "鏁存祦妯″潡4鍏虫満") + private Float isAcdcmod4Off; + + @ApiModelProperty(value = "鏁存祦妯″潡5鏁呴殰") + private Float isAcdcmod5Err; + + @ApiModelProperty(value = "鏁存祦妯″潡5鍏虫満") + private Float isAcdcmod5Off; + + @ApiModelProperty(value = "鏁存祦妯″潡6鏁呴殰") + private Float isAcdcmod6Err; + + @ApiModelProperty(value = "鏁存祦妯″潡6鍏虫満") + private Float isAcdcmod6Off; + + @ApiModelProperty(value = "鏁存祦妯″潡7鏁呴殰") + private Float isAcdcmod7Err; + + @ApiModelProperty(value = "鏁存祦妯″潡7鍏虫満") + private Float isAcdcmod7Off; + + @ApiModelProperty(value = "鏁存祦妯″潡8鏁呴殰") + private Float isAcdcmod8Err; + + @ApiModelProperty(value = "鏁存祦妯″潡8鍏虫満") + private Float isAcdcmod8Off; + + @ApiModelProperty(value = "鏁存祦妯″潡9鏁呴殰") + private Float isAcdcmod9Err; + + @ApiModelProperty(value = "鏁存祦妯″潡9鍏虫満") + private Float isAcdcmod9Off; + + @ApiModelProperty(value = "鏁存祦妯″潡10鏁呴殰") + private Float isAcdcmod10Err; + + @ApiModelProperty(value = "鏁存祦妯″潡10鍏虫満") + private Float isAcdcmod10Off; + + @ApiModelProperty(value = "鏁存祦妯″潡11鏁呴殰") + private Float isAcdcmod11Err; + + @ApiModelProperty(value = "鏁存祦妯″潡11鍏虫満") + private Float isAcdcmod11Off; + + @ApiModelProperty(value = "鏁存祦妯″潡12鏁呴殰") + private Float isAcdcmod12Err; + + @ApiModelProperty(value = "鏁存祦妯″潡12鍏虫満") + private Float isAcdcmod12Off; + + @ApiModelProperty(value = "鏁存祦妯″潡13鏁呴殰") + private Float isAcdcmod13Err; + + @ApiModelProperty(value = "鏁存祦妯″潡13鍏虫満") + private Float isAcdcmod13Off; + + @ApiModelProperty(value = "鏁存祦妯″潡14鏁呴殰") + private Float isAcdcmod14Err; + + @ApiModelProperty(value = "鏁存祦妯″潡14鍏虫満") + private Float isAcdcmod14Off; + + @ApiModelProperty(value = "鏁存祦妯″潡15鏁呴殰") + private Float isAcdcmod15Err; + + @ApiModelProperty(value = "鏁存祦妯″潡15鍏虫満") + private Float isAcdcmod15Off; + + @ApiModelProperty(value = "鏁存祦妯″潡16鏁呴殰") + private Float isAcdcmod16Err; + + @ApiModelProperty(value = "鏁存祦妯″潡16鍏虫満") + private Float isAcdcmod16Off; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1璺抽椄") + private Integer isAcin1Trip; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2璺抽椄") + private Integer isAcin2Trip; + + @ApiModelProperty(value = "璐熻浇鐔旀柇") + private Integer isLoaderFuse; + + @ApiModelProperty(value = "鐢垫睜缁�1鐔旀柇") + private Integer isBattgroup1Fuse; + + @ApiModelProperty(value = "鐢垫睜缁�2鐔旀柇") + private Integer isBattgroup2Fuse; + + @ApiModelProperty(value = "鐢垫簮鎬诲憡璀�") + private Integer isTotalAlarm; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Curra; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Currb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�") + private Float acin1Currc; + + @ApiModelProperty(value = "璐熻浇鐢垫祦") + private Float loaderCurr; + + @ApiModelProperty(value = "鐢垫睜缁�1瀹归噺") + private Float battgroup1Ah; + + @ApiModelProperty(value = "鐢垫睜缁�1娓╁害") + private Float battgroup1Temp; + + @ApiModelProperty(value = "鐢垫睜缁�2瀹归噺") + private Float battgroup2Ah; + + @ApiModelProperty(value = "鐢垫睜缁�2娓╁害") + private Float battgroup2Temp; + + @ApiModelProperty(value = "ACDC寮�鍏虫煖娓╁害") + private Float acdcmTemp; + + @ApiModelProperty(value = "妯″潡1杈撳嚭鐢靛帇") + private Float m1OutVol; + + @ApiModelProperty(value = "妯″潡2杈撳嚭鐢靛帇") + private Float m2OutVol; + + @ApiModelProperty(value = "妯″潡3杈撳嚭鐢靛帇") + private Float m3OutVol; + + @ApiModelProperty(value = "妯″潡4杈撳嚭鐢靛帇") + private Float m4OutVol; + + @ApiModelProperty(value = "妯″潡5杈撳嚭鐢靛帇") + private Float m5OutVol; + + @ApiModelProperty(value = "妯″潡6杈撳嚭鐢靛帇") + private Float m6OutVol; + + @ApiModelProperty(value = "妯″潡7杈撳嚭鐢靛帇") + private Float m7OutVol; + + @ApiModelProperty(value = "妯″潡8杈撳嚭鐢靛帇") + private Float m8OutVol; + + @ApiModelProperty(value = "妯″潡9杈撳嚭鐢靛帇") + private Float m9OutVol; + + @ApiModelProperty(value = "妯″潡10杈撳嚭鐢靛帇") + private Float m10OutVol; + + @ApiModelProperty(value = "妯″潡11杈撳嚭鐢靛帇") + private Float m11OutVol; + + @ApiModelProperty(value = "妯″潡12杈撳嚭鐢靛帇") + private Float m12OutVol; + + @ApiModelProperty(value = "妯″潡13杈撳嚭鐢靛帇") + private Float m13OutVol; + + @ApiModelProperty(value = "妯″潡14杈撳嚭鐢靛帇") + private Float m14OutVol; + + @ApiModelProperty(value = "妯″潡15杈撳嚭鐢靛帇") + private Float m15OutVol; + + @ApiModelProperty(value = "妯″潡16杈撳嚭鐢靛帇") + private Float m16OutVol; + + @ApiModelProperty(value = "浜ゆ祦A鐩歌繃娴�") + private Integer isAcb1OverCurra; + + @ApiModelProperty(value = "浜ゆ祦B鐩歌繃娴�") + private Integer isAcb1OverCurrb; + + @ApiModelProperty(value = "浜ゆ祦C鐩歌繃娴�") + private Integer isAcb1OverCurrc; + + @ApiModelProperty(value = "浜ゆ祦1璺湁鐢�") + private Integer isAcin1Poweron; + + @ApiModelProperty(value = "浜ゆ祦2璺湁鐢�") + private Integer isAcin2Poweron; + + @ApiModelProperty(value = "鐩存祦杈撳嚭杩囨祦鍛婅") + private Integer isDcoutOverCurr; + + @ApiModelProperty(value = "鐢垫睜缁�1鍏呮斁鐢垫寚绀篬1-鍏� 0-鏀綸") + private Integer isBattgroup1State; + + @ApiModelProperty(value = "鐢垫睜缁�2鍏呮斁鐢垫寚绀篬1-鍏� 0-鏀綸") + private Integer isBattgroup2State; + + @ApiModelProperty(value = "鐢垫睜缁�2涓嬬數鍛婅") + private Integer isBattgroup2Down; + + @ApiModelProperty(value = "鐢垫睜缁�1鍏呯數杩囨祦") + private Integer isBattgroup1Overchgcurr; + + @ApiModelProperty(value = "鐢垫睜缁�2鍏呯數杩囨祦") + private Integer isBattgroup2Overchgcurr; + + @ApiModelProperty(value = "妯″潡1杩囧帇") + private Integer isAcdcmod1Overvol; + + @ApiModelProperty(value = "妯″潡1娆犲帇") + private Integer isAcdcmod1Undervol; + + @ApiModelProperty(value = "妯″潡1杩囨祦") + private Integer isAcdcmod1Overcurr; + + @ApiModelProperty(value = "妯″潡1浜ゆ祦寮傚父") + private Integer isAcdcmod1Acerr; + + @ApiModelProperty(value = "妯″潡1闄愭祦") + private Integer isAcdcmod1Limitcurr; + + @ApiModelProperty(value = "妯″潡2杩囧帇") + private Integer isAcdcmod2Overvol; + + @ApiModelProperty(value = "妯″潡2娆犲帇") + private Integer isAcdcmod2Undervol; + + @ApiModelProperty(value = "妯″潡2杩囨祦") + private Integer isAcdcmod2Overcurr; + + @ApiModelProperty(value = "妯″潡2浜ゆ祦寮傚父") + private Integer isAcdcmod2Acerr; + + @ApiModelProperty(value = "妯″潡2闄愭祦") + private Integer isAcdcmod2Limitcurr; + + @ApiModelProperty(value = "妯″潡3杩囧帇") + private Integer isAcdcmod3Overvol; + + @ApiModelProperty(value = "妯″潡3娆犲帇") + private Integer isAcdcmod3Undervol; + + @ApiModelProperty(value = "妯″潡3杩囨祦") + private Integer isAcdcmod3Overcurr; + + @ApiModelProperty(value = "妯″潡3浜ゆ祦寮傚父") + private Integer isAcdcmod3Acerr; + + @ApiModelProperty(value = "妯″潡3闄愭祦") + private Integer isAcdcmod3Limitcurr; + + @ApiModelProperty(value = "妯″潡4杩囧帇") + private Integer isAcdcmod4Overvol; + + @ApiModelProperty(value = "妯″潡4娆犲帇") + private Integer isAcdcmod4Undervol; + + @ApiModelProperty(value = "妯″潡4杩囨祦") + private Integer isAcdcmod4Overcurr; + + @ApiModelProperty(value = "妯″潡4浜ゆ祦寮傚父") + private Integer isAcdcmod4Acerr; + + @ApiModelProperty(value = "妯″潡4闄愭祦") + private Integer isAcdcmod4Limitcurr; + + @ApiModelProperty(value = "妯″潡5杩囧帇") + private Integer isAcdcmod5Overvol; + + @ApiModelProperty(value = "妯″潡5娆犲帇") + private Integer isAcdcmod5Undervol; + + @ApiModelProperty(value = "妯″潡5杩囨祦") + private Integer isAcdcmod5Overcurr; + + @ApiModelProperty(value = "妯″潡5浜ゆ祦寮傚父") + private Integer isAcdcmod5Acerr; + + @ApiModelProperty(value = "妯″潡5闄愭祦") + private Integer isAcdcmod5Limitcurr; + + @ApiModelProperty(value = "妯″潡6杩囧帇") + private Integer isAcdcmod6Overvol; + + @ApiModelProperty(value = "妯″潡6娆犲帇") + private Integer isAcdcmod6Undervol; + + @ApiModelProperty(value = "妯″潡6杩囨祦") + private Integer isAcdcmod6Overcurr; + + @ApiModelProperty(value = "妯″潡6浜ゆ祦寮傚父") + private Integer isAcdcmod6Acerr; + + @ApiModelProperty(value = "妯″潡6闄愭祦") + private Integer isAcdcmod6Limitcurr; + + @ApiModelProperty(value = "妯″潡7杩囧帇") + private Integer isAcdcmod7Overvol; + + @ApiModelProperty(value = "妯″潡7娆犲帇") + private Integer isAcdcmod7Undervol; + + @ApiModelProperty(value = "妯″潡7杩囨祦") + private Integer isAcdcmod7Overcurr; + + @ApiModelProperty(value = "妯″潡7浜ゆ祦寮傚父") + private Integer isAcdcmod7Acerr; + + @ApiModelProperty(value = "妯″潡7闄愭祦") + private Integer isAcdcmod7Limitcurr; + + @ApiModelProperty(value = "妯″潡8杩囧帇") + private Integer isAcdcmod8Overvol; + + @ApiModelProperty(value = "妯″潡8娆犲帇") + private Integer isAcdcmod8Undervol; + + @ApiModelProperty(value = "妯″潡8杩囨祦") + private Integer isAcdcmod8Overcurr; + + @ApiModelProperty(value = "妯″潡8浜ゆ祦寮傚父") + private Integer isAcdcmod8Acerr; + + @ApiModelProperty(value = "妯″潡8闄愭祦") + private Integer isAcdcmod8Limitcurr; + + @ApiModelProperty(value = "妯″潡9杩囧帇") + private Integer isAcdcmod9Overvol; + + @ApiModelProperty(value = "妯″潡9娆犲帇") + private Integer isAcdcmod9Undervol; + + @ApiModelProperty(value = "妯″潡9杩囨祦") + private Integer isAcdcmod9Overcurr; + + @ApiModelProperty(value = "妯″潡9浜ゆ祦寮傚父") + private Integer isAcdcmod9Acerr; + + @ApiModelProperty(value = "妯″潡9闄愭祦") + private Integer isAcdcmod9Limitcurr; + + @ApiModelProperty(value = "妯″潡10杩囧帇") + private Integer isAcdcmod10Overvol; + + @ApiModelProperty(value = "妯″潡10娆犲帇") + private Integer isAcdcmod10Undervol; + + @ApiModelProperty(value = "妯″潡10杩囨祦") + private Integer isAcdcmod10Overcurr; + + @ApiModelProperty(value = "妯″潡10浜ゆ祦寮傚父") + private Integer isAcdcmod10Acerr; + + @ApiModelProperty(value = "妯″潡10闄愭祦") + private Integer isAcdcmod10Limitcurr; + + @ApiModelProperty(value = "妯″潡11杩囧帇") + private Integer isAcdcmod11Overvol; + + @ApiModelProperty(value = "妯″潡11娆犲帇") + private Integer isAcdcmod11Undervol; + + @ApiModelProperty(value = "妯″潡11杩囨祦") + private Integer isAcdcmod11Overcurr; + + @ApiModelProperty(value = "妯″潡11浜ゆ祦寮傚父") + private Integer isAcdcmod11Acerr; + + @ApiModelProperty(value = "妯″潡11闄愭祦") + private Integer isAcdcmod11Limitcurr; + + @ApiModelProperty(value = "妯″潡12杩囧帇") + private Integer isAcdcmod12Overvol; + + @ApiModelProperty(value = "妯″潡12娆犲帇") + private Integer isAcdcmod12Undervol; + + @ApiModelProperty(value = "妯″潡12杩囨祦") + private Integer isAcdcmod12Overcurr; + + @ApiModelProperty(value = "妯″潡12浜ゆ祦寮傚父") + private Integer isAcdcmod12Acerr; + + @ApiModelProperty(value = "妯″潡12闄愭祦") + private Integer isAcdcmod12Limitcurr; + + @ApiModelProperty(value = "妯″潡13杩囧帇") + private Integer isAcdcmod13Overvol; + + @ApiModelProperty(value = "妯″潡13娆犲帇") + private Integer isAcdcmod13Undervol; + + @ApiModelProperty(value = "妯″潡13杩囨祦") + private Integer isAcdcmod13Overcurr; + + @ApiModelProperty(value = "妯″潡13浜ゆ祦寮傚父") + private Integer isAcdcmod13Acerr; + + @ApiModelProperty(value = "妯″潡13闄愭祦") + private Integer isAcdcmod13Limitcurr; + + @ApiModelProperty(value = "妯″潡14杩囧帇") + private Integer isAcdcmod14Overvol; + + @ApiModelProperty(value = "妯″潡14娆犲帇") + private Integer isAcdcmod14Undervol; + + @ApiModelProperty(value = "妯″潡14杩囨祦") + private Integer isAcdcmod14Overcurr; + + @ApiModelProperty(value = ".妯″潡14浜ゆ祦寮傚父") + private Integer isAcdcmod14Acerr; + + @ApiModelProperty(value = "妯″潡14闄愭祦") + private Integer isAcdcmod14Limitcurr; + + @ApiModelProperty(value = "妯″潡15杩囧帇") + private Integer isAcdcmod15Overvol; + + @ApiModelProperty(value = "妯″潡15娆犲帇") + private Integer isAcdcmod15Undervol; + + @ApiModelProperty(value = "妯″潡15杩囨祦") + private Integer isAcdcmod15Overcurr; + + @ApiModelProperty(value = "妯″潡15浜ゆ祦寮傚父") + private Integer isAcdcmod15Acerr; + + @ApiModelProperty(value = "妯″潡15闄愭祦") + private Integer isAcdcmod15Limitcurr; + + @ApiModelProperty(value = "妯″潡16杩囧帇") + private Integer isAcdcmod16Overvol; + + @ApiModelProperty(value = "妯″潡16娆犲帇") + private Integer isAcdcmod16Undervol; + + @ApiModelProperty(value = "妯″潡16杩囨祦") + private Integer isAcdcmod16Overcurr; + + @ApiModelProperty(value = "妯″潡16浜ゆ祦寮傚父") + private Integer isAcdcmod16Acerr; + + @ApiModelProperty(value = "妯″潡16闄愭祦") + private Integer isAcdcmod16Limitcurr; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1鐔旀柇") + private Integer isAcin1Fuse; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2鐔旀柇") + private Integer isAcin2Fuse; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1涓夌浉涓嶅钩琛�") + private Integer isAcin1Unbanlance; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2涓夌浉涓嶅钩琛�") + private Integer isAcin2Unbanlance; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1棰戠巼寮傚父") + private Integer isAcin1Freqerr; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2棰戠巼寮傚父") + private Integer isAcin2Freqerr; + + @ApiModelProperty(value = "鐢垫睜缁�1鐢靛帇浣�") + @TableField("is_battgroup1_volLow") + private Integer isBattgroup1Vollow; + + @ApiModelProperty(value = "鐢垫睜缁�2鐢靛帇浣�") + @TableField("is_battgroup2_volLow") + private Integer isBattgroup2Vollow; + + @ApiModelProperty(value = "鐩存祦鎬绘晠闅�") + private Integer isDcoutTotalAlarm; + + @ApiModelProperty(value = "浜ゆ祦鎬绘晠闅�") + private Integer isAcinTotalAlarm; + + @ApiModelProperty(value = "妯″潡1鍧囧厖") + private Integer isAcdcmod1Junchg; + + @ApiModelProperty(value = "妯″潡2鍧囧厖") + private Integer isAcdcmod2Junchg; + + @ApiModelProperty(value = "妯″潡3鍧囧厖") + private Integer isAcdcmod3Junchg; + + @ApiModelProperty(value = "妯″潡4鍧囧厖") + private Integer isAcdcmod4Junchg; + + @ApiModelProperty(value = "妯″潡5鍧囧厖") + private Integer isAcdcmod5Junchg; + + @ApiModelProperty(value = "妯″潡6鍧囧厖") + private Integer isAcdcmod6Junchg; + + @ApiModelProperty(value = "妯″潡7鍧囧厖") + private Integer isAcdcmod7Junchg; + + @ApiModelProperty(value = "妯″潡8鍧囧厖") + private Integer isAcdcmod8Junchg; + + @ApiModelProperty(value = "妯″潡9鍧囧厖") + private Integer isAcdcmod9Junchg; + + @ApiModelProperty(value = "妯″潡10鍧囧厖") + private Integer isAcdcmod10Junchg; + + @ApiModelProperty(value = "妯″潡11鍧囧厖") + private Integer isAcdcmod11Junchg; + + @ApiModelProperty(value = "妯″潡12鍧囧厖") + private Integer isAcdcmod12Junchg; + + @ApiModelProperty(value = "妯″潡13鍧囧厖") + private Integer isAcdcmod13Junchg; + + @ApiModelProperty(value = "妯″潡14鍧囧厖") + private Integer isAcdcmod14Junchg; + + @ApiModelProperty(value = "妯″潡15鍧囧厖") + private Integer isAcdcmod15Junchg; + + @ApiModelProperty(value = "妯″潡16鍧囧厖") + private Integer isAcdcmod16Junchg; + + @ApiModelProperty(value = "鍗忚浆涓庣數婧愰�氫俊鏁呴殰") + private Integer isPowerdevCommerr; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin1Vola; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin1Volb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin1Volc; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin1Curra; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin1Currb; + + @ApiModelProperty(value = "浜ゆ祦1璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin1Currc; + + @ApiModelProperty(value = "浜ゆ祦1璺鐜�-鐢佃〃") + private Float useracin1Freq; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin2Vola; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin2Volb; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數鍘�-鐢佃〃") + private Float useracin2Volc; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin2Curra; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin2Currb; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�-鐢佃〃") + private Float useracin2Currc; + + @ApiModelProperty(value = "浜ゆ祦2璺鐜�-鐢佃〃") + private Float useracin2Freq; + + @ApiModelProperty(value = "娓╁害1-鐢佃〃") + private Float mTemper1; + + @ApiModelProperty(value = "娓╁害2-鐢佃〃") + private Float mTemper2; + + @ApiModelProperty(value = "娓╁害3-鐢佃〃") + private Float mTemper3; + + @ApiModelProperty(value = "婀垮害1-鐢佃〃") + private Float mHumidity1; + + @ApiModelProperty(value = "婀垮害2-鐢佃〃") + private Float mHumidity2; + + @ApiModelProperty(value = "婀垮害3-鐢佃〃") + private Float mHumidity3; + + @ApiModelProperty(value = "浜ゆ祦1璺仠鐢�-鐢佃〃") + private Integer useracin1Powerdown; + + @ApiModelProperty(value = "浜ゆ祦1璺數琛ㄩ�氫俊鏁呴殰-鐢佃〃") + private Integer useracin1Commerr; + + @ApiModelProperty(value = "浜ゆ祦2璺仠鐢�-鐢佃〃") + private Integer useracin2Powerdown; + + @ApiModelProperty(value = "浜ゆ祦2璺數琛ㄩ�氫俊鏁呴殰-鐢佃〃") + private Integer useracin2Commerr; + + @ApiModelProperty(value = "娓╁害浼犳劅鍣�1閫氫俊鏁呴殰-鐢佃〃") + private Integer isTempCommerr1; + + @ApiModelProperty(value = "娓╁害浼犳劅鍣�2閫氫俊鏁呴殰-鐢佃〃") + private Integer isTempCommerr2; + + @ApiModelProperty(value = "娓╁害浼犳劅鍣�3閫氫俊鏁呴殰-鐢佃〃") + private Integer isTempCommerr3; + + @ApiModelProperty(value = "婀垮害浼犳劅鍣�1閫氫俊鏁呴殰-鐢佃〃") + private Integer isHumiCommerr1; + + @ApiModelProperty(value = "婀垮害浼犳劅鍣�2閫氫俊鏁呴殰-鐢佃〃") + private Integer isHumiCommerr2; + + @ApiModelProperty(value = "婀垮害浼犳劅鍣�3閫氫俊鏁呴殰-鐢佃〃") + private Integer isHumiCommerr3; + + @ApiModelProperty(value = "鐑熼浘1鍛婅-鐢佃〃") + private Integer isSmokeAlarm1; + + @ApiModelProperty(value = "鐑熼浘1浼犳劅鍣ㄩ�氫俊鏁呴殰-鐢佃〃") + private Integer isSmokeCommerr1; + + @ApiModelProperty(value = "鐑熼浘2鍛婅-鐢佃〃") + private Integer isSmokeAlarm2; + + @ApiModelProperty(value = "鐑熼浘2浼犳劅鍣ㄩ�氫俊鏁呴殰-鐢佃〃") + private Integer isSmokeCommerr2; + + @ApiModelProperty(value = "鐑熼浘3鍛婅-鐢佃〃") + private Integer isSmokeAlarm3; + + @ApiModelProperty(value = "鐑熼浘3浼犳劅鍣ㄩ�氫俊鏁呴殰-鐢佃〃") + private Integer isSmokeCommerr3; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Curra; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Currb; + + @ApiModelProperty(value = "浜ゆ祦2璺緭鍏鐩哥數娴�") + private Float acin2Currc; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆1鍒嗗悎闂哥姸鎬�:0---鏈煡(鐢ㄤ簬鍏煎浠ュ墠鐨�)锛�1-鍒嗛椄锛�2-鍚堥椄锛�3-鑴辨墸") + private Integer acin1SwitchSt; + + @ApiModelProperty(value = "浜ゆ祦杈撳叆2鍒嗗悎闂哥姸鎬� :0---鏈煡(鐢ㄤ簬鍏煎浠ュ墠鐨�)锛�1-鍒嗛椄锛�2-鍚堥椄锛�3-鑴辨墸") + private Integer acin2SwitchSt; + + +} diff --git a/src/main/java/com/whyc/pojo/db_param/AppParam.java b/src/main/java/com/whyc/pojo/db_param/AppParam.java new file mode 100644 index 0000000..38dd245 --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_param/AppParam.java @@ -0,0 +1,48 @@ +package com.whyc.pojo.db_param; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * <p> + * 骞冲彴鍙傛暟琛� + * </p> + * + * @author lxw + * @since 2025-06-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName(schema = "db_param",value ="tb_app_param") +@ApiModel(value="AppParam瀵硅薄", description="骞冲彴鍙傛暟琛�") +public class AppParam implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "鑷涓婚敭") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty(value = "鍙傛暟鍚嶇О") + private String paramName; + + @ApiModelProperty(value = "鍙傛暟绫诲埆[1-鍗曚綋鍒ゅ埆闃堝�糫") + private Integer categoryId; + + @ApiModelProperty(value = "鍙傛暟鍊�") + private Float paramValue; + + @ApiModelProperty(value = "鍙傛暟鍚嶇О(鑻辨枃)") + private String paramNamePsx; + + +} diff --git a/src/main/java/com/whyc/pojo/db_param/BattAlmparam.java b/src/main/java/com/whyc/pojo/db_param/BattAlmparam.java index 16ae02e..c2e2e41 100644 --- a/src/main/java/com/whyc/pojo/db_param/BattAlmparam.java +++ b/src/main/java/com/whyc/pojo/db_param/BattAlmparam.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_param; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -77,5 +78,22 @@ @ApiModelProperty(value = "涓嬩笅闄愬憡璀︿娇鑳�") private Integer almLowCoeLowerEn; + @TableField(exist = false) + private String provice; + + @TableField(exist = false) + private String city; + + @TableField(exist = false) + private String country; + + @TableField(exist = false) + private String fullName; + + @TableField(exist = false) + private String stationName; + + @TableField(exist = false) + private String battgroupName; } diff --git a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarm.java b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarm.java index 2ab3fb7..a06af94 100644 --- a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarm.java +++ b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarm.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_pwrdev_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -38,6 +39,9 @@ @ApiModelProperty(value = "鍛婅ID") private Integer almId; + @TableField(exist = false) + private String almName; + @ApiModelProperty(value = "鍛婅绛夌骇") private Integer almLevel; @@ -68,5 +72,17 @@ @ApiModelProperty(value = "鍛婅閲嶈绛夌骇[0:閲嶈锛�1:绱ф�") private Integer almSeverity; + @TableField(exist = false) + private String powerName; + @TableField(exist = false) + private String stationName; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; } diff --git a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmHistory.java b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmHistory.java index 8869e19..51fd478 100644 --- a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmHistory.java +++ b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmHistory.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_pwrdev_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -32,10 +33,13 @@ private Long num; @ApiModelProperty(value = "鐢垫簮ID") - private Long powerId; + private Integer powerId; @ApiModelProperty(value = "鍛婅ID") private Integer almId; + + @TableField(exist = false) + private String almName; @ApiModelProperty(value = "鍛婅绛夌骇") private Integer almLevel; @@ -67,5 +71,16 @@ @ApiModelProperty(value = "鍛婅閲嶈绛夌骇[0:閲嶈锛�1:绱ф�") private Integer almSeverity; + @TableField(exist = false) + private String stationName; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String powerName; + } diff --git a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParam.java b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParam.java index d963cc0..090ce8d 100644 --- a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParam.java +++ b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParam.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_pwrdev_alarm; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -93,4 +94,24 @@ private Integer alarmLimithLevel; + @TableField(exist = false) + private String provice; + + @TableField(exist = false) + private String city; + + @TableField(exist = false) + private String country; + + @TableField(exist = false) + private String fullName; + + @TableField(exist = false) + private String stationName; + + @TableField(exist = false) + private String powerName; + + + } diff --git a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParamStand.java b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParamStand.java index e3b55ae..c91f6f1 100644 --- a/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParamStand.java +++ b/src/main/java/com/whyc/pojo/db_pwrdev_alarm/PwrdevAlarmParamStand.java @@ -41,6 +41,9 @@ @ApiModelProperty(value = "鍙傛暟绫诲瀷") private Integer paramType; + @ApiModelProperty(value = "鏍囧噯鍙傛暟瀵瑰簲鏁版嵁鍚嶇О") + private Integer paramName; + @ApiModelProperty(value = "鍩哄噯鍊�") private Float basisVal; @@ -59,5 +62,8 @@ @ApiModelProperty(value = "瑙勮寖鏂囦欢淇濆瓨璺緞") private String standFilePath; + @ApiModelProperty(value = "鏂囦欢鍚�") + private String fileName; + } diff --git a/src/main/java/com/whyc/pojo/db_ram_db/DevAlmparam.java b/src/main/java/com/whyc/pojo/db_ram_db/AlmparamFromDevice.java similarity index 93% rename from src/main/java/com/whyc/pojo/db_ram_db/DevAlmparam.java rename to src/main/java/com/whyc/pojo/db_ram_db/AlmparamFromDevice.java index 09d05e2..7716b8c 100644 --- a/src/main/java/com/whyc/pojo/db_ram_db/DevAlmparam.java +++ b/src/main/java/com/whyc/pojo/db_ram_db/AlmparamFromDevice.java @@ -22,9 +22,9 @@ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@TableName(schema = "db_ram_db",value ="tb_dev_almparam") -@ApiModel(value="DevAlmparam瀵硅薄", description="璁惧鍛婅闃堝�奸仴璋冭〃") -public class DevAlmparam implements Serializable { +@TableName(schema = "db_ram_db",value ="tb_almparam_from_device") +@ApiModel(value="AlmparamFromDevice瀵硅薄", description="璁惧鍛婅闃堝�奸仴璋冭〃") +public class AlmparamFromDevice implements Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/whyc/pojo/db_ram_db/BattRtstate.java b/src/main/java/com/whyc/pojo/db_ram_db/BattRtstate.java index 8260781..e129df6 100644 --- a/src/main/java/com/whyc/pojo/db_ram_db/BattRtstate.java +++ b/src/main/java/com/whyc/pojo/db_ram_db/BattRtstate.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_ram_db; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -102,8 +103,19 @@ @ApiModelProperty(value = "鍚姩澶辫触鍘熷洜") private Integer controlFailType; + @ApiModelProperty(value = "鍚姩澶辫触鍘熷洜") + @TableField(exist = false) + private String controlFailTypeReason; + @ApiModelProperty(value = "涓婁竴娆℃牳瀹圭粓姝㈠師鍥�") private Integer lastCaptestStopType; + @ApiModelProperty(value = "涓婁竴娆℃牳瀹圭粓姝㈠師鍥�") + @TableField(exist = false) + private String lastCaptestStopTypeReason; + + @ApiModelProperty(value = "璐熻浇鐢垫祦") + private Float loadCurr; + } diff --git a/src/main/java/com/whyc/pojo/db_ram_db/DeviceSetparam.java b/src/main/java/com/whyc/pojo/db_ram_db/DeviceSetparam.java index a1fc1db..5864d8c 100644 --- a/src/main/java/com/whyc/pojo/db_ram_db/DeviceSetparam.java +++ b/src/main/java/com/whyc/pojo/db_ram_db/DeviceSetparam.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_ram_db; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -32,7 +33,7 @@ private Long num; @ApiModelProperty(value = "璁惧ID") - private Long devId; + private Integer devId; @ApiModelProperty(value = "杩滅▼鍛戒护") private Integer opCmd; @@ -83,7 +84,21 @@ private Integer diswaittime; @ApiModelProperty(value = "鏍囩О瀹归噺") - private Integer moncapstd; + private Float moncapstd; + + @TableField(exist = false) + private String battgroupName; + @TableField(exist = false) + private String stationName; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; + } diff --git a/src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java b/src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java index 660000d..d0b91b9 100644 --- a/src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java +++ b/src/main/java/com/whyc/pojo/db_ram_db/DeviceState.java @@ -1,6 +1,7 @@ package com.whyc.pojo.db_ram_db; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -53,7 +54,7 @@ @ApiModelProperty(value = "娴嬭瘯缁勫彿") private Integer devTestgroupnum; - @ApiModelProperty(value = "璁惧娴嬭瘯绫诲瀷") + @ApiModelProperty(value = "璁惧宸ヤ綔绫诲瀷") private Integer devWorkstate; @ApiModelProperty(value = "璁惧鍛婅鐘舵��") @@ -110,6 +111,7 @@ private Float devConresist1; @ApiModelProperty(value = "61850璁惧鍛婅") + @TableField(value = "dev_61850alarms") private String dev61850alarms; @ApiModelProperty(value = "缁�2浜屾瀬绠″帇闄�") @@ -127,5 +129,25 @@ @ApiModelProperty(value = "鍏呮斁鐢典竴浣撴満缁�2缁勭鐢垫祦") private Float groupCurr2; + @TableField(exist = false) + private String stationName; + + @TableField(exist = false) + private String stationId; + + @TableField(exist = false) + private Integer powerId; + + @TableField(exist = false) + private String devName; + + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + @TableField(exist = false) + private String country; + @TableField(exist = false) + private String fullName; } diff --git a/src/main/java/com/whyc/pojo/db_station/BattInf.java b/src/main/java/com/whyc/pojo/db_station/BattInf.java index d607baf..cd43901 100644 --- a/src/main/java/com/whyc/pojo/db_station/BattInf.java +++ b/src/main/java/com/whyc/pojo/db_station/BattInf.java @@ -80,9 +80,11 @@ @ApiModelProperty(value = "鍨嬪彿") private String battModel; - @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date inuseTime; @TableField(exist = false) private String stationName; @@ -94,5 +96,26 @@ @ApiModelProperty(value = "0:璁惧涓嬫柊寤虹數姹犵粍锛�1鏂板缓涓�涓澶囦竴涓數姹犵粍") private Integer addBinfFlag; + @TableField(exist = false) + private String provice; + @TableField(exist = false) + private String city; + + @TableField(exist = false) + private String country; + + @TableField(exist = false) + private String fullName; + + @TableField(exist = false) + private String stationType; + + @TableField(exist = false) + @ApiModelProperty(value = "璁惧涓嬬數姹犵粍涓暟") + private Integer battCount; + + @TableField(exist = false) + @ApiModelProperty(value = "鍖呮満缁勫悕绉�") + private String baojiGroupName; } diff --git a/src/main/java/com/whyc/pojo/db_station/PowerInf.java b/src/main/java/com/whyc/pojo/db_station/PowerInf.java index 13a7652..b4c3749 100644 --- a/src/main/java/com/whyc/pojo/db_station/PowerInf.java +++ b/src/main/java/com/whyc/pojo/db_station/PowerInf.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,6 +12,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.Date; /** * <p> @@ -60,6 +62,12 @@ @ApiModelProperty(value = "鐢垫簮绫诲瀷:1:鐩存祦锛�2锛氶�氳锛�3閰嶇綉") private Integer powerType; + @ApiModelProperty(value = "鏁存祦鍣ㄤ娇鑳絒bit0-妯″潡1 bit15-妯″潡16]銆�1-鍙敤 0-涓嶅彲浠ャ��") + private Long modelCfg; + + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai") + private Date powerInuseTime; + @TableField(exist = false) private StationInf sinf; @@ -72,12 +80,14 @@ @TableField(exist = false) private String city; - @TableField(exist = false) private String country; @TableField(exist = false) private String fullName; + @TableField(exist = false) + private String stationType; + } diff --git a/src/main/java/com/whyc/service/AlarmHisService.java b/src/main/java/com/whyc/service/AlarmHisService.java new file mode 100644 index 0000000..d95b0ee --- /dev/null +++ b/src/main/java/com/whyc/service/AlarmHisService.java @@ -0,0 +1,88 @@ +package com.whyc.service; + +import com.github.pagehelper.PageInfo; +import com.whyc.constant.BattAlarmIdEnum; +import com.whyc.constant.BattSingalIdEnum; +import com.whyc.constant.DevAlarmEnum; +import com.whyc.constant.PowerAlarmEnum; +import com.whyc.dto.AlmHis.BattAlmPar; +import com.whyc.dto.AlmHis.DevAlmPar; +import com.whyc.dto.AlmHis.PwrAlmPar; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_alarm.BattalarmDataHistory; +import com.whyc.pojo.db_alarm.DevalarmDataHistory; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmHistory; +import com.whyc.pojo.db_user.User; +import com.whyc.util.ActionUtil; +import com.whyc.util.MessageUtils; +import com.whyc.util.SubTablePageInfoUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.util.Date; +import java.util.List; + +@Service +public class AlarmHisService { + @Resource + private SubTablePageInfoUtils subTablePageInfoUtils; + //鐢垫睜鍛婅鍘嗗彶璁板綍鏌ヨ + public Response getBattAlmHis(BattAlmPar almDto) throws ParseException, InterruptedException { + //鍒嗛〉淇℃伅 + Integer pageNum = almDto.getPageNum(); + Integer pageSize = almDto.getPageSize(); + User uinf = ActionUtil.getUser(); + int uid = uinf.getId(); + almDto.setUid(uid); + Date almStartTime = almDto.getAlmStartTime(); + Date almEndTime = almDto.getAlmEndTime(); + PageInfo<Object> pageInfo = subTablePageInfoUtils.getPageInfoByMonthTable(pageNum, pageSize, almStartTime, almEndTime, + "db_alarm", "tb_battalarm_data_history", almDto); + List<Object> list = pageInfo.getList(); + for (Object data : list) { + BattalarmDataHistory dataH = (BattalarmDataHistory) data; + dataH.setAlmName(BattSingalIdEnum.getValue(dataH.getAlmSignalId())); + } + return new Response().setII(1, list!=null, pageInfo, "鐢垫睜鍛婅鍘嗗彶璁板綍鏌ヨ"); + } + //璁惧鍛婅鍘嗗彶璁板綍鏌ヨ + public Response getDevAlmHis(DevAlmPar almDto) throws ParseException, InterruptedException { + Integer pageNum = almDto.getPageNum(); + Integer pageSize = almDto.getPageSize(); + Date almStartTime = almDto.getAlmStartTime(); + Date almEndTime = almDto.getAlmEndTime(); + User uinf = ActionUtil.getUser(); + int uid = uinf.getId(); + almDto.setUid(uid); + PageInfo<Object> pageInfo = subTablePageInfoUtils.getPageInfoByMonthTable(pageNum, pageSize, almStartTime, almEndTime, + "db_alarm", "tb_devalarm_data_history", almDto); + List<Object> list = pageInfo.getList(); + for (Object data : list) { + DevalarmDataHistory dataH = (DevalarmDataHistory) data; + dataH.setAlmName(DevAlarmEnum.getValue(dataH.getAlmId())); + } + return new Response().setII(1, pageInfo.getList()!=null, pageInfo, "杩斿洖缁撴灉"); + } + //鐢垫簮鍛婅鍘嗗彶璁板綍鏌ヨ + public Response getPwrAlmHis(PwrAlmPar almDto) throws ParseException { + Integer pageNum = almDto.getPageNum(); + Integer pageSize = almDto.getPageSize(); + Date almStartTime = almDto.getAlmStartTime(); + Date almEndTime = almDto.getAlmEndTime(); + //recordId = 1 鏅�氱數婧� + //param.setRecordId(1L); + User uinf = ActionUtil.getUser(); + int uid = uinf.getId(); + almDto.setUid(uid); + PageInfo<Object> pageInfo = subTablePageInfoUtils.getPageInfo(pageNum, pageSize, almStartTime, almEndTime, + "db_pwrdev_alarm", "tb_pwrdev_alarm_history", almDto); + List<Object> list = pageInfo.getList(); + for (Object data : list) { + PwrdevAlarmHistory dataH = (PwrdevAlarmHistory) data; + dataH.setAlmName(PowerAlarmEnum.getValue(dataH.getAlmId())); + } + return new Response<>().setII(1, pageInfo, null, "鐢垫簮鍛婅鍘嗗彶璁板綍鏌ヨ"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/AlmparamFromDeviceService.java b/src/main/java/com/whyc/service/AlmparamFromDeviceService.java new file mode 100644 index 0000000..d3d1e3f --- /dev/null +++ b/src/main/java/com/whyc/service/AlmparamFromDeviceService.java @@ -0,0 +1,104 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.whyc.dto.CmdDto.DevCmd; +import com.whyc.dto.Response; +import com.whyc.mapper.AlmparamFromDeviceMapper; +import com.whyc.pojo.db_ram_db.AlmparamFromDevice; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AlmparamFromDeviceService { + @Autowired(required = false) + private AlmparamFromDeviceMapper mapper; + + public boolean sendCmdTo6185Alarm(int opCmd,int devId) + { + int cmd = opCmd; + int cmd_ack = 0; + switch(cmd) { + case DevCmd.CMD_ReadAlarmParam: cmd_ack = DevCmd.CMD_ReadAlarmParam_ACK; break; + case DevCmd.CMD_WriteAlarmParam: cmd_ack = DevCmd.CMD_WriteAlarmParam_ACK; break; + default: + return false; + } + //鏇存柊op_cmd + UpdateWrapper updateWrapper=new UpdateWrapper(); + updateWrapper.set("op_cmd",cmd); + updateWrapper.eq("dev_id",devId); + int flag=mapper.update((AlmparamFromDevice) ActionUtil.objeNull,updateWrapper); + boolean res_exe = false; + if(flag>0) + { + PageHelper.startPage(1,1); + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("dev_id",devId); + for(int n=0; n<40; n++) + { + + AlmparamFromDevice param=mapper.selectOne(queryWrapper); + if(param!=null){ + if(param.getOpCmd()==cmd_ack){ + res_exe = true; + break; + } + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + }else { + break; + } + } + } + return res_exe; + } + //璁惧鐨勫憡璀﹀弬鏁拌缃� + public Response setAlarmFromDevice(AlmparamFromDevice par) { + UpdateWrapper wrapper=new UpdateWrapper(); + wrapper.set("groupvol_high_val",par.getGroupvolHighVal()); + wrapper.set("groupvol_low_val",par.getGroupvolLowVal()); + wrapper.set("monvol_high_val",par.getMonvolHighVal()); + wrapper.set("monvol_low_val",par.getMonvolLowVal()); + wrapper.set("montmp_high_val",par.getMontmpHighVal()); + wrapper.set("montmp_low_val",par.getMontmpLowVal()); + wrapper.set("monres_high_val",par.getMonresHighVal()); + wrapper.set("monres_low_val",par.getMonresLowVal()); + wrapper.set("moncap_high_val",par.getMoncapHighVal()); + wrapper.set("moncap_low_val",par.getMoncapLowVal()); + wrapper.set("battgroupnum",par.getBattgroupnum()); + wrapper.set("onlinevol_high_val",par.getOnlinevolHighVal()); + wrapper.set("onlinevol_low_val",par.getOnlinevolLowVal()); + wrapper.set("onlinevol_en",par.getOnlinevolEn()); + wrapper.set("groupvol_en",par.getGroupvolEn()); + wrapper.set("monvol_en",par.getMonvolEn()); + wrapper.set("montmp_en",par.getMontmpEn()); + wrapper.set("monres_en",par.getMonresEn()); + wrapper.set("moncap_en",par.getMoncapEn()); + wrapper.set("discurr_high_val",par.getDiscurrHighVal()); + wrapper.set("discurr_en",par.getDiscurrEn()); + wrapper.set("chrcurr_high_val",par.getChrcurrHighVal()); + wrapper.set("chrcurr_en",par.getChrcurrEn()); + wrapper.eq("dev_id",par.getDevId()); + int flag=mapper.update((AlmparamFromDevice) ActionUtil.objeNull,wrapper); + boolean bl=false; + if(flag>0){ + bl= sendCmdTo6185Alarm(DevCmd.CMD_WriteAlarmParam, par.getDevId()); + } + return new Response().set(1, bl, bl == true ? "璁剧疆鎴愬姛!" : "璁剧疆澶辫触,璇锋鏌ョ綉缁�!"); + } + //璁惧鐨勫憡璀﹀弬鏁拌鍙� + public Response getAlarmFromDevice(int devId) { + boolean bl = sendCmdTo6185Alarm(DevCmd.CMD_ReadAlarmParam, devId); + UpdateWrapper wrapper = new UpdateWrapper(); + wrapper.eq("dev_id", devId); + wrapper.last("limit 1"); + AlmparamFromDevice par = mapper.selectOne(wrapper); + return new Response().setII(1, bl,par, bl == true ? "璇诲彇鎴愬姛!" : "璇诲彇澶辫触,璇锋鏌ョ綉缁�!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/AppParamService.java b/src/main/java/com/whyc/service/AppParamService.java new file mode 100644 index 0000000..999c1ad --- /dev/null +++ b/src/main/java/com/whyc/service/AppParamService.java @@ -0,0 +1,26 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.whyc.mapper.AppParamMapper; +import com.whyc.pojo.db_param.AppParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class AppParamService { + @Autowired(required = false) + private AppParamMapper mapper; + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + public List<AppParam> getHrParam() { + QueryWrapper wrapper=new QueryWrapper(); + List<String> params=new ArrayList<>(); + params.add("batt_mon_deteriorate_val"); + params.add("batt_mon_damage_val"); + wrapper.in("param_name_psx",params); + wrapper.orderByAsc("id"); + return mapper.selectList(wrapper); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BaojigroupService.java b/src/main/java/com/whyc/service/BaojigroupService.java index 2a3f9e3..4d55691 100644 --- a/src/main/java/com/whyc/service/BaojigroupService.java +++ b/src/main/java/com/whyc/service/BaojigroupService.java @@ -244,4 +244,16 @@ update.eq("station_id",sid); bjPowermapper.delete(update); } + //鏌ヨ鏈烘埧鎵�鍦ㄧ殑鐝粍 + public String getGroupName(Integer powerId) { + String groupName = powerInfMapper.getGroupName(powerId); + return groupName; + } + //鏌ヨ鎵�鏈夌殑鍖呮満缁勫悕闆嗗悎 + public List<Baojigroup> getGroupList() { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("team_flag",1); + List<Baojigroup> list=mapper.selectList(wrapper); + return list; + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattAlmparamService.java b/src/main/java/com/whyc/service/BattAlmparamService.java new file mode 100644 index 0000000..4802243 --- /dev/null +++ b/src/main/java/com/whyc/service/BattAlmparamService.java @@ -0,0 +1,39 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.BattAlmparamMapper; +import com.whyc.pojo.db_param.BattAlmparam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BattAlmparamService { + @Autowired(required = false) + private BattAlmparamMapper mapper; + //鑾峰彇鐢垫睜鍛婅鍙傛暟 + public Response getBattAlmParam(AlmDto almDto) { + PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); + List<BattAlmparam> list = mapper.getBattAlmParam(almDto); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇鐢垫睜鍛婅鍙傛暟"); + } + //淇敼鐢垫睜鍛婅鍙傛暟 + public Response setBattAlmParam(List<BattAlmparam> almparamList) { + for (BattAlmparam param:almparamList) { + UpdateWrapper wrapper=new UpdateWrapper(); + wrapper.eq("battgroup_id",param.getBattgroupId()); + wrapper.eq("alm_id",param.getAlmId()); + mapper.update(param,wrapper); + } + return new Response().set(1,true,"淇敼鐢垫睜鍛婅鍙傛暟"); + } + + +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattInfService.java b/src/main/java/com/whyc/service/BattInfService.java index 10056b1..c027615 100644 --- a/src/main/java/com/whyc/service/BattInfService.java +++ b/src/main/java/com/whyc/service/BattInfService.java @@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.whyc.constant.Capperformance; +import com.whyc.constant.PowerAlarmEnum; import com.whyc.dto.BattDto; import com.whyc.dto.InfoDto; +import com.whyc.dto.Real.QuarterDto; import com.whyc.dto.Response; +import com.whyc.dto.Statistic.*; import com.whyc.factory.InfoFactory; import com.whyc.mapper.BattInfMapper; import com.whyc.mapper.PowerInfMapper; @@ -23,6 +27,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; @Service public class BattInfService { @@ -217,6 +222,12 @@ if(pinf.getPowerType()!=null){ wrapper2.set("power_type",pinf.getPowerType()); } + if(pinf.getPowerInuseTime()!=null){ + wrapper2.set("power_inuse_time",pinf.getPowerInuseTime()); + } + if(pinf.getModelCfg()!=null){ + wrapper2.set("model_cfg",pinf.getModelCfg()); + } /*if(pinf.getPowerName()!=null){ //妫�娴嬭鏈烘埧涓嬭淇敼鐨勭數婧愬悕鏄惁瀛樺湪 QueryWrapper queryWrapper1=new QueryWrapper(); @@ -286,6 +297,9 @@ } if (binf.getBattModel() != null) { wrapper4.set("batt_model", binf.getBattModel()); + } + if (binf.getInuseTime() != null) { + wrapper4.set("inuse_time", binf.getInuseTime()); } wrapper4.eq("battgroup_id", binf.getBattgroupId()); mapper.update((BattInf) ActionUtil.objeNull,wrapper3); @@ -378,4 +392,81 @@ return new Response().setII(1,list.size()>0,list,"鑾峰彇璁惧鍨嬪彿(涓嬫媺)"); } + //鏍规嵁鐢垫睜缁刬d鑾峰彇鐢垫睜缁勪俊鎭� + public BattInf getBinfByBattgroupId(Integer battgroupId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.last("limit 1"); + BattInf binf=mapper.selectOne(wrapper); + return binf; + } + //褰撴病鏈夊唴鍔╂祴璇曟椂鍒濆鍐呴樆鍊间负鏍囩О鍐呴樆 + public List<QuarterDto> getBinfResStd(Integer battgroupId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.last("limit 1"); + BattInf binf=mapper.selectOne(wrapper); + Float monresstd=binf.getMonresstd(); + List<QuarterDto> list=new ArrayList<>(); + for(int i=0;i<binf.getMoncount();i++){ + QuarterDto dto=new QuarterDto(); + dto.setRecordTime(binf.getCreateTime()); + dto.setMonNum(i+1); + dto.setNumValue(monresstd); + } + return list; + } + + //璁惧淇℃伅缁熻 + public Response getDevStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<BattInf> list=mapper.getDevStatistic(stic); + for (BattInf binf:list) { + //鑾峰彇璁惧涓嬬數姹犵粍涓暟 + int battCount=mapper.getBattCountBydevId(binf.getDevId()); + binf.setBattCount(battCount); + } + PageInfo<BattInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"璁惧淇℃伅缁熻"); + } + //钃勭數姹犵粍淇℃伅缁熻 + public Response getBattStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<BattInf> list=mapper.getBattStatistic(stic); + PageInfo<BattInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"钃勭數姹犵粍淇℃伅缁熻"); + } + //鍗曚綋缁熻鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + public List<BattInf> getMonStatistic(MonStic stic) { + return mapper.getMonStatistic(stic); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰15 + public List<BattInf> getBattCompare15Statistic(BattCompareStic stic) { + return mapper.getBattCompare15Statistic(stic); + } + //鑾峰彇瀹归噺鎬ц兘(涓嬫媺) + public Response getCapperformance() { + Map<Integer,String> map= Capperformance.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇瀹归噺鎬ц兘(涓嬫媺)"); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰16 + public List<BattInf> getBattCompare16Statistic(BattCompareStic stic) { + return mapper.getBattCompare16Statistic(stic); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰17 + public List<BattInf> getBattCompare17Statistic(BattCompareStic stic) { + return mapper.getBattCompare17Statistic(stic); + } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + public List<BattInf> getDischr5Statistic(DisChargeStic stic) { + return mapper.getDischr5Statistic(stic); + } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.6) + public List<BattInf> getDischr6Statistic(DisChargeStic stic) { + return mapper.getDischr6Statistic(stic); + } + //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10) + public List<BattInf> getPerformanceStatistic(PerformanceStic stic) { + return mapper.getPerformanceStatistic(stic); + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattRealdataIdService.java b/src/main/java/com/whyc/service/BattRealdataIdService.java new file mode 100644 index 0000000..f237c32 --- /dev/null +++ b/src/main/java/com/whyc/service/BattRealdataIdService.java @@ -0,0 +1,222 @@ +package com.whyc.service; + +import com.whyc.dto.Real.BattHisRealDto; +import com.whyc.dto.Real.CompareDto; +import com.whyc.dto.Real.QuarterDto; +import com.whyc.dto.Real.RealDateDTO; +import com.whyc.dto.Response; +import com.whyc.factory.ThreadPoolExecutorFactory; +import com.whyc.mapper.CommonMapper; + +import com.whyc.pojo.db_data_history.BattRealdataId; +import com.whyc.util.ActionUtil; +import com.whyc.util.DateUtil; +import com.whyc.util.ThreadLocalUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static java.lang.Thread.sleep; + +@Service +public class BattRealdataIdService { + @Autowired + private SubTablePageInfoService subTablePageInfoService; + @Resource + private CommonMapper commonMapper; + + @Autowired + private BattresdataInfService resInfService; + + @Autowired + private BattInfService binfService; + + + //鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勫崟浣撴暟鎹� + public Response getBattQuarterVol(Integer battgroupId) { + HashMap<String,Object> map = new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + int num=0; + List<String> datelist = ActionUtil.getLastQuarterYearMonths(); + for (int i=0;i<datelist.size();i++) { + String date=datelist.get(i); + String tableName ="db_data_history.tb_batt_realdata_"+battgroupId+"_"+date; + String existTableName = commonMapper.existTable("db_data_history", "tb_batt_realdata_"+battgroupId+"_"+date); + if(existTableName == null){ + continue; + } + //鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + List<QuarterDto> datalist=subTablePageInfoService.getBattRealHis(tableName,"mon_vol"); + map.put(date,datalist); + //鑾峰彇琛ㄤ腑鏈�澶э紝鏈�灏忥紝骞冲潎鏁版嵁鍊� + CompareDto compareData=subTablePageInfoService.getBattCompareHis(tableName,"mon_vol"); + if(num==0){ + maxData=compareData.getMaxData(); + minData=compareData.getMinData(); + } + if (compareData.getMaxData() >= maxData) { + maxData =compareData.getMaxData(); + } + if (compareData.getMinData() <= minData) { + minData= compareData.getMinData(); + } + avgData+= compareData.getAvgData(); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData/datelist.size()); + num++; + } + return new Response().setII(1,map.size()>0,map,"鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勭數鍘嬫暟鎹�"); + } + //鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勫唴闃绘暟鎹� + public Response getBattQuarterRes(Integer battgroupId) { + HashMap<String,Object> map = new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + int num=0; + List<String> datelist = ActionUtil.getLastQuarterYearMonths(); + //鑾峰彇鍐呴樆鍒濆鏁版嵁锛堢涓�娆″唴闃绘祴璇曠殑绗竴绗旀暟鎹級 + List<QuarterDto> list=resInfService.getFirstResData(battgroupId); + if(list==null){//褰撳垵濮嬪�间负0鏃朵娇鐢ㄦ爣绉板唴闃� + list=binfService.getBinfResStd(battgroupId); + } + map.put("startRes",list); + for (int i=0;i<datelist.size();i++) { + String date=datelist.get(i); + String tableName ="db_data_history.tb_batt_realdata_"+battgroupId+"_"+date; + String existTableName = commonMapper.existTable("db_data_history", "tb_batt_realdata_"+battgroupId+"_"+date); + if(existTableName == null){ + continue; + } + //鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + List<QuarterDto> datalist=subTablePageInfoService.getBattRealHis(tableName,"mon_res"); + map.put(date,datalist); + //鑾峰彇琛ㄤ腑鏈�澶э紝鏈�灏忥紝骞冲潎鏁版嵁鍊� + CompareDto compareData=subTablePageInfoService.getBattCompareHis(tableName,"mon_res"); + if(num==0){ + maxData=compareData.getMaxData(); + minData=compareData.getMinData(); + } + if (compareData.getMaxData() >= maxData) { + maxData =compareData.getMaxData(); + } + if (compareData.getMinData() <= minData) { + minData= compareData.getMinData(); + } + avgData+= compareData.getAvgData(); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData/datelist.size()); + num++; + } + return new Response().setII(1,map.size()>0,map,"鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勫唴闃绘暟鎹�"); + } + //鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勬俯搴︽暟鎹� + public Response getBattQuarterTmp(Integer battgroupId) { + HashMap<String,Object> map = new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + int num=0; + List<String> datelist = ActionUtil.getLastQuarterYearMonths(); + for (int i=0;i<datelist.size();i++) { + String date=datelist.get(i); + String tableName ="db_data_history.tb_batt_realdata_"+battgroupId+"_"+date; + String existTableName = commonMapper.existTable("db_data_history", "tb_batt_realdata_"+battgroupId+"_"+date); + //鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + if(existTableName == null){ + continue; + } + List<QuarterDto> datalist=subTablePageInfoService.getBattRealHis(tableName,"mon_tmp"); + map.put(date,datalist); + //鑾峰彇琛ㄤ腑鏈�澶э紝鏈�灏忥紝骞冲潎鏁版嵁鍊� + CompareDto compareData=subTablePageInfoService.getBattCompareHis(tableName,"mon_tmp"); + if(num==0){ + maxData=compareData.getMaxData(); + minData=compareData.getMinData(); + } + if (compareData.getMaxData() >= maxData) { + maxData =compareData.getMaxData(); + } + if (compareData.getMinData() <= minData) { + minData= compareData.getMinData(); + } + avgData+= compareData.getAvgData(); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData/datelist.size()); + num++; + } + return new Response().setII(1,map.size()>0,map,"鑾峰彇鐢垫睜缁勬渶杩戜竴瀛e害鐨勬俯搴︽暟鎹�"); + } + //绯荤粺姒傝鑾峰彇鍗婂皬鏃舵牳瀹硅澶囦俊鎭� + public Response getHalfHourBattDevData(Integer battgroupId,Integer granularity) { + String dateTime = ActionUtil.sdfwithOutday.format(new Date()); + String tableName ="db_data_history.tb_batt_realdata_"+battgroupId+"_"+dateTime; + //鑾峰彇鍓嶅崐涓皬鏃舵暟鎹� + LocalDateTime now = LocalDateTime.now(); + // 璁$畻鍗婂皬鏃跺墠鐨勬椂闂寸偣 + LocalDateTime halfHourAgo = now.minusMinutes(30); + // 鏍煎紡鍖栬緭鍑� + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String halfHourAgoTime=halfHourAgo.format(formatter); + String existTableName = commonMapper.existTable("db_data_history", "tb_batt_realdata_"+battgroupId+"_"+dateTime); + if(existTableName == null){ + return new Response().set(1,false,"褰撳墠鐢垫睜缁勪笉瀛樺湪鍓嶉潰灏忔椂鏁版嵁"); + } + List<BattHisRealDto> datalist=subTablePageInfoService.getHalfHourBattDevData(tableName,granularity,halfHourAgoTime); + return new Response().setII(1,datalist.size()>0,datalist,"鑾峰彇鍗婂皬鏃跺唴鏍稿璁惧淇℃伅"); + } + //鍘嗗彶瀹炴椂鏁版嵁 + public Response getBattRealDataHis(Integer battgroupId, Integer granularity,String startTime,String endTime) throws ParseException, InterruptedException { + List<RealDateDTO> dataList = new LinkedList<>(); + List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1), ThreadLocalUtil.parse(endTime,1)); + ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); + CountDownLatch latch = new CountDownLatch(monthTimeList.size()); + for (int i = 0; i < monthTimeList.size(); i++) { + int finalI = i; + pool.execute(() -> { + int finalII = finalI; + BattRealdataId realdata = new BattRealdataId(); + realdata.setRecordTime(monthTimeList.get(finalII).get(0)); + realdata.setRecordTime1(monthTimeList.get(finalII).get(1)); + String table = battgroupId + "_" + ThreadLocalUtil.format(realdata.getRecordTime(),2); + realdata.setTableName(table);//琛ㄥ悕鏃堕棿鏍煎紡閮ㄥ垎 + //鍒ゆ柇琛ㄦ槸鍚﹀瓨鍦� + int tableNum = subTablePageInfoService.judgeTable_realdata(table); + List<RealDateDTO> list = new ArrayList(); + if (tableNum > 0) { + //鑾峰彇鎸囧畾鏃堕棿娈靛唴鏈�澶ф渶灏弐ecordNum纭繚鏁版嵁鐨勫畬鏁� + List recordNums= subTablePageInfoService.getMaxAndMinRecordNum(realdata); + Integer maxRecordNum= 0; + Integer minRecordNum= 0; + if(recordNums.size()>0){ + maxRecordNum=(Integer)recordNums.get(0); + minRecordNum=(Integer)recordNums.get(1); + } + list = subTablePageInfoService.getBattRealDataHis(realdata,granularity,maxRecordNum,minRecordNum); + } + dataList.addAll(list); + latch.countDown(); + }); + sleep(200); + } + latch.await(10, TimeUnit.MINUTES); + List dataListSorted = dataList.stream().sorted(Comparator.comparing(RealDateDTO::getRecordTime)).collect(Collectors.toList()); + return new Response().set(1, dataListSorted); + + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattRtdataService.java b/src/main/java/com/whyc/service/BattRtdataService.java new file mode 100644 index 0000000..2a49c0c --- /dev/null +++ b/src/main/java/com/whyc/service/BattRtdataService.java @@ -0,0 +1,32 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.whyc.mapper.BattRtdataMapper; +import com.whyc.pojo.db_ram_db.BattRtdata; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BattRtdataService { + @Autowired(required = false) + private BattRtdataMapper mapper; + //瀹炴椂鑾峰彇鍗曚綋淇℃伅 + public List<BattRtdata> getRtdataRealInfo(Integer battgroupId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.orderByAsc("mon_num"); + List<BattRtdata> list=mapper.selectList(wrapper); + return list; + } + //鑾峰彇鍗曚綋鐨勫疄鏃舵暟鎹� + public BattRtdata getRtdataByNum(Integer battgroupId, Integer monNum) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.eq("mon_num",monNum); + wrapper.last("limit 1"); + BattRtdata rtdata=mapper.selectOne(wrapper); + return rtdata; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattRtstateService.java b/src/main/java/com/whyc/service/BattRtstateService.java new file mode 100644 index 0000000..47125a3 --- /dev/null +++ b/src/main/java/com/whyc/service/BattRtstateService.java @@ -0,0 +1,31 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.whyc.constant.BattStateEnum; +import com.whyc.constant.DevStateEnum; +import com.whyc.dto.Response; +import com.whyc.mapper.BattRtstateMapper; +import com.whyc.pojo.db_ram_db.BattRtstate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service +public class BattRtstateService { + @Autowired(required = false) + private BattRtstateMapper mapper; + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + public BattRtstate getBattRealInfo(Integer battgroupId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.last("limit 1"); + BattRtstate batt=mapper.selectOne(wrapper); + return batt; + } + //鑾峰彇鐢垫睜缁勫伐浣滅姸鎬佺被鍨�(涓嬫媺) + public Response getBattState() { + Map<Integer,String> map= BattStateEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇鐢垫睜缁勫伐浣滅姸鎬佺被鍨�(涓嬫媺)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattalarmDataService.java b/src/main/java/com/whyc/service/BattalarmDataService.java new file mode 100644 index 0000000..47d0a79 --- /dev/null +++ b/src/main/java/com/whyc/service/BattalarmDataService.java @@ -0,0 +1,61 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.constant.BattAlarmIdEnum; +import com.whyc.constant.BattSingalIdEnum; +import com.whyc.constant.DevAlarmEnum; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.BattalarmDataMapper; +import com.whyc.pojo.db_alarm.BattalarmData; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service +public class BattalarmDataService { + @Autowired(required = false) + private BattalarmDataMapper mapper; + //鑾峰彇鐢垫睜缁勫疄鏃跺憡璀︿俊鎭� + public Response getBattAlmReal(AlmDto almDto) { + PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); + List<BattalarmData> list=mapper.getBattAlmReal(almDto); + list.forEach(data->{ + data.setAlmName(BattSingalIdEnum.getValue(data.getAlmSignalId())); + }); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇鐢垫睜缁勫疄鏃跺憡璀︿俊鎭�"); + } + //纭鐢垫睜鍛婅 + public Response updateBattConfrim(Integer num) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.set("alm_is_confirmed",1); + wrapper.set("alm_confirmed_time",new SimpleDateFormat(ActionUtil.time_yyyyMMddHHmmss).format(new Date())); + // 閫氳繃num淇敼 + wrapper.eq("num",num); + int flag=mapper.update((BattalarmData) ActionUtil.objeNull,wrapper); + return new Response().set(1,flag>0,flag>0?"纭鎴愬姛":"纭澶辫触"); + } + //鑾峰彇涓�绾ф湭澶勭悊瀹炴椂鍛婅鏁� + public Integer getBattAlmNum(Integer battgroupId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.eq("alm_is_confirmed",0); + wrapper.eq("alm_level",1); + List<BattalarmData> list=mapper.selectList(wrapper); + return list!=null?list.size():0; + } + //鑾峰彇鐢垫睜鍛婅绫诲瀷(涓嬫媺) + public Response getAlarmIdType() { + Map<Integer,String> map= BattAlarmIdEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇鐢垫睜鍛婅绫诲瀷(涓嬫媺)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BattresdataInfService.java b/src/main/java/com/whyc/service/BattresdataInfService.java new file mode 100644 index 0000000..0e089fe --- /dev/null +++ b/src/main/java/com/whyc/service/BattresdataInfService.java @@ -0,0 +1,52 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.whyc.dto.Real.QuarterDto; +import com.whyc.mapper.BattresdataInfMapper; +import com.whyc.mapper.CommonMapper; +import com.whyc.pojo.db_batt_testdata.BattresdataId; +import com.whyc.pojo.db_batt_testdata.BattresdataInf; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class BattresdataInfService { + @Autowired(required = false) + private BattresdataInfMapper mapper; + + @Autowired(required = false) + private SubTablePageInfoService subTablePageInfoService; + + @Resource + private CommonMapper commonMapper; + + //涓婁竴娆″唴闃绘祴璇曟暟鎹� + public BattresdataInf getLastTestData(Integer battgroupId) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("battgroup_id", battgroupId); + wrapper.last(" limit 1"); + wrapper.last(" ORDER BY test_starttime DESC "); + BattresdataInf rinf = mapper.selectOne(wrapper); + return rinf; + } + //鑾峰彇鍐呴樆鍒濆鏁版嵁锛堢涓�娆″唴闃绘祴璇曠殑绗竴绗旀暟鎹級 + public List<QuarterDto> getFirstResData(Integer battgroupId) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("battgroup_id", battgroupId); + wrapper.last(" limit 1"); + wrapper.last(" ORDER BY test_record_count asc "); + BattresdataInf rinf = mapper.selectOne(wrapper); + if(rinf!=null){ + String tableName ="db_batt_testdata.tb_battresdata_"+battgroupId; + String existTableName = commonMapper.existTable("db_batt_testdata", "tb_battresdata_"+battgroupId); + if(existTableName != null){ + List<QuarterDto> list=subTablePageInfoService.getBattResInfData(battgroupId,rinf.getTestRecordCount()); + return list; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BatttestdataIdService.java b/src/main/java/com/whyc/service/BatttestdataIdService.java new file mode 100644 index 0000000..bdc2852 --- /dev/null +++ b/src/main/java/com/whyc/service/BatttestdataIdService.java @@ -0,0 +1,34 @@ +package com.whyc.service; + +import com.whyc.dto.Response; +import com.whyc.mapper.CommonMapper; +import com.whyc.pojo.db_batt_testdata.BatttestdataId; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class BatttestdataIdService { + @Autowired + private SubTablePageInfoService subTablePageInfoService; + @Resource + private CommonMapper commonMapper; + + //鎵捐繖娆℃斁鐢电殑鎸囧畾鐨勪竴绗旀暟鎹� + public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) { + List<BatttestdataId> list=subTablePageInfoService.getLastDataByBattgroupId(battgroupId, testRecordCount, recordNum); + return list; + } + //鍘嗗彶娴嬭瘯璁板綍鍏蜂綋鏌愪竴娆℃斁鐢垫暟鎹鎯� + public Response getTinfDataWithTestRecordCount(Integer battgroupId, Integer testRecordCount,Integer recordNum, Integer granularity) { + String tableName ="db_batt_testdata.tb_batttestdata_"+battgroupId; + String existTableName = commonMapper.existTable("db_batt_testdata", "tb_batttestdata_"+battgroupId); + if(existTableName == null){ + return new Response().set(1,false,battgroupId+"鐢垫睜缁勬壘涓嶅埌绗�"+testRecordCount+"娆℃斁鐢佃褰�"); + } + List<BatttestdataId> list=subTablePageInfoService.getTinfDataWithTestRecordCount(tableName,testRecordCount,recordNum,granularity); + return new Response().setII(1,list.size()>0,list,"鑾峰彇鍘嗗彶娴嬭瘯璁板綍鏁版嵁璇︽儏"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/BatttestdataInfService.java b/src/main/java/com/whyc/service/BatttestdataInfService.java new file mode 100644 index 0000000..c1cea22 --- /dev/null +++ b/src/main/java/com/whyc/service/BatttestdataInfService.java @@ -0,0 +1,868 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.constant.Capperformance; +import com.whyc.constant.PowerAlarmEnum; +import com.whyc.constant.StopReasonEnum; +import com.whyc.dto.Real.TestDataDto; +import com.whyc.dto.Response; +import com.whyc.dto.Statistic.*; +import com.whyc.factory.BattCapFactory; +import com.whyc.mapper.BatttestdataInfMapper; +import com.whyc.pojo.db_batt_testdata.BatttestdataId; +import com.whyc.pojo.db_batt_testdata.BatttestdataInf; +import com.whyc.pojo.db_param.AppParam; +import com.whyc.pojo.db_ram_db.BattRtdata; +import com.whyc.pojo.db_ram_db.BattRtstate; +import com.whyc.pojo.db_station.BattInf; +import com.whyc.pojo.db_user.Baojigroup; +import com.whyc.util.ActionUtil; +import com.whyc.util.PageInfoUtils; +import com.whyc.util.ThreadLocalUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + +@Service +public class BatttestdataInfService { + @Autowired(required = false) + private BatttestdataInfMapper mapper; + + @Autowired(required = false) + private BattRtstateService rtstateService; + + @Autowired(required = false) + private BattRtdataService rtdataService; + + @Autowired(required = false) + private BattInfService battInfService; + + @Autowired(required = false) + private BatttestdataIdService battTestdataIdService; + + @Autowired(required = false) + private AppParamService appParamService; + + @Autowired(required = false) + private BaojigroupService bjService; + + + + + + //鑾峰彇鏈�鍚庝竴娆℃祴璇曟暟鎹苟璁$畻鍓╀綑瀹归噺 + public Float getLastTestDataRestCap(Integer battgroupId) { + //鑾峰彇鏀剧數璁板綍 + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.orderByDesc("test_starttime"); + wrapper.last("limit 1"); + BatttestdataInf tinf=mapper.selectOne(wrapper); + if(tinf!=null){ + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); + return restcap; + }else{ + return 0f; + } + } + //钃勭數姹犳牳瀹逛俊鎭粺璁� + public Response getBattTinfStatistic(BattTinfStic stic) { + PageHelper.startPage(stic.getPageNum(), stic.getPageSize()); + List<BatttestdataInf> list=mapper.getBattTinfStatistic(stic); + if(list!=null&&list.size()>0){ + for (BatttestdataInf tinf:list) { + //鍓╀綑瀹归噺鍜屽墿浣欐椂闂磋绠� + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); + Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + tinf.setRestCap(restCap); + tinf.setRealCap(realCap); + tinf.setRestTime(0f); + //鑾峰彇鐢垫睜缁勫疄鏃舵暟鎹� + BattRtstate battRtstate=rtstateService.getBattRealInfo(tinf.getBattgroupId()); + //鑾峰彇鐢垫睜缁勪俊鎭� + BattInf binf=battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); + //瀹炴椂缁勭鐢垫祦锛屽墿浣欏閲忥紝鏍囩О瀹归噺 + if(battRtstate!=null){ + Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), restCap, binf.getMoncapstd()); + tinf.setRestTime(restTime); + } + //淇濈暀5浣嶅皬鏁� + String precentCap = String.format("%.5f",(restCap/binf.getMoncapstd()*100)); + tinf.setPrecentCap(precentCap); + } + } + + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list.size()>0,pageInfo,"钃勭數姹犳牳瀹逛俊鎭粺璁�"); + } + //鑾峰彇涓婁竴娆℃爣鍑嗘牳瀹逛俊鎭�(鏍囧噯鏍稿鐨勭晫瀹氫负鍗曟祴鏍稿鏃堕棿杈� 2灏忔椂鍙婁互涓婄殑鏍稿娴嬭瘯) + public BatttestdataInf getLastStandardTestData(Integer battgroupId) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("battgroup_id", battgroupId); + wrapper.eq("test_type", 3); + wrapper.eq("test_starttype", 3); + wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); + wrapper.last("limit 1"); + BatttestdataInf tinf = mapper.selectOne(wrapper); + tinf.setTestStoptypeReason(StopReasonEnum.getValue(tinf.getTestStoptype())); + return tinf; + } + + //鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + private BatttestdataInf getLastStandardTestDataByTime(Integer battgroupId, Date testStartTime, Date testEndTime) { + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("battgroup_id", battgroupId); + wrapper.eq("test_type", 3); + wrapper.eq("test_starttype", 3); + if(testStartTime!=null){ + wrapper.gt("test_starttime",testStartTime); + } + if(testEndTime!=null){ + wrapper.lt("test_starttime",testEndTime); + } + wrapper.last(" and test_timelong >= 7200 ORDER BY test_starttime DESC "); + wrapper.last("limit 1"); + BatttestdataInf tinf = mapper.selectOne(wrapper); + return tinf; + } + /*鍗曡妭鏁伴噺缁熻 + 1绛涢�夋弧瓒虫潯浠剁殑鐢垫睜缁勶紝鎵炬渶杩戜竴娆℃爣鍑嗘牳瀹规斁鐢佃褰曠殑鏈�鍚庝竴绗旀暟鎹� + 2鍐嶆寜鐓у叕寮忚绠楀崟浣撳疄闄呭閲忥紝 + 3鐒跺悗鎵惧埌鍒ゆ柇浼樼锛屽姡鍖栵紝鎹熷潖鐨勫弬鏁帮紝寰楀埌缁撴灉銆� + 4娴厖鐢靛帇鍥撅紝闇�瑕佹樉绀哄崟浣�+瀹炴椂鏁版嵁鐨勫崟浣撶數鍘嬶紝鍗曚綋鍐呴樆 + */ + public Map getMonStatistic(MonStic stic) { + Map<String,Object> map=new HashMap<>(); + List<SticMonRes> goodlist=new ArrayList(); + List<SticMonRes> badlist=new ArrayList(); + List<SticMonRes> damagelist=new ArrayList(); + map.put("goodlist",goodlist); + map.put("badlist",badlist); + map.put("damagelist",damagelist); + map.put("goodlistNum",0); + map.put("badlistNum",0); + map.put("damagelistNum",0); + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + List<BattInf> binfList=battInfService.getMonStatistic(stic); + Float realCap=0f; + if(binfList==null){ + return map; + } + for (BattInf binf:binfList) { + BatttestdataInf tinf =getLastStandardTestData(binf.getBattgroupId()); + if(tinf==null){ + //灏嗕笉婊¤冻鏉′欢鐨勭數姹犵粍鐨勬墍鏈夊崟浣撴斁鍏amage涓� + setDamage(damagelist,binf); + continue; + } + //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹� + List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); + if(idDataList==null||idDataList.size()==0){ + //灏嗕笉婊¤冻鏉′欢鐨勭數姹犵粍鐨勬墍鏈夊崟浣撴斁鍏amage涓� + setDamage(damagelist,binf); + continue; + } + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float moncapStd=binf.getMoncapstd(); + for (BatttestdataId data:idDataList) {//姹傚崟浣撶殑 瀹為檯瀹归噺锛屾渶灏忓�煎氨鏄崟浣撶殑鍗曚綋鐢靛帇 + realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real); + SticMonRes res=new SticMonRes(); + res.setBattgroupId(binf.getBattgroupId()); + res.setBattgroupName(binf.getBattgroupName()); + res.setStationName(binf.getStationName()); + res.setDevName(binf.getDevName()); + res.setMonNum(data.getMonNum()); + //鑾峰彇鍗曚綋鐨勫疄鏃舵暟鎹� + BattRtdata rtdata=rtdataService.getRtdataByNum(binf.getBattgroupId(),data.getMonNum()); + if(rtdata==null){ + res.setMonVol(0f); + res.setMonRes(0f); + }else{ + res.setMonVol(rtdata.getMonVol()); + res.setMonRes(rtdata.getMonRes()); + } + if(realCap>=moncapStd*badValue){ + goodlist.add(res); + } + if(realCap<=moncapStd*damageValue){ + damagelist.add(res); + } + if((realCap>moncapStd*damageValue)&&(realCap<moncapStd*badValue)){ + badlist.add(res); + } + } + } + map.put("goodlist",goodlist); + map.put("badlist",badlist); + map.put("damagelist",damagelist); + map.put("goodlistNum",goodlist.size()); + map.put("badlistNum",badlist.size()); + map.put("damagelistNum",damagelist.size()); + return map; + + } + //灏嗕笉婊¤冻鏉′欢鐨勭數姹犵粍鐨勬墍鏈夊崟浣撴斁鍏amage涓� + private void setDamage(List damagelist, BattInf binf) { + //鑾峰彇鐢垫睜缁勭殑瀹炴椂鏁版嵁 + List<BattRtdata> rtdataList=rtdataService.getRtdataRealInfo(binf.getBattgroupId()); + if(rtdataList==null||rtdataList.size()==0){ + for (int i=0;i<binf.getMoncount();i++){ + SticMonRes res=new SticMonRes(); + res.setBattgroupId(binf.getBattgroupId()); + res.setBattgroupName(binf.getBattgroupName()); + res.setStationName(binf.getStationName()); + res.setDevName(binf.getDevName()); + res.setMonNum(i+1); + res.setMonVol(0f); + res.setMonRes(0f); + damagelist.add(res); + } + }else { + for (BattRtdata rtdata:rtdataList) { + SticMonRes res=new SticMonRes(); + res.setBattgroupId(binf.getBattgroupId()); + res.setBattgroupName(binf.getBattgroupName()); + res.setStationName(binf.getStationName()); + res.setDevName(binf.getDevName()); + res.setMonNum(rtdata.getMonNum()); + res.setMonVol(rtdata.getMonVol()); + res.setMonRes(rtdata.getMonRes()); + damagelist.add(res); + } + } + } + /*钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛� + *1.鏌ヨ鍑虹鍚堟潯浠剁殑鐢垫睜缁勪俊鎭� + * 2.璁$畻鐢垫睜缁勭殑棰勪及鍓╀綑瀹归噺 + *3.鍒ゆ柇鎬ц兘鍜岀櫨鍒嗘瘮 + * 4.鍒嗛〉 + */ + public Response getBattCompare15Statistic(BattCompareStic stic) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getBattCompare15Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticCompare15Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + SticCompare15Res res=new SticCompare15Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setDevName(binf.getDevName()); + res.setProduct(binf.getProduct()); + res.setInuseTime(binf.getInuseTime()); + res.setMonvolstd(binf.getMonvolstd()); + res.setStationId(binf.getStationId()); + res.setPowerId(binf.getPowerId()); + res.setDevId(binf.getDevId()); + res.setBattgroupId(binf.getBattgroupId()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + if(tinf==null){ + res.setRealCap(0f); + res.setPrecentCap("0"); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + continue; + } + //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹� + List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); + if(idDataList==null||idDataList.size()==0){ + res.setRealCap(0f); + res.setPrecentCap("0"); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + continue; + } + Float moncapStd=binf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); + res.setRealCap(grouprealCap); + if(grouprealCap>=moncapStd*badValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + } + if(grouprealCap<=moncapStd*damageValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + } + if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + } + //淇濈暀5浣嶅皬鏁� + String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); + res.setPrecentCap(precentCap); + List<Integer> monNums=new ArrayList<>(); + for (BatttestdataId data:idDataList) {//姹傚崟浣撶殑 瀹為檯瀹归噺锛屾渶灏忓�煎氨鏄崟浣撶殑鍗曚綋鐢靛帇 + Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + if (monrealCap <= moncapStd * damageValue) {//鎹熷潖鐨� + monNums.add(data.getMonNum()); + } + } + res.setMonNums(monNums); + if(stic.getPerformance()==null){ + reslist.add(res); + }else{ + if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ + reslist.add(res); + } + } + + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�"); + } + + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堜笉鍚屽搧鐗屽悓涓�鏃堕棿锛�(1.2.16) + public Response getBattCompare16Statistic(BattCompareStic stic) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getBattCompare16Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticCompare16Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + SticCompare16Res res=new SticCompare16Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setDevName(binf.getDevName()); + res.setProduct(binf.getProduct()); + res.setInuseTime(binf.getInuseTime()); + res.setMonvolstd(binf.getMonvolstd()); + res.setMoncapstd(binf.getMoncapstd()); + res.setStationId(binf.getStationId()); + res.setPowerId(binf.getPowerId()); + res.setDevId(binf.getDevId()); + res.setBattgroupId(binf.getBattgroupId()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + if(tinf==null){ + res.setRealCap(0f); + res.setPrecentCap("0"); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + res.setStopReason("--"); + continue; + } + res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); + Float moncapStd=binf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + //Float restCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest); + res.setRealCap(grouprealCap); + if(grouprealCap>=moncapStd*badValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + } + if(grouprealCap<=moncapStd*damageValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + } + if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + } + //淇濈暀5浣嶅皬鏁� + String precentCap = String.format("%.5f",(grouprealCap/binf.getMoncapstd()*100)); + //璇勫垎鐨勯�昏緫 + res.setScore(0f); + res.setPrecentCap(precentCap); + if(stic.getPerformance()==null){ + reslist.add(res); + }else{ + if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ + reslist.add(res); + } + } + + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堜笉鍚屽搧鐗屽悓涓�鏃堕棿锛�"); + } + //钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝涓嶅悓鏃堕棿锛�(1.2.17) + public Response getBattCompare17Statistic(BattCompareStic stic) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getBattCompare17Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticCompare17Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + if(tinf==null){ + //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0 + setSticCompare17Res(binf,reslist,stic.getPerformance()); + continue; + } + //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹� + List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); + if(idDataList==null||idDataList.size()==0){ + //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0 + setSticCompare17Res(binf,reslist,stic.getPerformance()); + continue; + } + Float moncapStd=binf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + for (BatttestdataId data:idDataList) {//姹傚崟浣撶殑 瀹為檯瀹归噺锛屾渶灏忓�煎氨鏄崟浣撶殑鍗曚綋鐢靛帇 + SticCompare17Res res=new SticCompare17Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setDevName(binf.getDevName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setProduct(binf.getProduct()); + res.setInuseTime(binf.getInuseTime()); + res.setMonvolstd(binf.getMonvolstd()); + res.setMonNum(data.getMonNum()); + res.setStationId(binf.getStationId()); + res.setPowerId(binf.getPowerId()); + res.setDevId(binf.getDevId()); + res.setBattgroupId(binf.getBattgroupId()); + Float monrealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), data.getMonVol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + res.setMonrealCap(monrealCap); + //淇濈暀5浣嶅皬鏁� + String monprecentCap = String.format("%.5f",(monrealCap/binf.getMoncapstd()*100)); + res.setMonprecentCap(monprecentCap); + if(monrealCap>=moncapStd*badValue){ + res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + } + if (monrealCap <= moncapStd * damageValue) {//鎹熷潖鐨� + res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + } + if((monrealCap>moncapStd*damageValue)&&(monrealCap<moncapStd*badValue)){ + res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + } + if(stic.getPerformance()==null){ + reslist.add(res); + }else{ + if(res.getMoncapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ + reslist.add(res); + } + } + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"钃勭數姹犵粍瀵规瘮鍒嗘瀽鐣岄潰锛堝悓涓�鍝佺墝鍚屼竴鏃堕棿锛�"); + } + //涓嶅瓨鍦ㄦ斁鐢佃褰曞垯榛樿涓哄疄闄呴浼板閲忓叏涓�0 + private void setSticCompare17Res( BattInf binf, List<SticCompare17Res> reslist,Integer performance) { + for (int i=0;i<binf.getMoncount();i++){ + SticCompare17Res res=new SticCompare17Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setDevName(binf.getDevName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setProduct(binf.getProduct()); + res.setInuseTime(binf.getInuseTime()); + res.setMonvolstd(binf.getMonvolstd()); + res.setStationId(binf.getStationId()); + res.setPowerId(binf.getPowerId()); + res.setDevId(binf.getDevId()); + res.setBattgroupId(binf.getBattgroupId()); + res.setMonNum(i+1); + res.setMonrealCap(0f); + res.setMonprecentCap("0"); + res.setMoncapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + if(performance==null){ + reslist.add(res); + }else{ + if(res.getMoncapperformance().equals(Capperformance.getValue(performance))){ + reslist.add(res); + } + } + } + } + //鍘嗗彶娴嬭瘯璁板綍 + public Response getBattTinf(Integer battgroupId) { + Map<String, Object> map=new HashMap<>(); + List<TestDataDto> List1=new ArrayList<>(); + List<TestDataDto> List2=new ArrayList<>(); + List<TestDataDto> List3=new ArrayList<>(); + List<TestDataDto> List4=new ArrayList<>(); + List<TestDataDto> List5=new ArrayList<>(); + map.put("1",List1); //鏍稿鏀剧數 + map.put("2",List2); //鏍稿鍏呯數 + map.put("3",List3); //鐩戞祴鏀剧數 + map.put("4",List4); //鐩戞祴鍏呯數 + map.put("5",List5); //鍋滅數鏀剧數 + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("battgroup_id",battgroupId); + wrapper.orderByDesc("test_starttime"); + List<BatttestdataInf> list=mapper.selectList(wrapper); + for (BatttestdataInf tinf:list) { + TestDataDto dto=new TestDataDto(); + dto.setTestStarttime(tinf.getTestStarttime()); + dto.setBattgroupId(tinf.getBattgroupId()); + dto.setTestRecordCount(tinf.getTestRecordCount()); + dto.setRecordNum(tinf.getRecordNum()); + dto.setTestCap(tinf.getTestCap()); + dto.setTestTimeLong(tinf.getTestTimelong()); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + dto.setRealCap(realCap); + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + BattRtstate battRtstate = rtstateService.getBattRealInfo(tinf.getBattgroupId()); + //鑾峰彇鐢垫睜缁勪俊鎭� + BattInf binf = battInfService.getBinfByBattgroupId(tinf.getBattgroupId()); + dto.setMoncapstd(binf.getMoncapstd()); + dto.setMonCount(binf.getMoncount()); + dto.setMonvolstd(binf.getMonvolstd()); + if(battRtstate!=null){ + Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), realCap, binf.getMoncapstd()); + dto.setRestTime(restTime); + dto.setFloatchartVol(battRtstate.getGroupVol()); + }else{ + dto.setRestTime(0f); + dto.setFloatchartVol(0f); + } + //鎵捐繖娆℃斁鐢电殑鎸囧畾涓�绗旀暟鎹� + List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),1); + if(idDataList!=null&&idDataList.size()>=0){ + BatttestdataId idData=idDataList.get(0); + dto.setOnlineVol(idData.getOnlineVol()); + dto.setGroupCurr(idData.getTestCurr()); + }else { + dto.setOnlineVol(0f); + dto.setGroupCurr(0f); + } + if (tinf.getTestType() == 3) { + // 娴嬭瘯绫诲瀷涓烘斁鐢� + if (tinf.getTestStarttype() == 3) { + List1.add(dto); + } else if(tinf.getTestStarttype() == 4){ + List5.add(dto); + }else { + List3.add(dto); + } + } else if (tinf.getTestType() == 2) { + // 娴嬭瘯绫诲瀷涓哄厖鐢� + if (tinf.getTestStarttype() == 3) { + List2.add(dto); + } else { + List4.add(dto); + } + } + } + return new Response().setII(1,true,map,"鍘嗗彶娴嬭瘯璁板綍"); + } + //鏈勾搴﹀凡鏀剧數鏁伴噺缁熻(1.2.5) + public Response getDischr5Statistic(DisChargeStic stic) { + Map<String, Object> map=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(map); + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getDischr5Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticDischarge5Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + SticDischarge5Res res=new SticDischarge5Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + if(tinf==null){ + res.setRealCap(0f); + res.setTestStartTime(ThreadLocalUtil.parse("1972-01-01 00:00:00",1)); + res.setTestTimelong(0); + res.setTestCap(0f); + res.setStopReason(""); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + res.setDisChargeType(2); + if(!groupName.equals("none")){ + BanZu bz= (BanZu) map.get(groupName); + int nochargeNum=bz.getNochargeNum(); + bz.setNochargeNum(nochargeNum+1); + map.put(groupName,bz); + } + continue; + } + if(!groupName.equals("none")){ + BanZu bz= (BanZu) map.get(groupName); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + map.put(groupName,bz); + } + res.setTestStartTime(tinf.getTestStarttime()); + res.setTestTimelong(tinf.getTestTimelong()); + res.setTestCap(tinf.getTestCap()); + res.setStopReason(StopReasonEnum.getValue(tinf.getTestStoptype())); + Float moncapStd=binf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + res.setRealCap(grouprealCap); + res.setDisChargeType(1); + if(grouprealCap>=moncapStd*badValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + } + if(grouprealCap<=moncapStd*damageValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + } + if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + } + if(stic.getDisChargeType()==null){ + reslist.add(res); + }else{ + if(res.getDisChargeType()==stic.getDisChargeType()){ + reslist.add(res); + } + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴﹀凡鏀剧數鏁伴噺缁熻"); + } + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + private void setBanZuDefault(Map<String, Object> map) { + List<Baojigroup> banZuList=bjService.getGroupList(); + for (Baojigroup bj:banZuList) { + BanZu bz=new BanZu(); + bz.setBaojiGroupId(bj.getBaojiGroupId()); + bz.setBaojiGroupName(bj.getBaojiGroupName()); + bz.setDischargeNum(0); + bz.setNochargeNum(0); + map.put(bj.getBaojiGroupName(),bz); + } + } + + //鏈勾搴︽湭鏀剧數鏁伴噺缁熻(1.2.6) + public Response getDischr6Statistic(DisChargeStic stic) { + Map<String, Object> map=new HashMap<>(); + //鏌ヨ鍑烘墍鏈夌殑鐝粍骞惰祴浜堝垵濮嬪�� + setBanZuDefault(map); + + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getDischr6Statistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<SticDischarge6Res> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + //鏌ヨ鐢垫睜缁勬墍鍦ㄧ殑鐝粍 + String groupName=bjService.getGroupName(binf.getPowerId()); + SticDischarge6Res res=new SticDischarge6Res(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setMoncapstd(binf.getMoncapstd()); + res.setMonvolstd(binf.getMonvolstd()); + res.setMoncount(binf.getMoncount()); + res.setProduct(binf.getProduct()); + //鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + getNoDischargeData(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime(),stic.getTypeList(),res); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + res.setTinf(tinf); + if(stic.getStopReasonType()==0){ + reslist.add(res); + }else { + if(res.getStopReasonType()==stic.getStopReasonType()){ + reslist.add(res); + } + } + if(tinf==null){ + if(!groupName.equals("none")){ + BanZu bz= (BanZu) map.get(groupName); + int nochargeNum=bz.getNochargeNum(); + bz.setNochargeNum(nochargeNum+1); + map.put(groupName,bz); + } + continue; + } + if(!groupName.equals("none")){ + BanZu bz= (BanZu) map.get(groupName); + int dischargeNum=bz.getDischargeNum(); + bz.setDischargeNum(dischargeNum+1); + map.put(groupName,bz); + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setIII(1,reslist.size()>0,pageInfo,map,"鏈勾搴︽湭鏀剧數鏁伴噺缁熻"); + } + //2.鑾峰彇鐢垫睜缁勬湭鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + private void getNoDischargeData(Integer battgroupId, Date testStartTime, Date testEndTime, List<Integer> typeList, SticDischarge6Res res) { + List<BatttestdataInf> tinfList=mapper.getNoDischargeData(battgroupId,testStartTime,testEndTime,typeList); + List<String> stopList=new ArrayList<>(); + if(tinfList!=null&&tinfList.size()>0){ + res.setErrorNum(tinfList.size()); + res.setStopReasonType(1); + for (BatttestdataInf tinf:tinfList) { + String stopReason=StopReasonEnum.getValue(tinf.getTestStoptype()); + stopList.add(stopReason); + } + res.setStopList(stopList); + }else { + res.setErrorNum(0); + res.setStopList(new ArrayList<>()); + res.setStopReasonType(0); + } + } + //鑾峰彇鏍稿鍋滄鍘熷洜绫诲瀷(涓嬫媺) + public Response getStopReasonType() { + Map<String,Map<Integer,String>> map= StopReasonEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇鏍稿鍋滄鍘熷洜绫诲瀷(涓嬫媺)"); + } + //鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10) + public Response getPerformanceStatistic(PerformanceStic stic) { + //鑾峰彇鏍稿浼樺姡锛屾崯鍧忓弬鏁� + List<AppParam> paramList=appParamService.getHrParam(); + Float badValue=0f; + Float damageValue=0f; + if(paramList!=null){ + for (AppParam param:paramList) { + if(param.getParamNamePsx().equals("batt_mon_deteriorate_val")){ + badValue=param.getParamValue(); + } + if(param.getParamNamePsx().equals("batt_mon_damage_val")){ + damageValue=param.getParamValue(); + } + + } + } + //1鏌ヨ绗﹀悎鏉′欢鐨勭數姹犵粍 + List<BattInf> binfList=battInfService.getPerformanceStatistic(stic); + if(binfList==null||binfList.size()==0){ + return new Response().set(1,false,"褰撳墠鐢ㄦ埛鏈鐞嗘弧瓒虫潯浠剁殑鐢垫睜缁�"); + } + List<PerformanceRes> reslist=new ArrayList<>(); + for (BattInf binf:binfList) { + PerformanceRes res=new PerformanceRes(); + res.setProvice(binf.getProvice()); + res.setCity(binf.getCity()); + res.setCountry(binf.getCountry()); + res.setStationName(binf.getStationName()); + res.setBattgroupName(binf.getBattgroupName()); + res.setProduct(binf.getProduct()); + res.setInuseYear(ActionUtil.getDateYear(new Date())-ActionUtil.getDateYear(binf.getInuseTime())); + res.setMonvolstd(binf.getMonvolstd()); + res.setMoncapstd(binf.getMoncapstd()); + res.setMoncount(binf.getMoncount()); + //2.鑾峰彇鐢垫睜缁勫湪缁欏畾鏃堕棿娈电殑鏀剧數璁板綍(鎸囧畾鏃堕棿娈电殑鏍囧噯鏍稿鏀剧數) + BatttestdataInf tinf =getLastStandardTestDataByTime(binf.getBattgroupId(),stic.getTestStartTime(),stic.getTestEndTime()); + if(stic.getPerformance()==null){ + reslist.add(res); + }else{ + if(res.getCapperformance().equals(Capperformance.getValue(stic.getPerformance()))){ + reslist.add(res); + } + } + if(tinf==null){ + res.setRealCap(0f); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + continue; + } + //鎵捐繖娆℃斁鐢电殑鏈�鍚庝竴绗旀暟鎹� + List<BatttestdataId> idDataList=battTestdataIdService.getLastDataByBattgroupId(tinf.getBattgroupId(),tinf.getTestRecordCount(),tinf.getRecordNum()); + if(idDataList==null||idDataList.size()==0){ + res.setRealCap(0f); + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_4.getStateId())); + continue; + } + Float moncapStd=binf.getMoncapstd(); + int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr()); + Float grouprealCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Real); + res.setRealCap(grouprealCap); + if(grouprealCap>=moncapStd*badValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_1.getStateId())); + } + if(grouprealCap<=moncapStd*damageValue){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_3.getStateId())); + } + if((grouprealCap>moncapStd*damageValue)&&(grouprealCap<moncapStd*badValue)){ + res.setCapperformance(Capperformance.getValue(Capperformance.BATTSTATE_2.getStateId())); + } + } + PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); + return new Response().setII(1,reslist.size()>0,pageInfo,"鐢垫睜缁勭數姹犳�ц兘缁熻锛堟湭鏀剧數锛屼紭绉�锛屽姡鍖栵紝鎹熷潖锛夌粺璁�(1.2.8/9/10)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/DevAlmparamService.java b/src/main/java/com/whyc/service/DevAlmparamService.java new file mode 100644 index 0000000..267217f --- /dev/null +++ b/src/main/java/com/whyc/service/DevAlmparamService.java @@ -0,0 +1,44 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.DevAlmparamMapper; +import com.whyc.pojo.db_param.BattAlmparam; +import com.whyc.pojo.db_param.DevAlmparam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +@Service +public class DevAlmparamService { + @Autowired(required = false) + private DevAlmparamMapper mapper; + + //鑾峰彇璁惧鍛婅鍙傛暟 + public Response getDevAlmParam(Integer almId,Integer pageNum, Integer pageSize) { + PageHelper.startPage(pageNum,pageSize); + QueryWrapper wrapper=new QueryWrapper(); + if(almId!=null){ + wrapper.eq("alm_id",almId); + } + wrapper.orderByAsc("alm_id"); + List<DevAlmparam> list=mapper.selectList(wrapper); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇璁惧鍛婅鍙傛暟"); + } + //淇敼璁惧鍛婅鍙傛暟 + public Response setDevAlmParam(List<DevAlmparam> almparamList) { + for (DevAlmparam param:almparamList) { + UpdateWrapper wrapper=new UpdateWrapper(); + wrapper.eq("alm_id",param.getAlmId()); + mapper.update(param,wrapper); + } + return new Response().set(1,true,"淇敼璁惧鍛婅鍙傛暟"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/DevalarmDataService.java b/src/main/java/com/whyc/service/DevalarmDataService.java new file mode 100644 index 0000000..9dab506 --- /dev/null +++ b/src/main/java/com/whyc/service/DevalarmDataService.java @@ -0,0 +1,61 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.constant.BattAlarmIdEnum; +import com.whyc.constant.BattSingalIdEnum; +import com.whyc.constant.DevAlarmEnum; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.DevalarmDataMapper; +import com.whyc.pojo.db_alarm.DevalarmData; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service +public class DevalarmDataService { + @Autowired(required = false) + private DevalarmDataMapper mapper; + //鑾峰彇璁惧瀹炴椂鍛婅淇℃伅 + public Response getDevAlmReal(AlmDto almDto) { + PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); + List<DevalarmData> list=mapper.getDevAlmReal(almDto); + list.forEach(data->{ + data.setAlmName(DevAlarmEnum.getValue(data.getAlmId())); + }); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇璁惧瀹炴椂鍛婅淇℃伅"); + } + //纭璁惧鍛婅 + public Response updateDevConfrim(Integer num) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.set("alm_is_confirmed",1); + wrapper.set("alm_confirmed_time",new SimpleDateFormat(ActionUtil.time_yyyyMMddHHmmss).format(new Date())); + // 閫氳繃num淇敼 + wrapper.eq("num",num); + int flag=mapper.update((DevalarmData) ActionUtil.objeNull,wrapper); + return new Response().set(1,flag>0,flag>0?"纭鎴愬姛":"纭澶辫触"); + } + //鑾峰彇涓�绾ф湭澶勭悊瀹炴椂鍛婅鏁� + public Integer getDevAlmNum(Integer devId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("dev_id",devId); + wrapper.eq("alm_is_confirmed",0); + wrapper.eq("alm_level",1); + List<DevalarmData> list=mapper.selectList(wrapper); + return list!=null?list.size():0; + } + //鑾峰彇璁惧鍛婅绫诲瀷(涓嬫媺) + public Response getDevAlmIdType() { + Map<Integer,String> map= DevAlarmEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇璁惧鍛婅绫诲瀷(涓嬫媺)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/DeviceSetparamService.java b/src/main/java/com/whyc/service/DeviceSetparamService.java new file mode 100644 index 0000000..de28919 --- /dev/null +++ b/src/main/java/com/whyc/service/DeviceSetparamService.java @@ -0,0 +1,120 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.whyc.dto.CmdDto.DevCmd; +import com.whyc.dto.Response; +import com.whyc.mapper.DeviceSetparamMapper; +import com.whyc.pojo.db_ram_db.DeviceSetparam; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class DeviceSetparamService { + @Autowired(required = false) + private DeviceSetparamMapper mapper; + //鏈烘埧鍛戒护鎿嶄綔璁惧鏃剁殑cmd鍜宎ck鏍¢獙 test_type -->榛樿鍚姩娴嬭瘯鐨勭被鍨� + public boolean sendCmdToDev(int cmd, int test_type, int dev_id, int battGroupNum) { + int cmd_ack = 0; + switch (cmd) { + case DevCmd.CMD_Start: + cmd_ack = DevCmd.CMD_StartAck; + break; + case DevCmd.CMD_Stop: + cmd_ack = DevCmd.CMD_StopAck; + break; + case DevCmd.CMD_SetDischargeParm: + cmd_ack = DevCmd.CMD_SetDischargeParmAck; + break; + case DevCmd.CMD_GetDischargeParm: + cmd_ack = DevCmd.CMD_GetDischargeParmAck; + break; + case DevCmd.CMD_StartDischarge: + cmd_ack = DevCmd.CMD_StartDischargeAck; + break; + case DevCmd.CMD_StopDischarge: + cmd_ack = DevCmd.CMD_StopDischargeAck; + break; + case DevCmd.CMD_ResetSystem: + cmd_ack = DevCmd.CMD_ResetSystemAck; + case DevCmd.CMD_StartResDischarge: + cmd_ack = DevCmd.CMD_StopResDischarge; + default: + return false; + } + UpdateWrapper updateWrapper=new UpdateWrapper(); + updateWrapper.set("op_cmd",cmd); + updateWrapper.set("battgroupnum",battGroupNum); + if(test_type > 0 && (cmd == DevCmd.CMD_Start||cmd == DevCmd.CMD_Stop)){ //鍚姩娴嬭瘯鏃舵湭鐐瑰嚮璁惧畾鍙傛暟鎸夐挳锛屼細鍑虹幇鍚姩鍐呴樆娴嬭瘯bug淇 + updateWrapper.set("test_cmd",test_type); + } + updateWrapper.eq("dev_id",dev_id); + int flag=mapper.update((DeviceSetparam) ActionUtil.objeNull,updateWrapper); + boolean res_exe = false; + if(flag>0) + { + PageHelper.startPage(1,1); + QueryWrapper queryWrapper=new QueryWrapper(); + queryWrapper.eq("dev_id",dev_id); + for(int n=0; n<1; n++) + { + DeviceSetparam DeviceSetparam=mapper.selectOne(queryWrapper); + if(DeviceSetparam!=null){ + if(DeviceSetparam.getOpCmd()==cmd_ack){ + res_exe = true; + break; + } + try { + Thread.sleep(500); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }else { + break; + } + } + } + return res_exe; + } + //璁剧疆鏀剧數鍙傛暟 + public Response updateParam(DeviceSetparam param) { + Boolean b=mapper.updateParam(param); + boolean bl=false; + if(b){ + bl=sendCmdToDev(DevCmd.CMD_SetDischargeParm,0,param.getDevId(),param.getBattgroupnum()); + } + return new Response().set(1,bl,bl==true?"璁剧疆鍙傛暟鎴愬姛!":"璁剧疆鍙傛暟澶辫触,璇锋鏌ョ綉缁�!"); + } + //璇诲彇鍙傛暟 + public Response getParam(int devId, int battGroupNum) { + PageHelper.startPage(1, 1); + QueryWrapper wrapper = new QueryWrapper(); + wrapper.eq("dev_id", devId); + boolean bl = sendCmdToDev(DevCmd.CMD_GetDischargeParm,0, devId, battGroupNum); + DeviceSetparam param = mapper.getParam(devId,battGroupNum); + return new Response().setII(1, bl, param, bl == true ? "璇诲彇鍙傛暟鎴愬姛!" : "璇诲彇鏀剧數鍙傛暟,璇锋鏌ョ綉缁�!"); + } + //杩滅▼閲嶅惎 + public Response restart(int devId, int battGroupNum) { + boolean bl = sendCmdToDev(DevCmd.CMD_ResetSystem,0, devId, battGroupNum); + return new Response().set(1,bl,bl==true?"璁惧杩滅▼閲嶅惎鎴愬姛!":"璁惧杩滅▼閲嶅惎澶辫触!"); + } + //杩滅▼鏍稿 + public Response startDis(int devId, int battGroupNum) { + boolean bl = sendCmdToDev(DevCmd.CMD_Start,DevCmd.CMD_StartDischarge, devId, battGroupNum); + return new Response().set(1,bl,bl==true?"杩滅▼鏍稿鎴愬姛!":"杩滅▼鏍稿澶辫触!"); + } + //鍐呴樆娴嬭瘯 + public Response startRes(int devId, int battGroupNum) { + boolean bl = sendCmdToDev(DevCmd.CMD_Start,DevCmd.CMD_StartResDischarge, devId, battGroupNum); + return new Response().set(1,bl,bl==true?"鍚姩鍐呴樆娴嬭瘯鎴愬姛!":"鍚姩鍐呴樆娴嬭瘯澶辫触!"); + } + //鍋滄鍐呴樆娴嬭瘯 + public Response stopRes(int devId, int battGroupNum) { + boolean bl = sendCmdToDev(DevCmd.CMD_Stop,DevCmd.CMD_StopDischarge, devId, battGroupNum); + return new Response().set(1,bl,bl==true?"鍋滄鍐呴樆娴嬭瘯鎴愬姛!":"鍋滄鍐呴樆娴嬭瘯澶辫触!"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/DeviceStateService.java b/src/main/java/com/whyc/service/DeviceStateService.java new file mode 100644 index 0000000..ceead8b --- /dev/null +++ b/src/main/java/com/whyc/service/DeviceStateService.java @@ -0,0 +1,41 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.constant.DevStateEnum; +import com.whyc.dto.Response; +import com.whyc.dto.Statistic.DeviceStateStic; +import com.whyc.mapper.DeviceStateMapper; +import com.whyc.pojo.db_ram_db.DeviceState; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class DeviceStateService { + @Autowired(required = false) + private DeviceStateMapper mapper; + //瀹炴椂鑾峰彇璁惧淇℃伅 + public DeviceState getDevRealInfo(Integer devId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("dev_id",devId); + wrapper.last("limit 1"); + DeviceState dev=mapper.selectOne(wrapper); + return dev; + } + //璁惧宸ヤ綔鐘舵�佺粺璁� + public Response getDeviceStateStatistic(DeviceStateStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<DeviceState> list=mapper.getDeviceStateStatistic(stic); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list.size()>0,pageInfo,"璁惧宸ヤ綔鐘舵�佺粺璁�"); + } + //鑾峰彇璁惧宸ヤ綔绫诲瀷(涓嬫媺) + public Response getDevState() { + Map<Integer,String> map= DevStateEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇璁惧宸ヤ綔绫诲瀷(涓嬫媺)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/ExportService.java b/src/main/java/com/whyc/service/ExportService.java new file mode 100644 index 0000000..5bf94b5 --- /dev/null +++ b/src/main/java/com/whyc/service/ExportService.java @@ -0,0 +1,172 @@ +package com.whyc.service; + +import com.whyc.dto.Statistic.MonStic; +import com.whyc.dto.Statistic.SticMonRes; +import com.whyc.pojo.db_user.User; +import com.whyc.util.ActionUtil; +import com.whyc.util.ServletUtils; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import sun.misc.BASE64Decoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service +public class ExportService { + + @Autowired + private BatttestdataInfService battTinfService; + + + //鍗曡妭鏁伴噺缁熻瀵煎嚭锛�1.2.14锛� + public void exportBattTinfStatistic(HttpServletRequest req, HttpServletResponse resp, MonStic stic) throws ParseException { + String topPic = stic.getTopPic(); //澶撮儴鏌辩姸鍥� + String goodVolPic = stic.getGoodVolPic(); //浼樼鐢靛帇鍥� + String goodResPic = stic.getGoodResPic(); //浼樼鍐呴樆 + String badVolPic = stic.getBadVolPic(); //鍔e寲鐢靛帇鍥� + String badResPic = stic.getBadResPic(); //鍔e寲鍐呴樆 + String damageVolPic = stic.getDamageVolPic(); //鎹熷潖鐢靛帇鍥� + String damageResPic = stic.getDamageResPic(); //鎹熷潖鍐呴樆 + User uinf= ActionUtil.getUser(); + stic.setUid(uinf.getId()); + Map<String,Object> map= battTinfService.getMonStatistic(stic); + List<byte[]> bytes = new ArrayList<byte[]>(); + //澶勭悊鍥剧墖 + try { + if (ServletUtils.isNotNull(topPic)) { + String[] url = topPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(goodVolPic)) { + String[] url = goodVolPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(goodResPic)) { + String[] url = goodResPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(badVolPic)) { + String[] url = badVolPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(badResPic)) { + String[] url = badResPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(damageVolPic)) { + String[] url = damageVolPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + if (ServletUtils.isNotNull(damageResPic)) { + String[] url = damageResPic.split(","); + bytes.add(new BASE64Decoder().decodeBuffer(url[1])); + } + } catch (Exception e) { + e.printStackTrace(); + } + + //褰撳墠鏃ユ湡 + String nowFormat = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); + String excelName = "鍗曡妭鏁伴噺缁熻-"+nowFormat; + + HSSFWorkbook wb = new HSSFWorkbook(); + //鍗曚綋鎬ц兘缁熻琛� + createMonSicPic(wb, bytes); + List<SticMonRes> goodList=(List<SticMonRes>) map.get("goodlist"); + //鍒涘缓浼樼鍗曚綋鏁版嵁琛� + createMonSicTable(wb, goodList,"浼樼鍗曚綋鏁版嵁琛�"); + List<SticMonRes> badList=(List<SticMonRes>) map.get("badlist"); + //鍒涘缓鍔e寲鍗曚綋鏁版嵁琛� + createMonSicTable(wb, badList,"鍔e寲鍗曚綋鏁版嵁琛�"); + List<SticMonRes> damageList=(List<SticMonRes>) map.get("damagelist"); + //鍒涘缓鎹熷潖鍗曚綋鏁版嵁琛� + createMonSicTable(wb, damageList,"鎹熷潖鍗曚綋鏁版嵁琛�"); + + try { + // 杞爜闃叉涔辩爜 + resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode ( excelName+".xlsx", "utf-8")); + OutputStream out = resp.getOutputStream(); + wb.write(out); + out.close(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + //鍒涘缓浼樼/鍔e寲/鎹熷潖鍗曚綋鏁版嵁琛� + private void createMonSicTable(HSSFWorkbook wb, List<SticMonRes> list,String sheetName) { + HSSFSheet sheet = wb.createSheet(sheetName); + sheet.setDefaultColumnWidth(15); //璁剧疆榛樿鍒楀锛屽疄闄呬笂鍥炲鍑�2涓瓧绗︼紝涓嶇煡閬撲负浠�涔� + sheet.setDefaultRowHeight((short) (1 * 256));//璁剧疆榛樿琛岄珮锛岃〃绀�2涓瓧绗︾殑楂樺害 + int rownum = 1; + + String[] arrTh = new String[]{ + "鏈烘埧鍚嶇О","璁惧鍚嶇О","鐢垫睜缁勫悕绉�","鍗曚綋缂栧彿","娴厖鐢靛帇(V)","鍗曚綋鍐呴樆(m惟)" + }; + sheet.createRow(rownum); + for(int i = 0 ;i<arrTh.length;i++){ + sheet.getRow(rownum).createCell(i+1).setCellValue(arrTh[i]); + } + rownum++; + if(list!=null&&list.size()>=0){ + for(SticMonRes res:list){ + sheet.createRow(rownum); + sheet.getRow(rownum).createCell(1).setCellValue(res.getStationName()); + sheet.getRow(rownum).createCell(2).setCellValue(res.getDevName()); + sheet.getRow(rownum).createCell(3).setCellValue(res.getBattgroupName()); + sheet.getRow(rownum).createCell(4).setCellValue(res.getMonNum()); + sheet.getRow(rownum).createCell(5).setCellValue(res.getMonVol()); + sheet.getRow(rownum).createCell(6).setCellValue(res.getMonRes()); + rownum++; + } + } + } + + //鍗曚綋鎬ц兘缁熻琛� + private void createMonSicPic(HSSFWorkbook wb, List<byte[]> bytes) { + + HSSFSheet sheet = wb.createSheet("鍗曚綋鎬ц兘缁熻琛�"); + sheet.setDefaultColumnWidth(15); //璁剧疆榛樿鍒楀锛屽疄闄呬笂鍥炲鍑�2涓瓧绗︼紝涓嶇煡閬撲负浠�涔� + sheet.setDefaultRowHeight((short) (2 * 256)); //璁剧疆榛樿琛岄珮锛岃〃绀�2涓瓧绗︾殑楂樺害 + //瀛椾綋鏍煎紡-鍔犵矖 + HSSFCellStyle cellStyle = wb.createCellStyle(); + HSSFFont font = wb.createFont(); + font.setBold(true); + cellStyle.setFont(font); + + //鍥剧墖鍏冪礌 + HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); + int rowNum = 1; + int rowNumAdd=25; + //鎻掑叆鍥剧墖 + int picNum = 0; + String[] picName = new String[]{ + "鍗曚綋鎬ц兘缁熻鍥�", "浼樼鍗曚綋鐢靛帇鍥�", "浼樼鍗曚綋鍐呴樆鍥�", "鍔e寲鍗曚綋鐢靛帇鍥�", "鍔e寲鍗曚綋鍐呴樆鍥�", "鎹熷潖鍗曚綋鐢靛帇鍥�", "鎹熷潖鍗曚綋鍐呴樆鍥�" + }; + for (int i = 0; i < picName.length; i++) { + sheet.createRow(rowNum - 1); + sheet.getRow(rowNum - 1).createCell(0).setCellValue(picName[i]); + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255, (short) 0, rowNum, (short) 10, rowNum + rowNumAdd); + anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE); + patriarch.createPicture(anchor, wb.addPicture(bytes.get(picNum), HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); + picNum++; + rowNum = rowNum+rowNumAdd+5; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PowerInfService.java b/src/main/java/com/whyc/service/PowerInfService.java index 321d3ff..90e1e71 100644 --- a/src/main/java/com/whyc/service/PowerInfService.java +++ b/src/main/java/com/whyc/service/PowerInfService.java @@ -6,10 +6,12 @@ import com.github.pagehelper.PageInfo; import com.whyc.dto.PowerDto; import com.whyc.dto.Response; +import com.whyc.dto.Statistic.StationStic; import com.whyc.mapper.BaojigroupPowerMapper; import com.whyc.mapper.BaojigroupUsrMapper; import com.whyc.mapper.PowerInfMapper; import com.whyc.mapper.StationInfMapper; +import com.whyc.pojo.db_station.BattInf; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_user.BaojigroupPower; @@ -131,4 +133,19 @@ List<String> list=mapper.getProtocolByUid(uid); return new Response().setII(1,list.size()>0,list,"鑾峰彇鐢垫簮鍗忚(涓嬫媺)"); } + //鑾峰彇鐢垫簮淇℃伅 + public PowerInf getPowerInfById(Integer powerId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("power_id",powerId); + wrapper.last("limit 1"); + PowerInf pinf=mapper.selectOne(wrapper); + return pinf; + } + //鐢垫簮淇℃伅缁熻 + public Response getPowerStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<PowerInf> list=mapper.getPowerStatistic(stic); + PageInfo<PowerInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"鐢垫簮淇℃伅缁熻"); + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PwrdevAcdcdataService.java b/src/main/java/com/whyc/service/PwrdevAcdcdataService.java new file mode 100644 index 0000000..ea8dafc --- /dev/null +++ b/src/main/java/com/whyc/service/PwrdevAcdcdataService.java @@ -0,0 +1,22 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.whyc.mapper.PwrdevAcdcdataMapper; +import com.whyc.pojo.db_ram_db.BattRtstate; +import com.whyc.pojo.db_ram_db.PwrdevAcdcdata; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class PwrdevAcdcdataService { + @Autowired(required = false) + private PwrdevAcdcdataMapper mapper; + //瀹炴椂鑾峰彇鐢垫簮淇℃伅 + public PwrdevAcdcdata getPwrRealInfo(Integer powerId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("power_id",powerId); + wrapper.last("limit 1"); + PwrdevAcdcdata pwr=mapper.selectOne(wrapper); + return pwr; + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PwrdevAlarmParamService.java b/src/main/java/com/whyc/service/PwrdevAlarmParamService.java new file mode 100644 index 0000000..38d73ba --- /dev/null +++ b/src/main/java/com/whyc/service/PwrdevAlarmParamService.java @@ -0,0 +1,42 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.PwrdevAlarmParamMapper; +import com.whyc.pojo.db_param.BattAlmparam; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; +import com.whyc.util.ActionUtil; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +@Service +public class PwrdevAlarmParamService { + @Autowired(required = false) + private PwrdevAlarmParamMapper mapper; + + //鑾峰彇鐢垫簮鍛婅鍙傛暟 + public Response getPwrAlmParam(AlmDto almDto) { + PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); + List<PwrdevAlarmParam> list = mapper.getPwrAlmParam(almDto); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇鐢垫簮鍛婅鍙傛暟"); + } + //淇敼鐢垫簮鍛婅鍙傛暟 + public Response setPwrAlmParam(List<PwrdevAlarmParam> almparamList) { + for (PwrdevAlarmParam param:almparamList) { + UpdateWrapper wrapper=new UpdateWrapper(); + wrapper.eq("power_id",param.getPowerId()); + wrapper.eq("alm_id",param.getAlmId()); + mapper.update(param,wrapper); + } + return new Response().set(1,true,"淇敼鐢垫簮鍛婅鍙傛暟"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PwrdevAlarmParamStandService.java b/src/main/java/com/whyc/service/PwrdevAlarmParamStandService.java new file mode 100644 index 0000000..f3d1f2b --- /dev/null +++ b/src/main/java/com/whyc/service/PwrdevAlarmParamStandService.java @@ -0,0 +1,82 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.whyc.dto.Response; +import com.whyc.mapper.PwrdevAlarmParamStandMapper; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParamStand; +import com.whyc.util.ActionUtil; +import com.whyc.util.DateUtil; +import com.whyc.util.FileUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.util.Date; +import java.util.List; + +@Service +public class PwrdevAlarmParamStandService { + @Autowired(required = false) + private PwrdevAlarmParamStandMapper mapper; + //鏌ヨ鏍囧噯鍙傛暟 + public Response getPwrStandParam(Integer powerType) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("power_type",powerType); + queryWrapper.orderByAsc("num"); + List<PwrdevAlarmParamStand> list=mapper.selectList(queryWrapper); + return new Response().setII(1,list!=null,list,"鏌ヨ鏍囧噯鍙傛暟"); + } + //鏌ヨ瑙勮寖鏂囦欢 + public Response getStandFile(Integer powerType, String fileName) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.select("file_name","stand_file_path"); + queryWrapper.eq("power_type",powerType); + queryWrapper.like("file_name",fileName); + List<PwrdevAlarmParamStand> list=mapper.selectList(queryWrapper); + return new Response().setII(1,list!=null,list,"鏌ヨ瑙勮寖鏂囦欢"); + } + //璁剧疆鏍囧噯鍙傛暟 + public Response setPwrStandParam(PwrdevAlarmParamStand stand) { + UpdateWrapper wrapper=new UpdateWrapper(); + if(stand.getAlarmLimith()!=null){ + wrapper.set("alarm_limith",stand.getAlarmLimith()); + } + if(stand.getAlarmLimitl()!=null){ + wrapper.set("alarm_limitl",stand.getAlarmLimitl()); + } + if(stand.getAlarmLimithUpeper()!=null){ + wrapper.set("alarm_limith_upeper",stand.getAlarmLimithUpeper()); + } + if(stand.getAlarmLimitlLower()!=null){ + wrapper.set("alarm_limitl_lower",stand.getAlarmLimitlLower()); + } + if(stand.getBasisVal()!=null){ + wrapper.set("basis_val",stand.getBasisVal()); + } + wrapper.eq("num",stand.getNum()); + int flag=mapper.update((PwrdevAlarmParamStand) ActionUtil.objeNull,wrapper); + return new Response().set(1,flag>0,flag>0?"璁剧疆鎴愬姛":"璁剧疆澶辫触"); + } + //涓婁紶瑙勮寖鏂囦欢 + public Response uploadStandFile(MultipartFile multipartFile, String num) throws IOException { + Date now = new Date(); + String originalFilename = multipartFile.getOriginalFilename(); + String[] fileNameSplit = originalFilename.split("\\."); + String dateFormat = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(now); + String newFileName = fileNameSplit[0]+"_"+dateFormat+"."+fileNameSplit[1]; + String fileUrlTemp = FileUtil.saveFile(multipartFile,"/stand/"+newFileName); + UpdateWrapper wrapper=new UpdateWrapper(); + wrapper.set("stand_file_path",fileUrlTemp); + wrapper.set("file_name",newFileName); + wrapper.eq("num",num); + int flag=mapper.update((PwrdevAlarmParamStand) ActionUtil.objeNull,wrapper); + return new Response().set(1,flag>0,flag>0?"涓婁紶鎴愬姛":"涓婁紶澶辫触"); + } + //娣诲姞鏍囧噯鍙傛暟 + public Response addPwrStandParam(PwrdevAlarmParamStand stand) { + int flag=mapper.insert(stand); + return new Response().set(1,flag>0,flag>0?"娣诲姞鎴愬姛":"娣诲姞澶辫触"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PwrdevAlarmService.java b/src/main/java/com/whyc/service/PwrdevAlarmService.java new file mode 100644 index 0000000..f4c93c5 --- /dev/null +++ b/src/main/java/com/whyc/service/PwrdevAlarmService.java @@ -0,0 +1,61 @@ +package com.whyc.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.whyc.constant.DevAlarmEnum; +import com.whyc.constant.PowerAlarmEnum; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.mapper.PwrdevAlarmMapper; +import com.whyc.pojo.db_alarm.DevalarmData; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service +public class PwrdevAlarmService { + @Autowired(required = false) + private PwrdevAlarmMapper mapper; + //鑾峰彇鐢垫簮瀹炴椂鍛婅淇℃伅 + public Response getPwrAlmReal(AlmDto almDto) { + PageHelper.startPage(almDto.getPageNum(),almDto.getPageSize()); + List<PwrdevAlarm> list=mapper.getPwrAlmReal(almDto); + list.forEach(data->{ + data.setAlmName(PowerAlarmEnum.getValue(data.getAlmId())); + }); + PageInfo pageInfo=new PageInfo(list); + return new Response().setII(1,list!=null,pageInfo,"鑾峰彇鐢垫簮瀹炴椂鍛婅淇℃伅"); + } + //纭鐢垫簮鍛婅 + public Response updatePwrConfrim(Integer num) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.set("alm_is_confirmed",1); + wrapper.set("alm_confirmed_time",new SimpleDateFormat(ActionUtil.time_yyyyMMddHHmmss).format(new Date())); + // 閫氳繃num淇敼 + wrapper.eq("num",num); + int flag=mapper.update((PwrdevAlarm) ActionUtil.objeNull,wrapper); + return new Response().set(1,flag>0,flag>0?"纭鎴愬姛":"纭澶辫触"); + } + //鑾峰彇涓�绾ф湭澶勭悊瀹炴椂鍛婅鏁� + public Integer getPwrAlmNum(Integer powerId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("power_id",powerId); + wrapper.eq("alm_is_confirmed",0); + wrapper.eq("alm_level",1); + List<DevalarmData> list=mapper.selectList(wrapper); + return list!=null?list.size():0; + } + //鑾峰彇鐢垫簮鍛婅绫诲瀷(涓嬫媺) + public Response getPwrAlmIdType() { + Map<String,Map<Integer,String>> map= PowerAlarmEnum.getOpInfo(); + return new Response().setII(1,true,map,"鑾峰彇鐢垫簮鍛婅绫诲瀷(涓嬫媺)"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java b/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java new file mode 100644 index 0000000..f5646de --- /dev/null +++ b/src/main/java/com/whyc/service/PwrdevHistorydataIdService.java @@ -0,0 +1,73 @@ +package com.whyc.service; + +import com.whyc.dto.Real.PwrHisRealAcInDto; +import com.whyc.dto.Real.PwrHisRealDcoutInDto; +import com.whyc.dto.Response; +import com.whyc.mapper.CommonMapper; +import com.whyc.pojo.db_data_history.BattRealdataId; +import com.whyc.pojo.db_data_history.PwrdevHistorydataId; +import com.whyc.pojo.db_station.PowerInf; +import com.whyc.util.ActionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; + +@Service +public class PwrdevHistorydataIdService { + @Autowired + private SubTablePageInfoService subTablePageInfoService; + @Resource + private CommonMapper commonMapper; + + @Autowired + private PowerInfService powerInfService; + + //绯荤粺姒傝鑾峰彇鍗婂皬鏃朵氦娴佽緭鍏ョ粺璁� + public Response getHalfHourPwrHisAcinData(Integer powerId,Integer granularity) { + String dateTime = ActionUtil.sdfwithOutday.format(new Date()); + //鑾峰彇鍓嶅崐涓皬鏃舵暟鎹� + LocalDateTime now = LocalDateTime.now(); + // 璁$畻鍗婂皬鏃跺墠鐨勬椂闂寸偣 + LocalDateTime halfHourAgo = now.minusMinutes(30); + // 鏍煎紡鍖栬緭鍑� + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String halfHourAgoTime=halfHourAgo.format(formatter); + String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; + String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); + if(existTableName == null){ + return new Response().set(1,false,"褰撳墠鐢垫睜缁勪笉瀛樺湪鍓嶉潰灏忔椂鏁版嵁"); + } + List<PwrHisRealAcInDto> datalist=subTablePageInfoService.getHalfHourPwrHisAcinData(tableName,granularity,halfHourAgoTime); + return new Response().setII(1,datalist.size()>0,datalist,"鑾峰彇鍗婂皬鏃跺唴浜ゆ祦杈撳叆缁熻"); + + } + //绯荤粺姒傝鑾峰彇鍗婂皬鏃剁洿娴佽緭鍑虹粺璁� + public Response getHalfHourPwrHisDcoutData(Integer powerId,Integer granularity) { + String dateTime = ActionUtil.sdfwithOutday.format(new Date()); + //鑾峰彇鍓嶅崐涓皬鏃舵暟鎹� + LocalDateTime now = LocalDateTime.now(); + // 璁$畻鍗婂皬鏃跺墠鐨勬椂闂寸偣 + LocalDateTime halfHourAgo = now.minusMinutes(30); + // 鏍煎紡鍖栬緭鍑� + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String halfHourAgoTime=halfHourAgo.format(formatter); + + String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+dateTime; + String existTableName = commonMapper.existTable("db_data_history", "tb_pwrdev_historydata_"+powerId+"_"+dateTime); + if(existTableName == null){ + return new Response().set(1,false,"褰撳墠鐢垫簮涓嶅瓨鍦ㄥ墠闈㈠皬鏃舵暟鎹�"); + } + List<PwrHisRealDcoutInDto> datalist=subTablePageInfoService.getHalfHourPwrHisDcoutData(tableName,granularity,halfHourAgoTime); + Long modelCfg=0l; + PowerInf pinf=powerInfService.getPowerInfById(powerId); + if(pinf!=null){ + modelCfg=pinf.getModelCfg(); + } + return new Response().setIII(1,datalist.size()>0,datalist,modelCfg,"鑾峰彇鍗婂皬鏃跺唴鐩存祦杈撳嚭缁熻"); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/service/StationInfService.java b/src/main/java/com/whyc/service/StationInfService.java index abb41ce..bfc522e 100644 --- a/src/main/java/com/whyc/service/StationInfService.java +++ b/src/main/java/com/whyc/service/StationInfService.java @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; import com.whyc.dto.Response; import com.whyc.dto.Station.Provice; +import com.whyc.dto.Statistic.StationStic; import com.whyc.mapper.StationInfMapper; import com.whyc.pojo.db_station.PowerInf; import com.whyc.pojo.db_station.StationInf; @@ -73,4 +74,19 @@ return mapper.selectList(query); } + //绔欑偣淇℃伅缁熻 + public Response getStationStatistic(StationStic stic) { + PageHelper.startPage(stic.getPageNum(),stic.getPageSize()); + List<StationInf> list=mapper.getStationStatistic(stic); + PageInfo<StationInf> pageInfo=new PageInfo<>(list); + return new Response().setII(1,list.size()>0,pageInfo,"绔欑偣淇℃伅缁熻"); + } + //鑾峰彇鏈烘埧淇℃伅 + public StationInf getStationInfById(Integer stationId) { + QueryWrapper wrapper=new QueryWrapper(); + wrapper.eq("station_id",stationId); + wrapper.last("limit 1"); + StationInf sinf=mapper.selectOne(wrapper); + return sinf; + } } \ No newline at end of file diff --git a/src/main/java/com/whyc/service/SubTablePageInfoService.java b/src/main/java/com/whyc/service/SubTablePageInfoService.java index 40fba41..88522b3 100644 --- a/src/main/java/com/whyc/service/SubTablePageInfoService.java +++ b/src/main/java/com/whyc/service/SubTablePageInfoService.java @@ -1,290 +1,794 @@ -//package com.whyc.service; -// -//import com.whyc.dto.DevA200AlarmDto; -//import com.whyc.mapper.CallBack; -//import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear; -//import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData; -//import com.whyc.util.ThreadLocalUtil; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Service; -// -//import java.sql.ResultSet; -//import java.sql.SQLException; -//import java.util.ArrayList; -//import java.util.LinkedList; -//import java.util.List; -// -//@Service -//public class SubTablePageInfoService { -// @Autowired -// private MybatisSqlExecuteService sqlExecuteService; -// //鑾峰彇璁惧鏌愭璁板綍璇︾粏鐨勫崟浣撴斁鐢佃繃绋� -// public List<BattLithiumTestData> getTdataById(Integer devId, Integer testRecordCount) { -// String sql="select * from db_batt_testdata.tb_batttestdata_" +devId -// +" where need_test=1 and test_record_count="+testRecordCount+" "; -// sql+=" ORDER BY record_num asc "; -// List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { -// @Override -// public List getResults(ResultSet rs) throws SQLException { -// List<BattLithiumTestData> list=new ArrayList<>(); -// while (rs.next()){ -// BattLithiumTestData tdata=new BattLithiumTestData(); -// tdata.setNum(rs.getInt("num")); -// tdata.setDevId(rs.getInt("dev_id")); -// tdata.setBattIdx(rs.getInt("batt_idx")); -// tdata.setTestRecordCount(rs.getInt("test_record_count")); -// tdata.setTestType(rs.getInt("test_type")); -// tdata.setRecordNum(rs.getInt("record_num")); -// tdata.setTestStarttime(rs.getTimestamp("test_starttime")); -// tdata.setRecordTime(rs.getTimestamp("record_time")); -// tdata.setTestTimelong(rs.getInt("test_timelong")); -// tdata.setGroupVol(rs.getDouble("group_vol")); -// tdata.setTestCurr(rs.getDouble("test_curr")); -// tdata.setTestCap(rs.getDouble("test_cap")); -// tdata.setMonNum(rs.getInt("mon_num")); -// tdata.setMonVol(rs.getDouble("mon_vol")); -// tdata.setMonTmp(rs.getDouble("mon_tmp")); -// tdata.setMonCurr(rs.getDouble("mon_curr")); -// tdata.setMonCap(rs.getDouble("mon_cap")); -// tdata.setMonWh(rs.getDouble("mon_wh")); -// tdata.setMonState(rs.getString("mon_state")); -// tdata.setMonFault(rs.getString("mon_fault")); -// tdata.setNeedTest(rs.getInt("need_test")); -// list.add(tdata); -// } -// return list; -// } -// }); -// return list; -// } -// -// //鑾峰彇璁惧鏌愭璁板綍璇︾粏鐨勫崟浣撴斁鐢佃繃绋� -// public List<BattLithiumTestData> getTdataByIdWithListA200(Integer devId, Integer testRecordCount) { -// String sql="select * from db_lithium_testdata.tb_batttestdata_" +devId -// +" where need_test=1 and test_record_count="+testRecordCount+" "; -// sql+=" ORDER BY record_num asc "; -// List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { -// @Override -// public List getResults(ResultSet rs) throws SQLException { -// List list=new ArrayList<>(); -// List<Float> monVols=null; -// List<Integer> monNums=null; -// BattLithiumTestData tdata=null; -// int num=0; -// try { -// while (rs.next()){ -// int monNum=rs.getInt("mon_num"); -// float monvol=rs.getFloat("mon_vol"); -// int recordNum=rs.getInt("record_num"); -// if(num!=recordNum){ -// if(num!=0){ -// tdata.setMonVols(monVols); -// tdata.setMonNums(monNums); -// list.add(tdata); -// } -// tdata=new BattLithiumTestData(); -// monVols=new ArrayList<>(); -// monNums=new ArrayList<>(); -// tdata.setDevId(rs.getInt("dev_id")); -// tdata.setBattIdx(rs.getInt("batt_idx")); -// tdata.setTestRecordCount(rs.getInt("test_record_count")); -// tdata.setTestType(rs.getInt("test_type")); -// tdata.setRecordNum(recordNum); -// tdata.setTestStarttime(rs.getTimestamp("test_starttime")); -// tdata.setRecordTime(rs.getTimestamp("record_time")); -// tdata.setTestTimelong(rs.getInt("test_timelong")); -// tdata.setGroupVol(rs.getDouble("group_vol")); -// tdata.setTestCurr(rs.getDouble("test_curr")); -// tdata.setTestCap(rs.getDouble("test_cap")); -// tdata.setNeedTest(rs.getInt("need_test")); -// tdata.setMaxTemp(rs.getFloat("max_temp")); -// tdata.setMinTemp(rs.getFloat("min_temp")); -// num=recordNum; -// } -// monVols.add(monvol); -// monNums.add(monNum); -// } -// tdata.setMonVols(monVols); -// tdata.setMonNums(monNums); -// list.add(tdata); -// } catch (SQLException e) { -// e.printStackTrace(); -// } -// return list; -// } -// }); -// return list; -// } -// //鏌ヨDevAlm鍘嗗彶鍛婅鏁伴噺 -// public int getCountForDevAlm(DevA200AlarmDto dto) { -// String sql="select count(distinct num) as number from db_alarm." +dto.getTableName() -// +" where 1=1 "; -// -// if(dto.getStartTime()!=null){ -// sql+=" and alm_starttime >='"+ ThreadLocalUtil.format(dto.getStartTime(),1)+"' "; -// } -// if(dto.getEndTime()!=null){ -// sql+=" and alm_endtime <='"+ThreadLocalUtil.format(dto.getEndTime(),1)+"' "; -// } -// if(dto.getDevType()!=null){ -// sql+=" and FLOOR(dev_id/100000000)="+dto.getDevType(); -// } -// if(dto.getDevId()!=null){ -// sql+=" and dev_id="+dto.getDevId(); -// } -// if(dto.getAlmId()!=null){ -// sql+=" and alm_id="+dto.getAlmId(); -// } -// sql+=" and dev_id in (" + -// " SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr" + -// " where tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id" + -// " and uid="+dto.getUid()+ -// ")"; -// sql+=" order by alm_starttime desc "; -// List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { -// @Override -// public List getResults(ResultSet rs) throws SQLException { -// LinkedList<Object> temp = new LinkedList<>(); -// try { -// while (rs.next()) -// temp.add(rs.getInt("number")); -// } catch (SQLException e) { -// e.printStackTrace(); -// } -// return temp; -// } -// }); -// int num =0; -// if(list!=null){ -// num= (int) list.get(0); -// } -// return num; -// } -// //鏌ヨdevalm鍘嗗彶鍛婅 -// public List getListDevAlm(DevA200AlarmDto dto){ -// String sql="select * from db_alarm." +dto.getTableName() -// +" where 1=1 "; -// -// if(dto.getStartTime()!=null){ -// sql+=" and alm_starttime >='"+ ThreadLocalUtil.format(dto.getStartTime(),1)+"' "; -// } -// if(dto.getEndTime()!=null){ -// sql+=" and alm_endtime <='"+ThreadLocalUtil.format(dto.getEndTime(),1)+"' "; -// } -// if(dto.getDevType()!=null){ -// sql+=" and FLOOR(dev_id/100000000)="+dto.getDevType(); -// } -// if(dto.getDevId()!=null){ -// sql+=" and dev_id="+dto.getDevId(); -// } -// if(dto.getAlmId()!=null){ -// sql+=" and alm_id="+dto.getAlmId(); -// } -// sql+=" and dev_id in (" + -// " SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr" + -// " where tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id" + -// " and uid="+dto.getUid()+ -// ")"; -// sql+=" ORDER BY alm_starttime desc limit "+dto.getLimitStart()+","+dto.getLimitEnd()+" "; -// List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { -// @Override -// public List getResults(ResultSet rs) throws SQLException { -// List<DevLithiumAlarmDataYear> list=new ArrayList<>(); -// while (rs.next()){ -// DevLithiumAlarmDataYear dataYear=new DevLithiumAlarmDataYear(); -// dataYear.setNum(rs.getInt("num")); -// dataYear.setDevId(rs.getInt("dev_id")); -// dataYear.setAlmId(rs.getInt("alm_id")); -// dataYear.setAlmSignalId(rs.getInt("alm_signal_id")); -// dataYear.setAlmStarttime(rs.getTimestamp("alm_starttime")); -// dataYear.setAlmValue(rs.getFloat("alm_value")); -// dataYear.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); -// dataYear.setConfirmedUid(rs.getInt("confirmed_uid")); -// dataYear.setConfirmedTime(rs.getTimestamp("confirmed_time")); -// dataYear.setAlmEndtime(rs.getTimestamp("alm_endtime")); -// dataYear.setAlmClearedType(rs.getInt("alm_cleared_type")); -// list.add(dataYear); -// } -// return list; -// } -// }); -// return list; -// } -// -// -// public List<BattLithiumTestData> getTdataByIdWithListActm(Integer devId, Integer testRecordCount) { -// String sql="select * from db_batt_testdata.tb_batttestdata_" +devId -// +" where need_test=1 and test_record_count="+testRecordCount+" "; -// sql+=" ORDER BY record_num asc "; -// List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { -// @Override -// public List getResults(ResultSet rs) throws SQLException { -// List list=new ArrayList<>(); -// List<Float> monVols=null; -// List<Float> monCurrs=null; -// List<Float> monCaps=null; -// List<Float> monWhs=null; -// List<Integer> monNums=null; -// BattLithiumTestData tdata=null; -// int num=0; -// try { -// while (rs.next()){ -// int monNum=rs.getInt("mon_num"); -// float monvol=rs.getFloat("mon_vol"); -// float monCurr=rs.getFloat("mon_curr"); -// float monCap=rs.getFloat("mon_cap"); -// float monWh=rs.getFloat("mon_wh"); -// int recordNum=rs.getInt("record_num"); -// -// if(num!=recordNum){ -// if(num!=0){ -// tdata.setMonVols(monVols); -// tdata.setMonNums(monNums); -// tdata.setMonCurrs(monCurrs); -// tdata.setMonCaps(monCaps); -// tdata.setMonWhs(monWhs); -// list.add(tdata); -// } -// tdata=new BattLithiumTestData(); -// monVols=new ArrayList<>(); -// monNums=new ArrayList<>(); -// monCurrs=new ArrayList<>(); -// monCaps=new ArrayList<>(); -// monWhs=new ArrayList<>(); -// tdata.setDevId(rs.getInt("dev_id")); -// tdata.setBattIdx(rs.getInt("batt_idx")); -// tdata.setTestRecordCount(rs.getInt("test_record_count")); -// tdata.setTestType(rs.getInt("test_type")); -// tdata.setRecordNum(recordNum); -// tdata.setTestStarttime(rs.getTimestamp("test_starttime")); -// tdata.setRecordTime(rs.getTimestamp("record_time")); -// tdata.setTestTimelong(rs.getInt("test_timelong")); -// tdata.setGroupVol(rs.getDouble("group_vol")); -// tdata.setTestCurr(rs.getDouble("test_curr")); -// tdata.setTestCap(rs.getDouble("test_cap")); -// tdata.setNeedTest(rs.getInt("need_test")); -// tdata.setMonTmp(rs.getDouble("mon_tmp")); -// num=recordNum; -// } -// monVols.add(monvol); -// monNums.add(monNum); -// monCurrs.add(monCurr); -// monCaps.add(monCap); -// monWhs.add(monWh); -// } -// -// tdata.setMonVols(monVols); -// tdata.setMonNums(monNums); -// tdata.setMonCurrs(monCurrs); -// tdata.setMonCaps(monCaps); -// tdata.setMonWhs(monWhs); -// list.add(tdata); -// } catch (SQLException e) { -// e.printStackTrace(); -// } -// return list; -// } -// }); -// return list; -// } -//} +package com.whyc.service; + +import com.whyc.dto.AlmHis.BattAlmPar; +import com.whyc.dto.AlmHis.DevAlmPar; +import com.whyc.dto.AlmHis.PwrAlmPar; +import com.whyc.dto.Real.*; +import com.whyc.mapper.CallBack; +import com.whyc.pojo.db_alarm.BattalarmDataHistory; +import com.whyc.pojo.db_alarm.DevalarmDataHistory; +import com.whyc.pojo.db_batt_testdata.BatttestdataId; +import com.whyc.pojo.db_data_history.BattRealdataId; +import com.whyc.pojo.db_data_history.PwrdevHistorydataId; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmHistory; +import com.whyc.util.ThreadLocalUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +@Service +public class SubTablePageInfoService { + @Autowired + private MybatisSqlExecuteService sqlExecuteService; + + + + //鑾峰彇鐢垫睜缁勫巻鍙插憡璀︽暟閲� + public int getBattAlmHisCount(BattAlmPar param){ + String sql="select count(distinct history.num) as number " + + " from db_alarm."+param.getRecordYear()+" history,db_station.tb_station_inf,db_station.tb_batt_inf " + + " where history.battgroup_id=tb_batt_inf.battgroup_id " + + " and tb_batt_inf.station_id=tb_station_inf.station_id " + + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and history.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and history.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_batt_inf.station_id in(" + + " select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + LinkedList<Object> temp = new LinkedList<>(); + try { + while (rs.next()) + temp.add(rs.getInt("number")); + } catch (SQLException e) { + e.printStackTrace(); + } + return temp; + } + }); + int num =0; + if(list!=null){ + num= (int) list.get(0); + } + return num; + } + //鑾峰彇鐢垫睜缁勫巻鍙插憡璀﹂泦鍚� + public List<BattalarmDataHistory> getBattAlmHisList(BattAlmPar param){ + String sql="select history.battgroup_id,history.num,alm_signal_id,history.mon_num,alm_value,alm_level,alm_is_confirmed,alm_confirmed_time,alm_start_time,alm_end_time,alm_severity " + + " ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_batt_inf.battgroup_name " + + " from db_alarm."+param.getRecordYear()+" history,db_station.tb_station_inf,db_station.tb_batt_inf " + + " where history.battgroup_id=tb_batt_inf.battgroup_id " + + " and tb_batt_inf.station_id=tb_station_inf.station_id " + + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and history.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and history.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_batt_inf.station_id in(" + + " select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + sql+=" order by history.alm_start_time desc,history.battgroup_id asc,history.mon_num asc limit "+param.getLimitStart()+","+param.getLimitEnd()+" "; + + /*List<BattAlarmRes> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BattAlarmRes> list=new ArrayList<>(); + int id=0; + int i=0; + List dataList=new ArrayList(); + BattAlarmRes ph=new BattAlarmRes(); + while (rs.next()){ + int battGroupId=rs.getInt("battgroup_id"); + if(battGroupId!=id){ + ph.setAdataHs(dataList); + dataList=new ArrayList(); + } + BattalarmDataHistory data=new BattalarmDataHistory(); + data.setNum(rs.getLong("num")); + data.setBattgroupId(rs.getInt("battgroup_id")); + data.setAlmSignalId(rs.getInt("alm_signal_id")); + data.setMonNum(rs.getInt("mon_num")); + data.setAlmValue(rs.getFloat("alm_value")); + data.setAlmLevel(rs.getInt("alm_level")); + data.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); + data.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); + data.setAlmStartTime(rs.getTimestamp("alm_start_time")); + data.setAlmEndTime(rs.getTimestamp("alm_end_time")); + data.setAlmSeverity(rs.getInt("alm_severity")); + dataList.add(data); + if(battGroupId!=id){ + if(i!=0){ + list.add(ph); + } + id=battGroupId; + ph=new BattAlarmRes(); + ph.setBattgroupId(battGroupId); + ph.setStationName(rs.getString("station_name")); + ph.setProvice(rs.getString("provice")); + ph.setCity(rs.getString("city")); + ph.setCountry(rs.getString("country")); + ph.setBattGroupName(rs.getString("battgroup_name")); + } + if(rs.isLast()){ + ph.setAdataHs(dataList); + list.add(ph); + } + i++; + } + return list; + } + });*/ + List<BattalarmDataHistory> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BattalarmDataHistory> list=new ArrayList<>(); + while (rs.next()){ + BattalarmDataHistory data=new BattalarmDataHistory(); + data.setNum(rs.getLong("num")); + data.setBattgroupId(rs.getInt("battgroup_id")); + data.setAlmSignalId(rs.getInt("alm_signal_id")); + data.setMonNum(rs.getInt("mon_num")); + data.setAlmValue(rs.getFloat("alm_value")); + data.setAlmLevel(rs.getInt("alm_level")); + data.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); + data.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); + data.setAlmStartTime(rs.getTimestamp("alm_start_time")); + data.setAlmEndTime(rs.getTimestamp("alm_end_time")); + data.setAlmSeverity(rs.getInt("alm_severity")); + data.setBattgroupId(rs.getInt("battgroup_id")); + data.setStationName(rs.getString("station_name")); + data.setProvice(rs.getString("provice")); + data.setCity(rs.getString("city")); + data.setCountry(rs.getString("country")); + data.setBattgroupName(rs.getString("battgroup_name")); + list.add(data); + } + return list; + } + }); + return list; + } + + //鑾峰彇璁惧鍘嗗彶鍛婅鏁伴噺 + public int getDevAlmHisCount(DevAlmPar param){ + String sql="SELECT count(distinct history.num) as number FROM db_alarm."+param.getRecordYear()+" history,db_station.tb_batt_inf,db_station.tb_station_inf " + + " where history.dev_id=tb_batt_inf.dev_id "+ + " and tb_batt_inf.station_id=tb_station_inf.station_id "+ + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and history.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and history.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_batt_inf.station_id in(" + + " select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + LinkedList<Object> temp = new LinkedList<>(); + try { + while (rs.next()) + temp.add(rs.getInt("number")); + } catch (SQLException e) { + e.printStackTrace(); + } + return temp; + } + }); + int num =0; + if(list!=null){ + num= (int) list.get(0); + } + return num; + } + //鑾峰彇璁惧鍘嗗彶鍛婅闆嗗悎 + public List getDevAlmHisList(DevAlmPar param){ + String sql="SELECT history.*, " + + " tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_batt_inf.dev_name " + + " FROM db_alarm."+param.getRecordYear()+" history,db_station.tb_batt_inf,db_station.tb_station_inf " + + " where history.dev_id=tb_batt_inf.dev_id "+ + " and tb_batt_inf.station_id=tb_station_inf.station_id "+ + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and history.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and history.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_batt_inf.station_id in(" + + " select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + sql+=" order by history.alm_start_time desc,history.dev_id asc limit "+param.getLimitStart()+","+param.getLimitEnd()+" "; + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<DevalarmDataHistory> list=new ArrayList<>(); + while (rs.next()){ + DevalarmDataHistory ph=new DevalarmDataHistory(); + ph.setNum(rs.getLong("num")); + ph.setDevId(rs.getInt("dev_id")); + ph.setDevIp(rs.getString("dev_ip")); + ph.setAlmId(rs.getInt("alm_id")); + ph.setAlmLevel(rs.getInt("alm_level")); + ph.setAlmStartTime(rs.getTimestamp("alm_start_time")); + ph.setAlmEndTime(rs.getTimestamp("alm_end_time")); + ph.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); + ph.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); + ph.setAlmClearedType(rs.getInt("alm_cleared_type")); + ph.setDevName(rs.getString("dev_name")); + ph.setStationName(rs.getString("station_name")); + ph.setProvice(rs.getString("provice")); + ph.setCity(rs.getString("city")); + ph.setCountry(rs.getString("country")); + list.add(ph); + } + return list; + } + }); + return list; + } + //鐢垫簮鍘嗗彶鍛婅鏁� + public int getPwrAlmHisCount(PwrAlmPar param){ + String sql="select count(distinct alarm.num) as number from db_pwrdev_alarm."+param.getRecordYear()+" alarm" + + ",db_station.tb_power_inf,db_station.tb_station_inf " + + " where alarm.power_id = tb_power_inf.power_id " + + " and tb_power_inf.station_id=tb_station_inf.station_id "+ + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and alarm.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and alarm.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_power_inf.power_id in(" + + " select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + LinkedList<Object> temp = new LinkedList<>(); + try { + while (rs.next()) + temp.add(rs.getInt("number")); + } catch (SQLException e) { + e.printStackTrace(); + } + return temp; + } + }); + int num =0; + if(list!=null){ + num= (int) list.get(0); + } + return num; + } + //鐢垫簮鍘嗗彶鍛婅闆嗗悎 + public List<PwrdevAlarmHistory> getPwrAlmHisList(PwrAlmPar param){ + String sql="select alarm.*," + + " tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_power_inf.power_name " + + " from db_pwrdev_alarm."+param.getRecordYear()+" alarm" + + ",db_station.tb_power_inf,db_station.tb_station_inf " + + " where alarm.power_id = tb_power_inf.power_id " + + " and tb_power_inf.station_id=tb_station_inf.station_id "+ + " and alm_start_time>='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' " ; + if(param.getProvice()!=null){ + sql+=" and tb_station_inf.provice='"+param.getProvice()+"' "; + } + if(param.getCity()!=null){ + sql+=" and tb_station_inf.city='"+param.getCity()+"' "; + } + if(param.getCountry()!=null){ + sql+=" and tb_station_inf.country='"+param.getCountry()+"' "; + } + if(param.getStationName()!=null){ + sql+=" and tb_station_inf.station_name like '%"+param.getStationName()+"%' "; + } + if(param.getAlmLevel()!=null){ + sql+=" and alarm.alm_level="+param.getAlmLevel()+" "; + } + List<Integer> almIds=param.getAlmIds(); + if(almIds!=null&&almIds.size()>0){ + sql+=" and alarm.alm_id in ( "; + for (int i=0;i<almIds.size();i++) { + sql+=almIds.get(i); + if(i!=(almIds.size()-1)){ + sql+=","; + } + } + sql+=")"; + } + if(param.getUid()>100){ + sql+=" and tb_power_inf.power_id in(" + + " select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr " + + " where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id " + + " and tb_baojigroup_usr.uid="+param.getUid()+ + " )"; + } + sql+="order by alarm.alm_start_time desc limit "+param.getLimitStart()+","+param.getLimitEnd()+" "; + List<PwrdevAlarmHistory> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<PwrdevAlarmHistory> list=new ArrayList<>(); + while (rs.next()){ + PwrdevAlarmHistory ph=new PwrdevAlarmHistory(); + ph.setNum(rs.getLong("num")); + ph.setPowerId(rs.getInt("power_id")); + ph.setAlmId(rs.getInt("alm_id")); + ph.setPowerName(rs.getString("power_name")); + ph.setAlmLevel(rs.getInt("alm_level")); + ph.setAlmStartTime(rs.getTimestamp("alm_start_time")); + ph.setAlmEndTime(rs.getTimestamp("alm_end_time")); + ph.setAlmValue(rs.getFloat("alm_value")); + ph.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); + ph.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); + ph.setAlmClearedType(rs.getInt("alm_cleared_type")); + ph.setUsrId(rs.getInt("usr_Id")); + ph.setAlmTrigger(rs.getInt("alm_trigger")); + ph.setAlmSeverity(rs.getInt("alm_severity")); + ph.setStationName(rs.getString("station_name")); + ph.setProvice(rs.getString("provice")); + ph.setCity(rs.getString("city")); + ph.setCountry(rs.getString("country")); + list.add(ph); + } + return list; + } + }); + return list; + } + //鑾峰彇鐢垫睜缁勬煇涓�骞存湀鐨勬暟鎹� + public List<QuarterDto> getBattRealHis(String tableName, String columnName) { + String sql="select distinct mon_num,record_time,"+columnName+" from "+tableName+" order by record_time asc"; + List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<QuarterDto> list=new ArrayList<>(); + while (rs.next()){ + QuarterDto data=new QuarterDto(); + data.setRecordTime(rs.getTimestamp("record_time")); + data.setNumValue(rs.getFloat(columnName)); + data.setMonNum(rs.getInt("mon_num")); + list.add(data); + } + return list; + } + }); + return list; + } + //鑾峰彇琛ㄤ腑鏈�澶э紝鏈�灏忥紝骞冲潎鏁版嵁鍊� + public CompareDto getBattCompareHis(String tableName, String columnName) { + String sql="select max("+columnName+") as maxData,min("+columnName+") as minData,avg("+columnName+") as avgData"+" from "+tableName; + List<CompareDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<CompareDto> list=new ArrayList<>(); + while (rs.next()){ + CompareDto data=new CompareDto(); + data.setMaxData(rs.getFloat("maxData")); + data.setMinData(rs.getFloat("minData")); + data.setAvgData(rs.getFloat("avgData")); + list.add(data); + } + return list; + } + }); + if(list!=null&&list.size()>0){ + return list.get(0); + }else { + return null; + } + } + //鑾峰彇鍐呴樆鏁版嵁 + public List<QuarterDto> getBattResInfData(Integer battgroupId,Integer testRecordCount) { + String sql="select distinct mon_num,test_starttime,mon_res, from db_batt_testdata.tb_battresdata_"+battgroupId + +" where test_record_count="+testRecordCount+" order by mon_num asc"; + List<QuarterDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<QuarterDto> list=new ArrayList<>(); + while (rs.next()){ + QuarterDto data=new QuarterDto(); + data.setMonNum(rs.getInt("mon_num")); + data.setNumValue(rs.getFloat("mon_res")); + data.setRecordTime(rs.getTimestamp("test_starttime")); + list.add(data); + } + return list; + } + }); + return list; + } + //鎵捐繖娆℃斁鐢电殑鎸囧畾涓�绗旀暟鎹� + public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) { + String sql="select distinct * from db_batt_testdata.tb_batttestdata_"+battgroupId + +" where test_record_count="+testRecordCount+" and record_num="+recordNum+ " order by mon_num asc"; + List<BatttestdataId> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BatttestdataId> list=new ArrayList<>(); + while (rs.next()){ + BatttestdataId data=new BatttestdataId(); + data.setBattgroupId(rs.getInt("battgroup_id")); + data.setTestRecordCount(rs.getInt("test_record_count")); + data.setTestStarttime(rs.getTimestamp("test_starttime")); + data.setOnlineVol(rs.getFloat("online_vol")); + data.setGroupVol(rs.getFloat("group_vol")); + data.setTestCurr(rs.getFloat("test_curr")); + data.setTestCap(rs.getFloat("test_cap")); + data.setMonNum(rs.getInt("mon_num")); + data.setMonVol(rs.getFloat("mon_vol")); + data.setMonRes(rs.getFloat("mon_res")); + data.setMonTmp(rs.getFloat("mon_tmp")); + list.add(data); + } + return list; + } + }); + return list; + } + //绯荤粺姒傝鑾峰彇鍗婂皬鏃舵牳瀹硅澶囦俊鎭�(缁勭淇℃伅鍙栦竴涓崟浣撲俊鎭嵆鍙�) + public List<BattHisRealDto> getHalfHourBattDevData(String tableName,Integer granularity,String halfHourAgoTime) { + String sql="select distinct mon_num,record_time,group_vol,online_vol,group_curr,group_tmp,load_curr " + + "from (select a.*, (@i:= @i+1) as number " + + " from (select * from "+tableName+" "+ + " where record_time>='"+halfHourAgoTime+"' and mon_num=1) a, " + + " (select @i:=0) b) c "+ + " where c.number%"+granularity+"=0 or c.number=1 "; + sql+=" order by record_time asc"; + List<BattHisRealDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BattHisRealDto> list=new ArrayList<>(); + while (rs.next()){ + BattHisRealDto data=new BattHisRealDto(); + data.setRecordTime(rs.getTimestamp("record_time")); + data.setGroupVol(rs.getFloat("group_vol")); + data.setOnlineVol(rs.getFloat("online_vol")); + data.setGroupCurr(rs.getFloat("group_curr")); + data.setGroupTmp(rs.getFloat("group_tmp")); + data.setLoadCurr(rs.getFloat("load_curr")); + list.add(data); + } + return list; + } + }); + return list; + } + //绯荤粺姒傝鑾峰彇鍗婂皬鏃朵氦娴佽緭鍏ョ粺璁� + public List<PwrHisRealAcInDto> getHalfHourPwrHisAcinData(String tableName,Integer granularity,String halfHourAgoTime) { + String sql="select distinct record_datetime,acin1_vola,acin1_volb,acin1_volc,acin2_vola,acin2_volb,acin2_volc " + + ",acin1_curra,acin1_currb,acin1_currc,acin2_curra,acin2_currb,acin2_currc " + + "from (select a.*, (@i:= @i+1) as number " + + " from (select * from "+tableName+" "+ + " where record_datetime>='"+halfHourAgoTime+"') a, " + + " (select @i:=0) b) c "+ + " where c.number%"+granularity+"=0 or c.number=1 "; + sql+=" order by record_datetime asc"; + List<PwrHisRealAcInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<PwrHisRealAcInDto> list=new ArrayList<>(); + while (rs.next()){ + PwrHisRealAcInDto data=new PwrHisRealAcInDto(); + data.setRecordDatetime(rs.getTimestamp("record_datetime")); + data.setAcin1Vola(rs.getFloat("acin1_vola")); + data.setAcin1Volb(rs.getFloat("acin1_volb")); + data.setAcin1Volc(rs.getFloat("acin1_volc")); + data.setAcin2Vola(rs.getFloat("acin2_vola")); + data.setAcin2Volb(rs.getFloat("acin2_volb")); + data.setAcin2Volc(rs.getFloat("acin2_volc")); + data.setAcin1Curra(rs.getFloat("acin1_curra")); + data.setAcin1Currb(rs.getFloat("acin1_currb")); + data.setAcin1Currc(rs.getFloat("acin1_currc")); + data.setAcin2Curra(rs.getFloat("acin2_curra")); + data.setAcin2Currb(rs.getFloat("acin2_currb")); + data.setAcin2Currc(rs.getFloat("acin2_currc")); + list.add(data); + } + return list; + } + }); + return list; + } + + public List<PwrHisRealDcoutInDto> getHalfHourPwrHisDcoutData(String tableName,Integer granularity,String halfHourAgoTime) { + String sql="select distinct * " + + "from (select a.*, (@i:= @i+1) as number " + + " from (select * from "+tableName+" "+ + " where record_datetime>='"+halfHourAgoTime+"') a, " + + " (select @i:=0) b) c "+ + " where c.number%"+granularity+"=0 or c.number=1 "; + sql+=" order by record_datetime asc"; + List<PwrHisRealDcoutInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<PwrHisRealDcoutInDto> list=new ArrayList<>(); + while (rs.next()){ + PwrHisRealDcoutInDto data=new PwrHisRealDcoutInDto(); + data.setRecordDatetime(rs.getTimestamp("record_datetime")); + data.setMOutputvol(rs.getFloat("m_outputvol")); + data.setM1Outcurr(rs.getFloat("m1_outcurr")); + data.setM2Outcurr(rs.getFloat("m2_outcurr")); + data.setM3Outcurr(rs.getFloat("m3_outcurr")); + data.setM4Outcurr(rs.getFloat("m4_outcurr")); + data.setM5Outcurr(rs.getFloat("m5_outcurr")); + data.setM6Outcurr(rs.getFloat("m6_outcurr")); + data.setM7Outcurr(rs.getFloat("m7_outcurr")); + data.setM8Outcurr(rs.getFloat("m8_outcurr")); + data.setM9Outcurr(rs.getFloat("m9_outcurr")); + data.setM10Outcurr(rs.getFloat("m10_outcurr")); + data.setM11Outcurr(rs.getFloat("m11_outcurr")); + data.setM12Outcurr(rs.getFloat("m12_outcurr")); + data.setM13Outcurr(rs.getFloat("m13_outcurr")); + data.setM14Outcurr(rs.getFloat("m14_outcurr")); + data.setM15Outcurr(rs.getFloat("m15_outcurr")); + data.setM16Outcurr(rs.getFloat("m16_outcurr")); + data.setM1OutVol(rs.getFloat("m1_out_vol")); + data.setM2OutVol(rs.getFloat("m2_out_vol")); + data.setM3OutVol(rs.getFloat("m3_out_vol")); + data.setM4OutVol(rs.getFloat("m4_out_vol")); + data.setM5OutVol(rs.getFloat("m5_out_vol")); + data.setM6OutVol(rs.getFloat("m6_out_vol")); + data.setM7OutVol(rs.getFloat("m7_out_vol")); + data.setM8OutVol(rs.getFloat("m8_out_vol")); + data.setM9OutVol(rs.getFloat("m9_out_vol")); + data.setM10OutVol(rs.getFloat("m10_out_vol")); + data.setM11OutVol(rs.getFloat("m11_out_vol")); + data.setM12OutVol(rs.getFloat("m12_out_vol")); + data.setM13OutVol(rs.getFloat("m13_out_vol")); + data.setM14OutVol(rs.getFloat("m14_out_vol")); + data.setM15OutVol(rs.getFloat("m15_out_vol")); + data.setM16OutVol(rs.getFloat("m16_out_vol")); + list.add(data); + } + return list; + } + }); + return list; + } + //鍘嗗彶娴嬭瘯璁板綍鍏蜂綋鏌愪竴娆℃斁鐢垫暟鎹鎯� + public List<BatttestdataId> getTinfDataWithTestRecordCount(String tableName, Integer testRecordCount, Integer recordNum, Integer granularity) { + String sql="select distinct * from "+tableName+" "+ + " where test_record_count="+testRecordCount+" " + + " and record_num%"+granularity+"=0 or record_num=1 or record_num="+recordNum; + sql+=" order by record_time asc"; + List<BatttestdataId> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BatttestdataId> list=new ArrayList<>(); + while (rs.next()){ + BatttestdataId data=new BatttestdataId(); + data.setNum(rs.getInt("num")); + data.setBattgroupId(rs.getInt("battgroup_id")); + data.setTestRecordCount(rs.getInt("test_record_count")); + data.setTestType(rs.getInt("test_type")); + data.setRecordNum(rs.getInt("record_num")); + data.setDataNew(rs.getInt("data_new")); + data.setDataAvailable(rs.getInt("data_available")); + data.setTestTimelong(rs.getInt("test_timelong")); + data.setTestCurr(rs.getFloat("test_curr")); + data.setTestCap(rs.getFloat("test_cap")); + data.setMonNum(rs.getInt("mon_num")); + data.setMonVol(rs.getFloat("mon_vol")); + data.setMonTmp(rs.getFloat("mon_tmp")); + data.setMonRes(rs.getFloat("mon_res")); + data.setTestStarttime(rs.getTimestamp("test_starttime")); + data.setRecordTime(rs.getTimestamp("record_time")); + data.setGroupVol(rs.getFloat("group_vol")); + data.setOnlineVol(rs.getFloat("online_vol")); + list.add(data); + } + return list; + } + }); + return list; + } + //鍒ゆ柇鍘嗗彶瀹炴椂琛ㄦ槸鍚﹀瓨鍦� + public int judgeTable_realdata( String table){ + String sql="select count(*) as tableNum " + + " from INFORMATION_SCHEMA.TABLES " + + " where TABLE_SCHEMA = 'db_data_history' " + + " and TABLE_NAME = 'tb_batt_realdata_"+table+"'"; + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + LinkedList<Object> temp = new LinkedList<>(); + try { + while (rs.next()) + temp.add(rs.getInt("tableNum")); + } catch (SQLException e) { + e.printStackTrace(); + } + return temp; + } + }); + int tableNum =0; + if(list!=null){ + tableNum= (int) list.get(0); + } + return tableNum; + } + + //鐢垫睜鏁版嵁鍘嗗彶瀹炴椂澶勭悊 + public List<RealDateDTO> getBattRealDataHis(BattRealdataId realdata, int granularity,Integer maxRecordNum,Integer minRecordNum) { + String sql=" select record_time, group_vol, online_vol,group_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + + " from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " + + " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + + " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' "+ + " and (record_num-"+minRecordNum+")%"+granularity+"=0 or record_num="+maxRecordNum+" or record_num="+minRecordNum ; + List<RealDateDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<RealDateDTO> list=new ArrayList<>(); + while (rs.next()){ + RealDateDTO ph=new RealDateDTO(); + ph.setRecordTime(rs.getTimestamp("record_time")); + ph.setGroupVol(rs.getFloat("group_vol")); + ph.setOnlineVol(rs.getFloat("online_vol")); + ph.setGroupCurr(rs.getFloat("group_curr")); + ph.setMonVol(rs.getFloat("mon_vol")); + ph.setMonTmp(rs.getFloat("mon_tmp")); + ph.setMonRes(rs.getFloat("mon_res")); + ph.setMonNum(rs.getInt("mon_num")); + ph.setRecordNum(rs.getInt("record_num")); + list.add(ph); + } + return list; + } + }); + return list; + } + //鑾峰彇鎸囧畾鏃堕棿娈靛唴鏈�澶ф渶灏弐ecordNum纭繚鏁版嵁鐨勫畬鏁� + public List getMaxAndMinRecordNum(BattRealdataId realdata) { + String sql="select max(record_num) as maxRecordNum,min(record_num) as minRecordNum " + + " from db_data_history.tb_batt_realdata_" + realdata.getTableName()+" " + + " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + + " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' " + + " limit 1"; + List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List list = new ArrayList<>(); + while (rs.next()) { + list.add(rs.getInt("maxRecordNum")); + list.add(rs.getInt("minRecordNum")); + } + return list; + } + }); + return list; + } +} diff --git a/src/main/java/com/whyc/util/ActionUtil.java b/src/main/java/com/whyc/util/ActionUtil.java index 257a21c..3b2bd86 100644 --- a/src/main/java/com/whyc/util/ActionUtil.java +++ b/src/main/java/com/whyc/util/ActionUtil.java @@ -3,7 +3,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; -import com.whyc.pojo.db_user.User; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -18,11 +17,11 @@ import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; +import java.time.LocalDate; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.whyc.pojo.db_user.User; public class ActionUtil { @@ -417,8 +416,34 @@ } else {//鐩哥瓑 return 0; } - } - /** + } + //璁$畻褰撳墠鏈堢殑涓婁竴涓搴﹀勾_鏈堜唤闆嗗悎 + public static List<String> getLastQuarterYearMonths() { + LocalDate currentDate = LocalDate.now(); + int currentYear = currentDate.getYear(); + int currentMonth = currentDate.getMonthValue(); + + int quarter = (currentMonth - 1) / 3 + 1; // 璁$畻褰撳墠瀛e害 + int lastQuarter = quarter - 1; // 涓婁竴瀛e害 + + if (lastQuarter == 0) { + lastQuarter = 4; // 濡傛灉褰撳墠鏄涓�瀛e害锛屽垯涓婁竴瀛e害涓虹鍥涘搴� + } + + List<String> yearMonths = new ArrayList<>(); + for (int i = 1; i <= 3; i++) { + int month = (lastQuarter - 1) * 3 + i; + int year = currentYear; + // 濡傛灉涓婁竴瀛e害鏄鍥涘搴︼紝鍒欏勾浠介渶瑕佸噺涓�骞� + if (lastQuarter == 4) { + year = currentYear - 1; + } + yearMonths.add(year + "_" + (month < 10 ? "0" + month : month)); // 淇濊瘉鏈堜唤涓轰袱浣嶆牸寮� + } + + return yearMonths; + } + /** * @Description: 鏍规嵁鍥剧墖鍦板潃杞崲涓篵ase64缂栫爜瀛楃涓� * @Author: * @CreateTime: diff --git a/src/main/java/com/whyc/util/CommonUtil.java b/src/main/java/com/whyc/util/CommonUtil.java index 4145c80..f876076 100644 --- a/src/main/java/com/whyc/util/CommonUtil.java +++ b/src/main/java/com/whyc/util/CommonUtil.java @@ -40,10 +40,10 @@ String baseDirPath; if(YamlProperties.runModel == 1) { //寮�鍙戣矾寰� - baseDirPath = jarFile.getParentFile().toString()+File.separator+"fg_file"+File.separator; + baseDirPath = jarFile.getParentFile().toString()+File.separator+"pis_file"+File.separator; }else { //鎵撳寘璺緞 - baseDirPath = jarFile.toString()+File.separator+"fg_file"+File.separator; + baseDirPath = jarFile.toString()+File.separator+"pis_file"+File.separator; } return baseDirPath; } diff --git a/src/main/java/com/whyc/util/FileUtil.java b/src/main/java/com/whyc/util/FileUtil.java index dfc3a08..e237f3c 100644 --- a/src/main/java/com/whyc/util/FileUtil.java +++ b/src/main/java/com/whyc/util/FileUtil.java @@ -1,8 +1,77 @@ package com.whyc.util; -import java.io.File; +import org.apache.commons.compress.archivers.ArchiveEntry; +import org.apache.commons.compress.archivers.ArchiveException; +import org.apache.commons.compress.archivers.ArchiveInputStream; +import org.apache.commons.compress.archivers.ArchiveStreamFactory; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; public class FileUtil { + + + public static List<String> getStaticFilePath(File file, List<String> list){ + + //濡傛灉鏄枃浠剁殑鎯呭喌 + if (file.isFile()){ + list.add(file.getAbsolutePath()); + }else{ + //濡傛灉鏄洰褰曠殑鎯呭喌 + //鍒涘缓涓�涓狥ile鏁扮粍鏉ュ瓨鍌ㄥ綋鍓嶇洰褰曚笅鎵�鏈夋枃浠跺拰鐩綍鐨勭粷瀵硅矾寰� + File[] files = file.listFiles(); + //寰幆閬嶅巻files + for (File fileTemp : files){ + if(fileTemp.getName().contains(".zip")){ + continue; + } + //瀛愮骇鏄洰褰� + if (fileTemp.isDirectory()){ + //閫掑綊鍐嶆杩涜鍒ゆ柇 + getStaticFilePath(fileTemp, list); + }else{ + //瀛愮骇鏄枃浠� + String absolutePath = fileTemp.getAbsolutePath(); + list.add(absolutePath); + //System.out.println(temp + "鏂囦欢 :" + fileTemp.getName() + "\t"); + } + } + } + return list; + } + + public static List<String> getStaticFilePathII(File file, List<String> list){ + + //濡傛灉鏄枃浠剁殑鎯呭喌 + if (file.isFile()){ + list.add(file.getAbsolutePath()); + }else{ + //濡傛灉鏄洰褰曠殑鎯呭喌 + //鍒涘缓涓�涓狥ile鏁扮粍鏉ュ瓨鍌ㄥ綋鍓嶇洰褰曚笅鎵�鏈夋枃浠跺拰鐩綍鐨勭粷瀵硅矾寰� + File[] files = file.listFiles(); + //寰幆閬嶅巻files + for (File fileTemp : files){ + //瀛愮骇鏄洰褰� + if (fileTemp.isDirectory()){ + //閫掑綊鍐嶆杩涜鍒ゆ柇 + getStaticFilePathII(fileTemp, list); + }else{ + //瀛愮骇鏄枃浠� + String absolutePath = fileTemp.getAbsolutePath(); + list.add(absolutePath); + //System.out.println(temp + "鏂囦欢 :" + fileTemp.getName() + "\t"); + } + } + } + return list; + } + public static Boolean deleteFile(File file) { //鍒ゆ柇鏂囦欢涓嶄负null鎴栨枃浠剁洰褰曞瓨鍦� if (file == null || !file.exists()) { @@ -27,4 +96,233 @@ file.delete(); return true; } + + public static void download(HttpServletResponse resp,String inFilePath,String outFileFullName){ + try { + // 杞爜闃叉涔辩爜 + //resp.addHeader("Content-Disposition", "attachment;filename=" + new String(softwareName.getBytes("UTF-8"), "ISO8859-1")); + resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode ( outFileFullName, "utf-8")); + OutputStream out = resp.getOutputStream(); + FileInputStream in = new FileInputStream(inFilePath); + int len=0; + byte[] buffer =new byte[1024]; + //7. 灏嗙紦鍐插尯涓殑鏁版嵁杈撳嚭 + while ((len=in.read(buffer))>0){ + out.write(buffer,0,len); + } + in.close(); + out.close(); + } catch (FileNotFoundException | UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static String saveFile(MultipartFile multipartFile,String fileName) throws IOException { + String rootFile = CommonUtil.getRootFile(); + + String filePath = rootFile + fileName; + File file = new File(filePath); + File parentFile = file.getParentFile(); + if(!parentFile.exists()){ + parentFile.mkdirs(); + } + //瀛樺偍 + multipartFile.transferTo(file); + return "pis_file"+fileName; + } + + /** + * 澶嶅埗鏂囦欢澶瑰唴鐨勬墍鏈夋枃浠跺埌鍙︿竴涓枃浠跺す + */ + public static void copyDirectory(File source, File destination) { + if (source.isDirectory()) { + if (!destination.exists()) { + destination.mkdir(); + } + for (File file : source.listFiles()) { + copyDirectory(file, new File(destination, file.getName())); + } + } else { + try (FileInputStream inputStream = new FileInputStream(source); + FileOutputStream outputStream = new FileOutputStream(destination)) { + byte[] buffer = new byte[1024]; + int length; + while ((length = inputStream.read(buffer)) > 0) { + outputStream.write(buffer, 0, length); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 瑙e帇N灞� + * @param compressedFileUrl doc_file/xxx/xxx.zip 鎴栬�� rar + * @return + */ + public static List<String> decompress(String compressedFileUrl) throws ArchiveException, IOException, InterruptedException { + List<Object> resList = decompressOne(compressedFileUrl); + File outputFolderFile = (File) resList.get(0); + List<String> fileList = (List<String>) resList.get(1); + boolean existCompressedFile = false; + int checkDecompress = 0; + //閬嶅巻鏂囦欢鍒楄〃锛屽垽鏂槸鍚﹀瓨鍦ㄥ帇缂╂枃浠� + for(String tempFileName:fileList){ + if(tempFileName.endsWith("zip") || tempFileName.endsWith("rar")){ + //瀛樺湪鍘嬬缉鏂囦欢,瑙e帇涓�娆� + decompressOne(tempFileName); + File file = new File(tempFileName); + //瑙i櫎鏂囦欢鍗犵敤骞跺垹闄ゆ枃浠� + //boolean delete = file.delete(); + Files.delete(file.toPath()); + existCompressedFile = true; + } + } + //濡傛灉瀛樺湪鍘嬬缉鏂囦欢骞跺凡瑙e帇,鍒欓渶瑕佹鏌ヤ竴娆℃槸鍚﹁繕鏈夊帇缂╂枃浠� + if(existCompressedFile){ + checkDecompress ++; + } + for (int i = 0; i < checkDecompress; i++) { + decompress(compressedFileUrl); + } + + List<String> finalList = new LinkedList<>(); + getStaticFilePathII(outputFolderFile,finalList); + return finalList; + } + + /** + * 瑙e帇涓�灞� + * @param compressedFileUrl doc_file/xxx/xxx.zip 鎴栬�� rar + * @return + */ + public static List<Object> decompressOne(String compressedFileUrl) throws IOException, ArchiveException, InterruptedException { + List<Object> resList = new LinkedList<>(); + String projectDir = CommonUtil.getProjectDir() + File.separator; + String fullFilePath; + String separator = File.separator; + String outputFolderSuffix; + if(compressedFileUrl.startsWith(projectDir)) { // 闈炵涓�灞傝В鍘�,宸茬粡鏄叏璺緞 + fullFilePath = compressedFileUrl; + compressedFileUrl = compressedFileUrl.substring(compressedFileUrl.indexOf("decompress")+11); + //outputFolderSuffix = compressedFileUrl.substring(0,compressedFileUrl.lastIndexOf(separator)) + separator + "decompress_" + compressedFileUrl.substring(compressedFileUrl.lastIndexOf(separator)+1); + outputFolderSuffix = compressedFileUrl +"_decompress"; + }else{ //绗竴灞傝В鍘� + fullFilePath = projectDir + compressedFileUrl; + outputFolderSuffix = compressedFileUrl.replace(separator, "@"); + } + File file = new File(fullFilePath); + + + String outputFolder = CommonUtil.getRootFile() + separator + "decompress" + separator + outputFolderSuffix; + File outputFolderFile = new File(outputFolder); + if(!outputFolderFile.exists()){ + outputFolderFile.mkdirs(); + if(compressedFileUrl.endsWith("zip")){ + decompressZip(file, outputFolder); + }else { //rar + decompressRar(file, outputFolder); + } + } + //杩斿洖鏂囦欢澶规墍鏈夋枃浠� + LinkedList<String> list = new LinkedList<>(); + getStaticFilePathII(outputFolderFile,list); + resList.add(outputFolderFile); + resList.add(list); + return resList; + } + + private static void decompressZip(File file, String outputFolder) throws IOException, ArchiveException { + ArchiveInputStream ais = new ArchiveStreamFactory("GBK").createArchiveInputStream("zip", new FileInputStream(file)); + ArchiveEntry entry; + while ((entry = ais.getNextEntry()) != null) { + if (!ais.canReadEntryData(entry) || entry.isDirectory()) { + continue; + } + byte[] buffer = new byte[4096]; + int bytesRead; + String entryName = entry.getName(); + //if(entryName.contains(File.separator)){ + if(entryName.contains("/")){ + String entryNameDir = entryName.substring(0, entryName.lastIndexOf("/")); + String entryDirStr = outputFolder + File.separator + entryNameDir; + File entryDir = new File(entryDirStr); + if(!entryDir.exists()){ + entryDir.mkdirs(); + } + } + + OutputStream outputStream = new FileOutputStream(new File(outputFolder + File.separator + entryName)); + + while ((bytesRead = ais.read(buffer)) > -1) { + outputStream.write(buffer, 0, bytesRead); + } + + //鍏虫祦 + outputStream.close(); + } + //鍏虫祦 + ais.close(); + + } + private static void decompressRar(File file, String outputFolder) throws IOException, InterruptedException { + String winrarPath = "C:\\Program Files\\WinRAR\\WinRAR.exe"; + String cmd = winrarPath + " X " + file + " " + outputFolder; + Process proc = Runtime.getRuntime().exec(cmd); + proc.waitFor(); + } + + //璇诲彇鏂囦欢澶逛笅鐨勬墍鏈夋枃浠讹紙涓嶈鍙栨枃浠跺す鍐呯殑鏂囦欢锛� + public static List getFileNameWithOutDirectory(String filePath) { + File folder = new File(filePath); // 鏂囦欢澶硅矾寰� + List nameList=new ArrayList(); + File[] listOfFiles = folder.listFiles(); + if (listOfFiles != null) { + for (File file : listOfFiles) { + if (file.isFile()) { + nameList.add(file.getName()); + } + } + } + return nameList; + } + + //private static void decompressRar(File file, String outputFolder) throws IOException, RarException { + // Archive archive = new Archive(file); + // FileHeader fileHeader = archive.nextFileHeader(); + // if (fileHeader != null) { + // while (fileHeader != null) { + // if (fileHeader.isDirectory()) { + // fileHeader = archive.nextFileHeader(); + // continue; + // } + // String tempFilePath = fileHeader.getFileName(); + // File out = new File(outputFolder + File.separator + tempFilePath); + // if (!out.exists()) { + // if (!out.getParentFile().exists()) { + // out.getParentFile().mkdirs(); + // } + // out.createNewFile(); + // } + // FileOutputStream os = new FileOutputStream(out); + // archive.extractFile(fileHeader, os); + // os.close(); + // fileHeader = archive.nextFileHeader(); + // } + // } + // archive.close(); + // + //} + + public static void main(String[] args) { + //File file = new File("C:\\Users\\29550\\Desktop\\AppScan10.rar"); + File file = new File("C:\\code\\web\\CadDrawManager\\target\\doc_file\\decompress\\doc_file@product@FBS-9600-GDPDX-XS1-DC220V-JH@standard@3@3++.rar"); + if(file.exists()) { + boolean delete = file.delete(); + System.out.println(delete); + } + } } diff --git a/src/main/java/com/whyc/util/MathUtil.java b/src/main/java/com/whyc/util/MathUtil.java index e2effbe..eaeddbb 100644 --- a/src/main/java/com/whyc/util/MathUtil.java +++ b/src/main/java/com/whyc/util/MathUtil.java @@ -298,6 +298,5 @@ } } return resultMap; - } } diff --git a/src/main/java/com/whyc/util/ServletUtils.java b/src/main/java/com/whyc/util/ServletUtils.java new file mode 100644 index 0000000..e27c2d7 --- /dev/null +++ b/src/main/java/com/whyc/util/ServletUtils.java @@ -0,0 +1,14 @@ +package com.whyc.util; + +public class ServletUtils { + public static boolean isNotNull(Object obj){ + boolean flag=false; + if(obj!=null){ + if(obj.toString().trim().length()>0){ + flag=true; + } + } + return flag; + } + +} diff --git a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java deleted file mode 100644 index 1b24f82..0000000 --- a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java +++ /dev/null @@ -1,352 +0,0 @@ -//package com.whyc.util; -// -//import com.github.pagehelper.PageInfo; -//import com.whyc.constant.DevAlmEnum; -//import com.whyc.dto.DevA200AlarmDto; -//import com.whyc.factory.ThreadPoolExecutorFactory; -//import com.whyc.mapper.CommonMapper; -//import com.whyc.pojo.db_alarm.BattAlarmHistory; -//import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear; -//import com.whyc.pojo.db_lithium_ram_db.DevLithiumInf; -//import com.whyc.pojo.db_power_alarm.PowerAlarmHistory; -//import com.whyc.pojo.db_power_history.BattRealTimeDataHistory; -//import com.whyc.pojo.db_power_history.BattStationTempHistory; -//import com.whyc.pojo.db_power_history.PowerRealTimeDataHistory; -//import com.whyc.pojo.db_user.UserInf; -//import com.whyc.service.DevLithiumInfService; -//import com.whyc.service.SubTableService; -//import com.whyc.service.UserInfService; -//import org.springframework.beans.BeanUtils; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Component; -// -//import java.text.ParseException; -//import java.util.*; -//import java.util.concurrent.CountDownLatch; -//import java.util.concurrent.ThreadPoolExecutor; -//import java.util.regex.Pattern; -//import java.util.stream.Collectors; -// -///** -// * 鏁版嵁閲忔瀬澶х殑琛�,鎸夌収骞翠唤鍒嗚〃,鍒嗛〉鏌ヨ鏃惰幏鍙栨暟鎹� -// */ -//@Component -//public class SubTablePageInfoUtil { -// @Autowired(required = false) -// private CommonMapper commonMapper; -// -// @Autowired -// private SubTableService service; -// -// @Autowired -// private DevLithiumInfService devLithiumInfService; -// -// @Autowired -// private UserInfService userInfService; -// -// /**鎸夊勾浠借〃鍒嗛〉鏌ヨ*/ -// public PageInfo<Object> getPageInfo(int pageNum,int pageSize, -// Date startTime,Date endTime, -// String dbName,String tablePrefix, -// Object pojo) throws ParseException { -// Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesDescWithOutDefault(startTime, endTime); -// //鏌ヨ鍒嗚〃鏄惁瀛樺湪,瀛樺湪鍒欐煡璇㈢粨鏋� -// Map<String,Integer> queryCountMap = new LinkedHashMap<>(); -// Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); -// for (String tableYear : tableYearKeySet) { -// List<Date> queryTime = queryTimeForSubTables.get(tableYear); -// -// //鏁板�� -// String tableName = tablePrefix+"_"+tableYear; -// boolean existTableName = commonMapper.existTable(dbName, tableName); -// if(!existTableName){ -// continue; -// } -// //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== -// if(pojo instanceof BattAlarmHistory) { -// BattAlarmHistory battAlarmHistory = new BattAlarmHistory(); -// BeanUtils.copyProperties(pojo, battAlarmHistory); -// battAlarmHistory.setAlmStartTime(queryTime.get(0)); -// battAlarmHistory.setAlmEndTime(queryTime.get(1)); -// battAlarmHistory.setRecordYear(tableName); -// int currentCount = service.getBattHisCount(battAlarmHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// else if(pojo instanceof PowerAlarmHistory) { -// PowerAlarmHistory powerAlarmHistory = new PowerAlarmHistory(); -// BeanUtils.copyProperties(pojo, powerAlarmHistory); -// powerAlarmHistory.setAlmStartTime(queryTime.get(0)); -// powerAlarmHistory.setAlmEndTime(queryTime.get(1)); -// powerAlarmHistory.setRecordYear(tableName); -// int currentCount = service.getPowerHisCount(powerAlarmHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// else if (pojo instanceof DevA200AlarmDto) { -// DevA200AlarmDto dto = (DevA200AlarmDto) pojo; -// dto.setStartTime(queryTime.get(0)); -// dto.setEndTime(queryTime.get(1)); -// dto.setTableName(tableName); -// int currentCount = service.getCountForDevAlm(dto); -// queryCountMap.put(tableYear, currentCount); -// } -// -// } -// -// //鍒嗛〉淇℃伅 -// //纭鎬婚〉鏁�,鎬昏褰曟暟 -// PageInfo<Object> pageInfo = new PageInfo<>(); -// -// int total = 0; -// Set<String> queryKeySet = queryCountMap.keySet(); -// for (String queryKey : queryKeySet) { -// int size = queryCountMap.get(queryKey); -// total+=size; -// } -// int pages = (int) Math.ceil(Float.parseFloat(String.valueOf(total))/pageSize); -// pageInfo.setTotal(total); -// pageInfo.setPages(pages); -// pageInfo.setPageNum(pageNum); -// pageInfo.setPageSize(pageSize); -// //鏍规嵁褰撳墠椤垫墍闇�璁板綍,鏌ヨ褰撳墠椤佃褰� -// int startNum = (pageNum-1)*pageSize+1; -// int endNum = pageNum*pageSize; -// -// //鏈�鍚庝竴涓畻娉�:涓婇潰涓嶅簲璇ュ厛鏌ヨ鎵�鏈夎褰�,搴旇鍙朿ount. 杩欏悗闈㈠畾浣嶅埌鍝釜琛ㄦ垨鍝嚑寮犺〃鍚�,閲囧彇limit鑾峰彇褰撳墠椤佃褰曟暟; -// //鏍煎紡:{琛ㄥ悕,[limit 2,20]} -// Map<String,List<Integer>> tableAndLimitMap = MathUtil.getQueryTableAndLimit(startNum,endNum,pageSize,queryCountMap); -// Set<String> keySet = tableAndLimitMap.keySet(); -// List<Object> dataList = new LinkedList<>(); -// for (String key : keySet) { -// List<Date> queryTime = queryTimeForSubTables.get(key); -// //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== -// String recordYear = tablePrefix + "_" + key; -// if(pojo instanceof BattAlarmHistory) { -// BattAlarmHistory battAlarmHistory = new BattAlarmHistory(); -// BeanUtils.copyProperties(pojo, battAlarmHistory); -// battAlarmHistory.setAlmStartTime(queryTime.get(0)); -// battAlarmHistory.setAlmEndTime(queryTime.get(1)); -// battAlarmHistory.setRecordYear(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// battAlarmHistory.setLimitStart(limitList.get(0)); -// battAlarmHistory.setLimitEnd(limitList.get(1)); -// List<BattAlarmHistory> list = service.getBattHisList(battAlarmHistory); -// dataList.addAll(list); -// } -// else if(pojo instanceof PowerAlarmHistory) { -// PowerAlarmHistory powerAlarmHistory = new PowerAlarmHistory(); -// BeanUtils.copyProperties(pojo, powerAlarmHistory); -// powerAlarmHistory.setAlmStartTime(queryTime.get(0)); -// powerAlarmHistory.setAlmEndTime(queryTime.get(1)); -// powerAlarmHistory.setRecordYear(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// powerAlarmHistory.setLimitStart(limitList.get(0)); -// powerAlarmHistory.setLimitEnd(limitList.get(1)); -// List<PowerAlarmHistory> list = service.getPowerHisList(powerAlarmHistory); -// dataList.addAll(list); -// } -// else if (pojo instanceof DevA200AlarmDto) { -// if(!key.equals("default")){ -// DevA200AlarmDto dto = (DevA200AlarmDto) pojo; -// dto.setStartTime(queryTime.get(0)); -// dto.setEndTime(queryTime.get(1)); -// List<Integer> limitList = tableAndLimitMap.get(key); -// dto.setLimitStart(limitList.get(0)); -// dto.setLimitEnd(limitList.get(1)); -// dto.setTableName(recordYear); -// List<DevLithiumAlarmDataYear> list = service.getListDevAlm(dto); -// for (DevLithiumAlarmDataYear year:list) { -// int devId=year.getDevId(); -// int uid=year.getConfirmedUid(); -// DevLithiumInf dinf=devLithiumInfService.getDinfByDevId(devId); -// UserInf uinf= userInfService.getUinfByUId(uid); -// int almId=year.getAlmId(); -// String almName= DevAlmEnum.getValue(almId); -// year.setAlmName(almName!=null?almName:""); -// year.setDevInf(dinf); -// year.setConfirmedUname(uinf!=null?uinf.getUname():""); -// } -// dataList.addAll(list); -// } -// } -// } -// pageInfo.setList(dataList); -// return pageInfo; -// } -// -// /**鎸夋湀鍒嗚〃,鍒嗛〉鏌ヨ*/ -// public PageInfo<Object> getPageInfoByMonthTable(int pageNum, int pageSize, -// Date startTime, Date endTime, -// String dbName, String tablePrefix, -// Object pojo) throws ParseException, InterruptedException { -// Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesByMonthDesc2(startTime, endTime); -// //鏌ヨ鍒嗚〃鏄惁瀛樺湪,瀛樺湪鍒欐煡璇㈢粨鏋� -// Map<String,Integer> queryCountMap = new LinkedHashMap<>(); -// Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); -// //浼樺寲1-鏌ヨ鎵�鏈夌殑绗﹀悎鏈堜唤瑙勫垯鐨勮〃鍜屼富琛� -// List<String> tableNameListDB = getTableList(dbName, tablePrefix, tablePrefix + "(_[0-9]{4}_[0-9]{2})?"); -// List<String> tableYearListInDB = new LinkedList<>(); //鏌ヨ鏃堕棿娈靛唴鐨勫勾鏈堝垎琛ㄩ泦鍚堜笖鍦ㄦ暟鎹簱涓瓨鍦� -// //杩囨护鎺夋椂闂存鍐呮暟鎹簱涓笉瀛樺湪鐨勫勾鏈堝垎琛� -// for (String tableYear : tableYearKeySet) { -// String tableName; -// if(!tableYear.equals("default")){ -// //鏁板�� -// tableName = tablePrefix+"_"+tableYear; -// //String existTableName = commonMapper.existTable(dbName, tableName); -// if(!tableNameListDB.contains(tableName)){ //浼樺寲1-鏁版嵁搴撲腑涓嶅瓨鍦�,鍘婚櫎澶氭鏌ヨ〃,涓�娆℃煡鍑� -// continue; -// } -// } -// tableYearListInDB.add(tableYear); -// } -// //鏌ヨ骞存湀鍒嗚〃鐨勮褰曟暟 -// //浼樺寲2:澶氱嚎绋嬭鍙� -// ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); -// CountDownLatch latch = new CountDownLatch(tableYearListInDB.size()); -// for (String tableYear : tableYearListInDB) { -// List<Date> queryTime = queryTimeForSubTables.get(tableYear); -// -// String tableName; -// if(!tableYear.equals("default")){ -// //鏁板�� -// tableName = tablePrefix+"_"+tableYear; -// }else{ -// tableName = tablePrefix; -// } -// pool.execute(()-> { -// //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== -// if (pojo instanceof BattAlarmHistory) { -// BattAlarmHistory battAlarmHistory = new BattAlarmHistory(); -// BeanUtils.copyProperties(pojo, battAlarmHistory); -// battAlarmHistory.setAlmStartTime(queryTime.get(0)); -// battAlarmHistory.setAlmEndTime(queryTime.get(1)); -// battAlarmHistory.setRecordYear(tableName); -// int currentCount = service.getBattHisCount(battAlarmHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// else if (pojo instanceof BattStationTempHistory) { -// BattStationTempHistory tempHistory = new BattStationTempHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(tableName); -// int currentCount = service.getBattStationTempHisCount(tempHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// else if (pojo instanceof BattRealTimeDataHistory) { -// BattRealTimeDataHistory tempHistory = new BattRealTimeDataHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(tableName); -// int currentCount = service.getBattRealTimeDataHisCount(tempHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// else if (pojo instanceof PowerRealTimeDataHistory) { -// PowerRealTimeDataHistory tempHistory = new PowerRealTimeDataHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(tableName); -// int currentCount = service.getPowerRealTimeDataHisCount(tempHistory); -// queryCountMap.put(tableYear, currentCount); -// } -// -// latch.countDown(); -// }); -// } -// latch.await(); -// //鍥犱负澶氱嚎绋嬪悗鏃犲簭,闇�瑕侀噸鎺掑簭 -// List<String> keySetDesc = queryCountMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()); -// Map<String,Integer> queryCountMapDesc = new LinkedHashMap<>(); -// for (String key : keySetDesc) { -// Integer count = queryCountMap.get(key); -// queryCountMapDesc.put(key,count); -// } -// //鍒嗛〉淇℃伅 -// //纭鎬婚〉鏁�,鎬昏褰曟暟 -// PageInfo<Object> pageInfo = new PageInfo<>(); -// int total = 0; -// Set<String> queryKeySet = queryCountMap.keySet(); -// for (String queryKey : queryKeySet) { -// int size = queryCountMap.get(queryKey); -// total+=size; -// } -// int pages = (int) Math.ceil(Float.parseFloat(String.valueOf(total))/pageSize); -// pageInfo.setTotal(total); -// pageInfo.setPages(pages); -// pageInfo.setPageNum(pageNum); -// pageInfo.setPageSize(pageSize); -// //鏍规嵁褰撳墠椤垫墍闇�璁板綍,鏌ヨ褰撳墠椤佃褰� -// int startNum = (pageNum-1)*pageSize+1; -// int endNum = pageNum*pageSize; -// -// //鏈�鍚庝竴涓畻娉�:涓婇潰涓嶅簲璇ュ厛鏌ヨ鎵�鏈夎褰�,搴旇鍙朿ount. 杩欏悗闈㈠畾浣嶅埌鍝釜琛ㄦ垨鍝嚑寮犺〃鍚�,閲囧彇limit鑾峰彇褰撳墠椤佃褰曟暟; -// //鏍煎紡:{琛ㄥ悕,[limit 2,20]} -// Map<String,List<Integer>> tableAndLimitMap = MathUtil.getQueryTableAndLimit(startNum,endNum,pageSize,queryCountMapDesc); -// Set<String> keySet = tableAndLimitMap.keySet(); -// List<Object> dataList = new LinkedList<>(); -// for (String key : keySet) { -// List<Date> queryTime = queryTimeForSubTables.get(key); -// //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== -// String recordYear = key.equals("default") ? tablePrefix : tablePrefix + "_" + key; -// if(pojo instanceof BattAlarmHistory) { -// BattAlarmHistory battAlarmHistory = new BattAlarmHistory(); -// BeanUtils.copyProperties(pojo, battAlarmHistory); -// battAlarmHistory.setAlmStartTime(queryTime.get(0)); -// battAlarmHistory.setAlmEndTime(queryTime.get(1)); -// battAlarmHistory.setRecordYear(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// battAlarmHistory.setLimitStart(limitList.get(0)); -// battAlarmHistory.setLimitEnd(limitList.get(1)); -// List<BattAlarmHistory> list = service.getBattHisList(battAlarmHistory); -// dataList.addAll(list); -// } -// else if (pojo instanceof BattStationTempHistory){ -// BattStationTempHistory tempHistory = new BattStationTempHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// tempHistory.setLimitStart(limitList.get(0)); -// tempHistory.setLimitEnd(limitList.get(1)); -// List<BattStationTempHistory> list = service.getBattStationTempHisList(tempHistory); -// dataList.addAll(list); -// } -// else if (pojo instanceof BattRealTimeDataHistory){ -// BattRealTimeDataHistory tempHistory = new BattRealTimeDataHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// tempHistory.setLimitStart(limitList.get(0)); -// tempHistory.setLimitEnd(limitList.get(1)); -// List<BattRealTimeDataHistory> list = service.getBattRealTimeDataHisList(tempHistory); -// dataList.addAll(list); -// } -// else if (pojo instanceof PowerRealTimeDataHistory){ -// PowerRealTimeDataHistory tempHistory = new PowerRealTimeDataHistory(); -// tempHistory.setStartTime(queryTime.get(0)); -// tempHistory.setEndTime(queryTime.get(1)); -// tempHistory.setRecordYearMonth(recordYear); -// List<Integer> limitList = tableAndLimitMap.get(key); -// tempHistory.setLimitStart(limitList.get(0)); -// tempHistory.setLimitEnd(limitList.get(1)); -// List<PowerRealTimeDataHistory> list = service.getPowerRealTimeDataHisList(tempHistory); -// dataList.addAll(list); -// } -// } -// pageInfo.setList(dataList); -// return pageInfo; -// -// } -// -// /**鏌ヨ鏄惁鍖呭惈鐗瑰畾瑙勫垯鐨勮〃,瀛樺湪,鍒欒繑鍥炶〃鍚�*/ -// public List<String> getTableList(String dbName,String tableLike,String regex){ -// List<String> resultTableList = new LinkedList<>(); -// List<String> tableList = commonMapper.getTableListLike(dbName,tableLike); -// for (String tableName : tableList) { -// boolean matches = Pattern.matches(regex, tableName); -// if(matches){ -// resultTableList.add(tableName); -// } -// } -// return resultTableList; -// } -//} \ No newline at end of file diff --git a/src/main/java/com/whyc/util/SubTablePageInfoUtils.java b/src/main/java/com/whyc/util/SubTablePageInfoUtils.java new file mode 100644 index 0000000..da02742 --- /dev/null +++ b/src/main/java/com/whyc/util/SubTablePageInfoUtils.java @@ -0,0 +1,312 @@ +package com.whyc.util; + +import com.github.pagehelper.PageInfo; +import com.whyc.dto.AlmHis.BattAlarmRes; +import com.whyc.dto.AlmHis.BattAlmPar; +import com.whyc.dto.AlmHis.DevAlmPar; +import com.whyc.dto.AlmHis.PwrAlmPar; +import com.whyc.factory.ThreadPoolExecutorFactory; +import com.whyc.mapper.CommonMapper; +import com.whyc.pojo.db_alarm.BattalarmDataHistory; +import com.whyc.pojo.db_alarm.DevalarmDataHistory; +import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmHistory; +import com.whyc.service.SubTablePageInfoService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * 鏁版嵁閲忔瀬澶х殑琛�,鎸夌収骞翠唤鍒嗚〃,鍒嗛〉鏌ヨ鏃惰幏鍙栨暟鎹� + */ +@Component +public class SubTablePageInfoUtils { + + @Resource + private CommonMapper commonMapper; + + @Autowired + private SubTablePageInfoService subService; + + /**鎸夊勾浠借〃鍒嗛〉鏌ヨ*/ + public PageInfo<Object> getPageInfo(int pageNum,int pageSize, + Date startTime,Date endTime, + String dbName,String tablePrefix, + Object pojo) throws ParseException { + Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesDesc(startTime, endTime); + //鏌ヨ鍒嗚〃鏄惁瀛樺湪,瀛樺湪鍒欐煡璇㈢粨鏋� + Map<String,Integer> queryCountMap = new LinkedHashMap<>(); + Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); + for (String tableYear : tableYearKeySet) { + List<Date> queryTime = queryTimeForSubTables.get(tableYear); + String tableName=tablePrefix+"_"+tableYear;; + String existTableName = commonMapper.existTable(dbName, tableName); + if(existTableName == null){ + continue; + } + //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== + if(pojo instanceof PwrAlmPar) { + PwrAlmPar param = (PwrAlmPar) pojo; + param.setAlmStartTime(queryTime.get(0)); + param.setAlmEndTime(queryTime.get(1)); + param.setRecordYear(tableName); + int currentCount = subService.getPwrAlmHisCount(param); + queryCountMap.put(tableYear, currentCount); + } + } + + //鍒嗛〉淇℃伅 + //纭鎬婚〉鏁�,鎬昏褰曟暟 + PageInfo<Object> pageInfo = new PageInfo<>(); + + int total = 0; + Set<String> queryKeySet = queryCountMap.keySet(); + for (String queryKey : queryKeySet) { + int size = queryCountMap.get(queryKey); + total+=size; + } + int pages = (int) Math.ceil(Float.parseFloat(String.valueOf(total))/pageSize); + pageInfo.setTotal(total); + pageInfo.setPages(pages); + pageInfo.setPageNum(pageNum); + pageInfo.setPageSize(pageSize); + //鏍规嵁褰撳墠椤垫墍闇�璁板綍,鏌ヨ褰撳墠椤佃褰� + int startNum = (pageNum-1)*pageSize+1; + int endNum = pageNum*pageSize; + + //鏈�鍚庝竴涓畻娉�:涓婇潰涓嶅簲璇ュ厛鏌ヨ鎵�鏈夎褰�,搴旇鍙朿ount. 杩欏悗闈㈠畾浣嶅埌鍝釜琛ㄦ垨鍝嚑寮犺〃鍚�,閲囧彇limit鑾峰彇褰撳墠椤佃褰曟暟; + //鏍煎紡:{琛ㄥ悕,[limit 2,20]} + Map<String,List<Integer>> tableAndLimitMap = MathUtil.getQueryTableAndLimit(startNum,endNum,pageSize,queryCountMap); + Set<String> keySet = tableAndLimitMap.keySet(); + List<Object> dataList = new LinkedList<>(); + for (String key : keySet) { + List<Date> queryTime = queryTimeForSubTables.get(key); + //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== + String recordYear = key.equals("default") ? tablePrefix : tablePrefix + "_" + key; + + + if (pojo instanceof PwrAlmPar) { + PwrAlmPar data = (PwrAlmPar) pojo; + data.setAlmStartTime(queryTime.get(0)); + data.setAlmEndTime(queryTime.get(1)); + List<Integer> limitList = tableAndLimitMap.get(key); + data.setLimitStart(limitList.get(0)); + data.setLimitEnd(limitList.get(1)); + data.setRecordYear(recordYear); + List<PwrdevAlarmHistory> list= subService.getPwrAlmHisList(data); + dataList.addAll(list); + } + + } + pageInfo.setList(dataList); + return pageInfo; + } + /**鎸夋湀鍒嗚〃,鍒嗛〉鏌ヨ*/ + public PageInfo<Object> getPageInfoByMonthTable(int pageNum,int pageSize, + Date startTime,Date endTime, + String dbName,String tablePrefix, + Object pojo) throws ParseException, InterruptedException { + Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesByMonthDesc(startTime, endTime); + //鏌ヨ鍒嗚〃鏄惁瀛樺湪,瀛樺湪鍒欐煡璇㈢粨鏋� + Map<String,Integer> queryCountMap = new LinkedHashMap<>(); + Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); + //浼樺寲1-鏌ヨ鎵�鏈夌殑绗﹀悎鏈堜唤瑙勫垯鐨勮〃鍜屼富琛� + List<String> tableNameListDB = getTableList(dbName, tablePrefix, tablePrefix + "(_[0-9]{4}_[0-9]{2})?"); + List<String> tableYearListInDB = new LinkedList<>(); //鏌ヨ鏃堕棿娈靛唴鐨勫勾鏈堝垎琛ㄩ泦鍚堜笖鍦ㄦ暟鎹簱涓瓨鍦� + //杩囨护鎺夋椂闂存鍐呮暟鎹簱涓笉瀛樺湪鐨勫勾鏈堝垎琛� + for (String tableYear : tableYearKeySet) { + + String tableName; + if(!tableYear.equals("default")){ + //鏁板�� + tableName = tablePrefix+"_"+tableYear; + //String existTableName = commonMapper.existTable(dbName, tableName); + if(!tableNameListDB.contains(tableName)){ //浼樺寲1-鏁版嵁搴撲腑涓嶅瓨鍦�,鍘婚櫎澶氭鏌ヨ〃,涓�娆℃煡鍑� + continue; + } + } + tableYearListInDB.add(tableYear); + } + //鏌ヨ骞存湀鍒嗚〃鐨勮褰曟暟 + //浼樺寲2:澶氱嚎绋嬭鍙� + ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); + CountDownLatch latch = new CountDownLatch(tableYearListInDB.size()); + for (String tableYear : tableYearListInDB) { + List<Date> queryTime = queryTimeForSubTables.get(tableYear); + String tableName; + if(!tableYear.equals("default")){ + //鏁板�� + tableName = tablePrefix+"_"+tableYear; + }else{ + tableName = tablePrefix; + } + pool.execute(()-> { + //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== + if (pojo instanceof BattAlmPar) { //鐢垫睜鍛婅鍘嗗彶 + BattAlmPar param = new BattAlmPar(); + BeanUtils.copyProperties(pojo,param); + param.setAlmStartTime(queryTime.get(0)); + param.setAlmEndTime(queryTime.get(1)); + param.setRecordYear(tableName); + int currentCount = subService.getBattAlmHisCount(param); + queryCountMap.put(tableYear, currentCount); + } + else if (pojo instanceof DevAlmPar) { + DevAlmPar param = new DevAlmPar(); + BeanUtils.copyProperties(pojo,param); + param.setAlmStartTime(queryTime.get(0)); + param.setAlmEndTime(queryTime.get(1)); + param.setRecordYear(tableName); + int currentCount = subService.getDevAlmHisCount(param); + queryCountMap.put(tableYear, currentCount); + } + + latch.countDown(); + }); + } + latch.await(); + //鍥犱负澶氱嚎绋嬪悗鏃犲簭,闇�瑕侀噸鎺掑簭 + List<String> keySetDesc = queryCountMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()); + Map<String,Integer> queryCountMapDesc = new LinkedHashMap<>(); + for (String key : keySetDesc) { + Integer count = queryCountMap.get(key); + queryCountMapDesc.put(key,count); + } + //鍒嗛〉淇℃伅 + //纭鎬婚〉鏁�,鎬昏褰曟暟 + PageInfo<Object> pageInfo = new PageInfo<>(); + + int total = 0; + Set<String> queryKeySet = queryCountMap.keySet(); + for (String queryKey : queryKeySet) { + int size = queryCountMap.get(queryKey); + total+=size; + } + int pages = (int) Math.ceil(Float.parseFloat(String.valueOf(total))/pageSize); + pageInfo.setTotal(total); + pageInfo.setPages(pages); + pageInfo.setPageNum(pageNum); + pageInfo.setPageSize(pageSize); + //鏍规嵁褰撳墠椤垫墍闇�璁板綍,鏌ヨ褰撳墠椤佃褰� + int startNum = (pageNum-1)*pageSize+1; + int endNum = pageNum*pageSize; + + //鏈�鍚庝竴涓畻娉�:涓婇潰涓嶅簲璇ュ厛鏌ヨ鎵�鏈夎褰�,搴旇鍙朿ount. 杩欏悗闈㈠畾浣嶅埌鍝釜琛ㄦ垨鍝嚑寮犺〃鍚�,閲囧彇limit鑾峰彇褰撳墠椤佃褰曟暟; + //鏍煎紡:{琛ㄥ悕,[limit 2,20]} + Map<String,List<Integer>> tableAndLimitMap = MathUtil.getQueryTableAndLimit(startNum,endNum,pageSize,queryCountMapDesc); + Set<String> keySet = tableAndLimitMap.keySet(); + List<Object> dataList = new LinkedList<>(); + for (String key : keySet) { + List<Date> queryTime = queryTimeForSubTables.get(key); + //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== + String recordYear = key.equals("default") ? tablePrefix : tablePrefix + "_" + key; + if (pojo instanceof BattAlmPar) { + BattAlmPar data = (BattAlmPar) pojo; + data.setAlmStartTime(queryTime.get(0)); + data.setAlmEndTime(queryTime.get(1)); + + List<Integer> limitList = tableAndLimitMap.get(key); + data.setLimitStart(limitList.get(0)); + data.setLimitEnd(limitList.get(1)); + data.setRecordYear(recordYear); + List<BattalarmDataHistory> list = subService.getBattAlmHisList(data); + dataList.addAll(list); + } + else if (pojo instanceof DevAlmPar) { + DevAlmPar data = (DevAlmPar) pojo; + data.setAlmStartTime(queryTime.get(0)); + data.setAlmEndTime(queryTime.get(1)); + + List<Integer> limitList = tableAndLimitMap.get(key); + data.setLimitStart(limitList.get(0)); + data.setLimitEnd(limitList.get(1)); + data.setRecordYear(recordYear); + List<DevalarmDataHistory> list = subService.getDevAlmHisList(data); + dataList.addAll(list); + } + + + } + pageInfo.setList(dataList); + return pageInfo; + } + + /**鏌ヨ鏄惁鍖呭惈鐗瑰畾瑙勫垯鐨勮〃,瀛樺湪,鍒欒繑鍥炶〃鍚�*/ + public List<String> getTableList(String dbName,String tableLike,String regex){ + List<String> resultTableList = new LinkedList<>(); + List<String> tableList = commonMapper.getTableListLike(dbName,tableLike); + for (String tableName : tableList) { + boolean matches = Pattern.matches(regex, tableName); + if(matches){ + resultTableList.add(tableName); + } + } + return resultTableList; + } + + /* *//**鎵�鏈夎褰曞垎涓哄洓绾ф煡璇釜鏁�*//* + public List<Integer> getLevelList(int uId,String dbName,String tableLike,String regex,List<Integer> almTypes ){ + List<Integer> result = new LinkedList<>(); + List<String> tableList = getTableList(dbName, tableLike, regex); + List<Integer> levelList = new LinkedList(); + for (String tableName : tableList) { + List<BattalarmDataHistory> levelInfoSubList; + List<Integer> levelSubList; + if(tableLike.equals("tb_battalarm_data_history")) { + //levelInfoSubList = battAlarmDataHistoryMapper.getLevelSubList(uId, tableName); + levelInfoSubList = subService.getLevelSubList_batt(uId, tableName); + } + else if(tableLike.equals("tb_devalarm_data_history")){ + //levelInfoSubList = devAlarmDataHistoryMapper.getLevelSubList(uId, tableName); + levelInfoSubList = subService.getLevelSubList_dev(uId, tableName); + } + else{ + //levelInfoSubList = powerAlarmHistoryMapper.getLevelSubList(uId, tableName,almTypes); + levelInfoSubList = subService.getLevelSubList_pwr(uId, tableName,almTypes); + } + levelSubList = levelInfoSubList.stream().map(BattalarmDataHistory::getAlmLevel).collect(Collectors.toList()); + levelList.addAll(levelSubList); + } + //鍒嗕负鍥涚骇鏌ヨ涓暟 + Map<Integer, List<Integer>> levelMap = levelList.stream().collect(Collectors.groupingBy(Integer::intValue)); + Set<Integer> levelSet = levelMap.keySet(); + List<Integer> listOfLevelSet = new LinkedList(); + //琛ラ綈1,2,3,4鍥涚骇 + listOfLevelSet.add(1); + listOfLevelSet.add(2); + listOfLevelSet.add(3); + listOfLevelSet.add(4); + if(!levelSet.contains(1)){ + levelMap.put(1,new LinkedList<>()); + } + if(!levelSet.contains(2)){ + levelMap.put(2,new LinkedList<>()); + } + if(!levelSet.contains(3)){ + levelMap.put(3,new LinkedList<>()); + } + if(!levelSet.contains(4)){ + levelMap.put(4,new LinkedList<>()); + } + //寰呮祴璇� + for (Integer level : listOfLevelSet) { + result.add(levelMap.get(level).size()); + } + return result; + } +*/ + public static void main(String[] args) { + //String regex = "tb_battalarm_data_history_?[0-9]*"; + String regex = "tb_battalarm_data_history(_[0-9]{4}_[0-9]{2})?"; + //String table = "tb_battalarm_data_history"; + String table = "tb_battalarm_data_history_0222_04"; + System.out.println(Pattern.matches(regex,table)); + } +} diff --git a/src/main/java/com/whyc/webSocket/BattAlmRealSocket.java b/src/main/java/com/whyc/webSocket/BattAlmRealSocket.java new file mode 100644 index 0000000..8a25031 --- /dev/null +++ b/src/main/java/com/whyc/webSocket/BattAlmRealSocket.java @@ -0,0 +1,110 @@ +package com.whyc.webSocket; + +import com.whyc.config.WebSocketConfig; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_user.User; +import com.whyc.service.BattalarmDataService; +import com.whyc.util.JsonUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpSession; +import javax.websocket.*; +import javax.websocket.server.ServerEndpoint; +import java.util.HashMap; +import java.util.Map; + +/** + * 瀹炴椂 + */ +@Component +@ServerEndpoint(value = "/battAlmReal",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) +public class BattAlmRealSocket { + private Session session; + + private Thread thread; + + private static BattalarmDataService service; + + private static HttpSession httpSession; + + private volatile boolean runFlag = true; + + private volatile Map<String, Thread> threadMap = new HashMap<>(); + + private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); + + @Autowired + public void setBattalarmDataService(BattalarmDataService service) { + BattAlmRealSocket.service = service; + } + + + @OnOpen + public void onOpen(Session session, EndpointConfig config) { + this.session = session; + this.httpSession = (HttpSession) config.getUserProperties().get("httpSession"); + } + @OnMessage + public void onMessage(Session session, String message) { + AlmDto dto= JsonUtil.getGson().fromJson(message,AlmDto.class); + if(httpSession!=null){ + User user = (User) httpSession.getAttribute("user"); + dto.setUid(user.getId()); + }else{ + dto.setUid(1005); + } + thread = new Thread("Thread_realLockSocket") { + @Override + public void run() { + while (runFlag && !isInterrupted()) { + Thread thread = currentThread(); + threadFlagMap.put(thread.getId(), true); + try { + Response res= service.getBattAlmReal(dto); + if (session.isOpen()) { + //鎺ㄩ�佷俊鎭� + synchronized (session) { + session.getBasicRemote().sendObject(res); + } + threadFlagMap.put(thread.getId(), false); + } + sleep(4000); + } catch (Exception e) { + interrupt(); + } + } + } + }; + thread.start(); + threadFlagMap.put(thread.getId(),true); + //鍋滄鑰佺殑socket绾跨▼ + Thread threadBefore = threadMap.get(session.getId()); + if(threadBefore !=null && threadBefore.isAlive()){ + while (threadFlagMap.get(threadBefore.getId())){ + } + threadBefore.interrupt(); + } + //灏嗙嚎绋嬪瓨鍌�,渚夸簬璋冪敤瀹氫綅 + threadMap.put(session.getId(), this.thread); + } + @OnClose + public void onClose(CloseReason closeReason){ + System.err.println("closeReason = " + closeReason); + runFlag = false; + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } + + @OnError + public void onError(Throwable error) { + error.printStackTrace(); + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/webSocket/DevAlmRealSocket.java b/src/main/java/com/whyc/webSocket/DevAlmRealSocket.java new file mode 100644 index 0000000..869a6bd --- /dev/null +++ b/src/main/java/com/whyc/webSocket/DevAlmRealSocket.java @@ -0,0 +1,111 @@ +package com.whyc.webSocket; + +import com.whyc.config.WebSocketConfig; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_user.User; +import com.whyc.service.BattalarmDataService; +import com.whyc.service.DevalarmDataService; +import com.whyc.util.JsonUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpSession; +import javax.websocket.*; +import javax.websocket.server.ServerEndpoint; +import java.util.HashMap; +import java.util.Map; + +/** + * 瀹炴椂 + */ +@Component +@ServerEndpoint(value = "/devAlmReal",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) +public class DevAlmRealSocket { + private Session session; + + private Thread thread; + + private static DevalarmDataService service; + + private static HttpSession httpSession; + + private volatile boolean runFlag = true; + + private volatile Map<String, Thread> threadMap = new HashMap<>(); + + private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); + + @Autowired + public void setDevalarmDataService(DevalarmDataService service) { + DevAlmRealSocket.service = service; + } + + + @OnOpen + public void onOpen(Session session, EndpointConfig config) { + this.session = session; + this.httpSession = (HttpSession) config.getUserProperties().get("httpSession"); + } + @OnMessage + public void onMessage(Session session, String message) { + AlmDto dto= JsonUtil.getGson().fromJson(message,AlmDto.class); + if(httpSession!=null){ + User user = (User) httpSession.getAttribute("user"); + dto.setUid(user.getId()); + }else{ + dto.setUid(1005); + } + thread = new Thread("Thread_realLockSocket") { + @Override + public void run() { + while (runFlag && !isInterrupted()) { + Thread thread = currentThread(); + threadFlagMap.put(thread.getId(), true); + try { + Response res= service.getDevAlmReal(dto); + if (session.isOpen()) { + //鎺ㄩ�佷俊鎭� + synchronized (session) { + session.getBasicRemote().sendObject(res); + } + threadFlagMap.put(thread.getId(), false); + } + sleep(4000); + } catch (Exception e) { + interrupt(); + } + } + } + }; + thread.start(); + threadFlagMap.put(thread.getId(),true); + //鍋滄鑰佺殑socket绾跨▼ + Thread threadBefore = threadMap.get(session.getId()); + if(threadBefore !=null && threadBefore.isAlive()){ + while (threadFlagMap.get(threadBefore.getId())){ + } + threadBefore.interrupt(); + } + //灏嗙嚎绋嬪瓨鍌�,渚夸簬璋冪敤瀹氫綅 + threadMap.put(session.getId(), this.thread); + } + @OnClose + public void onClose(CloseReason closeReason){ + System.err.println("closeReason = " + closeReason); + runFlag = false; + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } + + @OnError + public void onError(Throwable error) { + error.printStackTrace(); + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/webSocket/PwrAlmRealSocket.java b/src/main/java/com/whyc/webSocket/PwrAlmRealSocket.java new file mode 100644 index 0000000..6b965a0 --- /dev/null +++ b/src/main/java/com/whyc/webSocket/PwrAlmRealSocket.java @@ -0,0 +1,111 @@ +package com.whyc.webSocket; + +import com.whyc.config.WebSocketConfig; +import com.whyc.dto.Real.AlmDto; +import com.whyc.dto.Response; +import com.whyc.pojo.db_user.User; +import com.whyc.service.DevalarmDataService; +import com.whyc.service.PwrdevAlarmService; +import com.whyc.util.JsonUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpSession; +import javax.websocket.*; +import javax.websocket.server.ServerEndpoint; +import java.util.HashMap; +import java.util.Map; + +/** + * 瀹炴椂 + */ +@Component +@ServerEndpoint(value = "/pwrAlmReal",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) +public class PwrAlmRealSocket { + private Session session; + + private Thread thread; + + private static PwrdevAlarmService service; + + private static HttpSession httpSession; + + private volatile boolean runFlag = true; + + private volatile Map<String, Thread> threadMap = new HashMap<>(); + + private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); + + @Autowired + public void setPwrdevAlarmService(PwrdevAlarmService service) { + PwrAlmRealSocket.service = service; + } + + + @OnOpen + public void onOpen(Session session, EndpointConfig config) { + this.session = session; + this.httpSession = (HttpSession) config.getUserProperties().get("httpSession"); + } + @OnMessage + public void onMessage(Session session, String message) { + AlmDto dto= JsonUtil.getGson().fromJson(message,AlmDto.class); + if(httpSession!=null){ + User user = (User) httpSession.getAttribute("user"); + dto.setUid(user.getId()); + }else{ + dto.setUid(1005); + } + thread = new Thread("Thread_realLockSocket") { + @Override + public void run() { + while (runFlag && !isInterrupted()) { + Thread thread = currentThread(); + threadFlagMap.put(thread.getId(), true); + try { + Response res= service.getPwrAlmReal(dto); + if (session.isOpen()) { + //鎺ㄩ�佷俊鎭� + synchronized (session) { + session.getBasicRemote().sendObject(res); + } + threadFlagMap.put(thread.getId(), false); + } + sleep(4000); + } catch (Exception e) { + interrupt(); + } + } + } + }; + thread.start(); + threadFlagMap.put(thread.getId(),true); + //鍋滄鑰佺殑socket绾跨▼ + Thread threadBefore = threadMap.get(session.getId()); + if(threadBefore !=null && threadBefore.isAlive()){ + while (threadFlagMap.get(threadBefore.getId())){ + } + threadBefore.interrupt(); + } + //灏嗙嚎绋嬪瓨鍌�,渚夸簬璋冪敤瀹氫綅 + threadMap.put(session.getId(), this.thread); + } + @OnClose + public void onClose(CloseReason closeReason){ + System.err.println("closeReason = " + closeReason); + runFlag = false; + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } + + @OnError + public void onError(Throwable error) { + error.printStackTrace(); + if (thread != null && thread.isAlive()) { + thread.interrupt(); + } + threadMap.remove(session.getId()); + } +} \ No newline at end of file diff --git a/src/main/java/com/whyc/webSocket/RealTimeSocket.java b/src/main/java/com/whyc/webSocket/RealTimeSocket.java index 9aaa829..e7307e4 100644 --- a/src/main/java/com/whyc/webSocket/RealTimeSocket.java +++ b/src/main/java/com/whyc/webSocket/RealTimeSocket.java @@ -1,17 +1,37 @@ package com.whyc.webSocket; import com.whyc.config.WebSocketConfig; +import com.whyc.constant.BattStateEnum; +import com.whyc.constant.DevStateEnum; +import com.whyc.constant.FailReasonEnum; +import com.whyc.constant.StopReasonEnum; +import com.whyc.dto.Real.SticRealRtdataDto; +import com.whyc.dto.Real.TopDto; import com.whyc.dto.RealTimeDto; import com.whyc.dto.Response; +import com.whyc.factory.BattCapFactory; +import com.whyc.pojo.db_batt_testdata.BattresdataInf; +import com.whyc.pojo.db_batt_testdata.BatttestdataInf; +import com.whyc.pojo.db_ram_db.BattRtdata; +import com.whyc.pojo.db_ram_db.BattRtstate; +import com.whyc.pojo.db_ram_db.DeviceState; +import com.whyc.pojo.db_ram_db.PwrdevAcdcdata; +import com.whyc.pojo.db_station.BattInf; +import com.whyc.pojo.db_station.PowerInf; +import com.whyc.pojo.db_station.StationInf; import com.whyc.pojo.db_user.User; +import com.whyc.service.*; import com.whyc.util.ActionUtil; +import com.whyc.util.ThreadLocalUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.servlet.http.HttpSession; import javax.websocket.*; import javax.websocket.server.ServerEndpoint; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; @Component @@ -20,8 +40,37 @@ private Session session; private Thread thread; + //瀹炴椂鏁版嵁 + private static BattRtstateService battRtstateService; - //private static LockAlarmService almService; + private static DeviceStateService deviceStateService; + + private static PwrdevAcdcdataService pwrdevAcdcdataService; + + //瀹炴椂鍛婅 + private static BattalarmDataService battalarmDataService; + + private static DevalarmDataService devalarmDataService; + + private static PwrdevAlarmService pwrdevAlarmService; + + //鏀剧數璁板綍 + private static BatttestdataInfService batttestdataInfService; + + //鐢垫睜缁勪俊鎭� + private static BattInfService battInfService; + + //鏈烘埧淇℃伅 + private static StationInfService stationInfService; + + //鐢垫簮淇℃伅 + private static PowerInfService powerInfService; + + //鍗曚綋淇℃伅 + private static BattRtdataService rtdataService; + + //鍐呴樆娴嬭瘯淇℃伅 + private static BattresdataInfService battresdataInfService; private volatile boolean runFlag = true; @@ -32,10 +81,66 @@ private volatile Map<Long,Boolean> threadFlagMap = new HashMap<>(); - /*@Autowired - public void setLockAlarmService(LockAlarmService almService) { - LockAlmRtSocket.almService = almService; - }*/ + @Autowired + public void setBattRtstateService(BattRtstateService battRtstateService) { + RealTimeSocket.battRtstateService = battRtstateService; + } + + @Autowired + public void setDeviceStateService(DeviceStateService deviceStateService) { + RealTimeSocket.deviceStateService = deviceStateService; + } + + @Autowired + public void setPwrdevAcdcdataService(PwrdevAcdcdataService pwrdevAcdcdataService) { + RealTimeSocket.pwrdevAcdcdataService = pwrdevAcdcdataService; + } + + @Autowired + public void setBattalarmDataService(BattalarmDataService battalarmDataService) { + RealTimeSocket.battalarmDataService = battalarmDataService; + } + + @Autowired + public void setDevalarmDataService(DevalarmDataService devalarmDataService) { + RealTimeSocket.devalarmDataService = devalarmDataService; + } + + @Autowired + public void setPwrdevAlarmService(PwrdevAlarmService pwrdevAlarmService) { + RealTimeSocket.pwrdevAlarmService = pwrdevAlarmService; + } + + @Autowired + public void setBatttestdataInfService(BatttestdataInfService batttestdataInfService) { + RealTimeSocket.batttestdataInfService = batttestdataInfService; + } + + @Autowired + public void setBattInfService(BattInfService battInfService) { + RealTimeSocket.battInfService = battInfService; + } + + @Autowired + public void setStationInfService(StationInfService stationInfService) { + RealTimeSocket.stationInfService = stationInfService; + } + + @Autowired + public void setPowerInfService(PowerInfService powerInfService) { + RealTimeSocket.powerInfService = powerInfService; + } + + @Autowired + public void setBattRtdataService(BattRtdataService rtdataService) { + RealTimeSocket.rtdataService = rtdataService; + } + + @Autowired + public void setBattresdataInfService(BattresdataInfService battresdataInfService) { + RealTimeSocket.battresdataInfService = battresdataInfService; + } + @OnOpen @@ -69,7 +174,7 @@ if (session.isOpen()) { //鎺ㄩ�佷俊鎭� synchronized (session) { - session.getBasicRemote().sendObject(new Response<>().set(1,map)); + session.getBasicRemote().sendObject(new Response<>().setII(1,true,map,"瀹炴椂椤甸潰鏁版嵁鎺ㄩ��")); } threadFlagMap.put(thread.getId(), false); } @@ -94,7 +199,81 @@ } //鑾峰彇澶撮儴淇℃伅 private Response getTop(RealTimeDto realDto) { - return new Response().set(1); + TopDto topDto = new TopDto(); + try { + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + BattRtstate battRtstate = battRtstateService.getBattRealInfo(realDto.getBattgroupId()); + if (battRtstate != null) { + topDto.setBattState(battRtstate.getBattState()); + topDto.setBattStateName(BattStateEnum.getValue(battRtstate.getBattState())); + topDto.setVbusVol(battRtstate.getVbusVol()); + topDto.setOnlineVol(battRtstate.getOnlineVol()); + topDto.setRecordtime(ThreadLocalUtil.format(battRtstate.getRecDatetime(),1)); + } + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId()); + if(binf!=null){ + topDto.setBattGroupName(binf.getBattgroupName()); + topDto.setDevName(binf.getDevName()); + } + //鑾峰彇鏈烘埧淇℃伅 + StationInf stationInf = stationInfService.getStationInfById(binf.getStationId()); + if(stationInf!=null){ + topDto.setStationName(stationInf.getStationName()); + topDto.setProvice(stationInf.getProvice()); + topDto.setCity(stationInf.getCity()); + topDto.setCounty(stationInf.getCountry()); + topDto.setFullName(stationInf.getFullName()); + } + //鑾峰彇鐢垫簮淇℃伅 + PowerInf powerInf = powerInfService.getPowerInfById(binf.getPowerId()); + if(powerInf!=null){ + topDto.setPowerName(powerInf.getPowerName()); + } + //瀹炴椂鑾峰彇璁惧淇℃伅 + DeviceState deviceState = deviceStateService.getDevRealInfo(realDto.getDevId()); + if (deviceState != null) { + topDto.setDevState(deviceState.getDevWorkstate()); + topDto.setDevStateName(DevStateEnum.getValue(deviceState.getDevWorkstate())); + if (deviceState.getDevWorkstate() == DevStateEnum.DEVSTATE_2.getStateId()) {//鏍稿鏀剧數 + topDto.setCaptestGroupvol(deviceState.getDevCaptestGroupvol()); + topDto.setCaptestCurr(deviceState.getDevCaptestCurr()); + topDto.setCaptestTimelong(deviceState.getDevCaptestTimelong()); + topDto.setCaptestCap(deviceState.getDevCaptestCap()); + //鍓╀綑瀹归噺鍜屽墿浣欐椂闂磋绠� + Float restCap = batttestdataInfService.getLastTestDataRestCap(realDto.getBattgroupId()); + topDto.setRestCap(restCap); + //瀹炴椂缁勭鐢垫祦锛屽墿浣欏閲忥紝鏍囩О瀹归噺 + if(battRtstate!=null){ + Float restTime= BattCapFactory.getTheoryTime(battRtstate.getLoadCurr(), restCap, binf.getMoncapstd()); + topDto.setRestTime(restTime); + } + } + + //鑾峰彇涓�绾ф湭澶勭悊瀹炴椂鍛婅鏁� + Integer battALmNum = battalarmDataService.getBattAlmNum(realDto.getBattgroupId()); + topDto.setBattALmNum(battALmNum); + + Integer devALmNum = devalarmDataService.getDevAlmNum(realDto.getDevId()); + topDto.setDevALmNum(devALmNum); + + Integer pwrALmNum = pwrdevAlarmService.getPwrAlmNum(realDto.getPowerId()); + topDto.setPwrALmNum(pwrALmNum); + + //瀹炴椂鑾峰彇鐢垫簮淇℃伅(鏄惁瀛樺湪鐢垫簮鍛婅淇℃伅) + //PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId()); + topDto.setPwrState((pwrALmNum > 0 ? 1 : 0)); + topDto.setPwrStateName((pwrALmNum > 0 ? "鐢垫簮寮傚父" : "鐢垫簮姝e父")); + + Integer allALmNum = battALmNum + devALmNum + pwrALmNum; + topDto.setAllALmNum(allALmNum); + topDto.setSystemState((allALmNum > 0 ? 1 : 0)); + topDto.setSystemStateName((allALmNum > 0 ? "绯荤粺寮傚父" : "绯荤粺姝e父")); + } + return new Response().setII(1, true, topDto, "瀹炴椂椤甸潰澶撮儴鏁版嵁鎺ㄩ��"); + } catch (Exception e) { + return new Response().set(1, false, "瀹炴椂椤甸潰澶撮儴鏁版嵁鎺ㄩ��"); + } } //鏍规嵁pageType鑾峰彇杩斿洖鐣岄潰 @@ -116,41 +295,298 @@ } //鑾峰彇绠$悊鐣岄潰淇℃伅 private Response getManagePage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + try { + StationInf sinf=stationInfService.getStationInfById(realDto.getStaitonId()); + map.put("sinf",sinf); + PowerInf pinf=powerInfService.getPowerInfById(realDto.getPowerId()); + map.put("pinf",pinf); + BattInf binf=battInfService.getBinfByBattgroupId(realDto.getBattgroupId()); + map.put("binf",binf); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"绠$悊鐣岄潰淇℃伅鎺ㄩ��"); + }catch (Exception e){ + return new Response().set(1,false,"绠$悊鐣岄潰淇℃伅鎺ㄩ��"); + } } //鑾峰彇鑷剤鑳藉姏鐣岄潰淇℃伅 private Response getSelfPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"鑷剤鑳藉姏鐣岄潰淇℃伅鎺ㄩ��"); } //鑾峰彇3D鐣岄潰淇℃伅 private Response get3DPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"3D鐣岄潰淇℃伅淇℃伅鎺ㄩ��"); } //鑾峰彇鍥剧墖鐣岄潰淇℃伅 private Response getImgPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"鍥剧墖鐣岄潰淇℃伅淇℃伅鎺ㄩ��"); } //鑾峰彇娓╁害鐣岄潰淇℃伅 private Response getTmpPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + try { + //瀹炴椂鑾峰彇鍗曚綋淇℃伅 + List<BattRtdata> rtdataList = rtdataService.getRtdataRealInfo(realDto.getBattgroupId()); + if(rtdataList!=null&&rtdataList.size()>0){ + for(int i=0;i<rtdataList.size();i++) { + BattRtdata battRtdata=rtdataList.get(i); + if(i==0){ + maxData=battRtdata.getMonTmp(); + minData=battRtdata.getMonTmp(); + } + if (battRtdata.getMonTmp() >= maxData) { + maxData = battRtdata.getMonTmp(); + } + if (battRtdata.getMonTmp() <= minData) { + minData = battRtdata.getMonTmp(); + } + avgData += battRtdata.getMonTmp(); + } + avgData=avgData/rtdataList.size(); + } + map.put("rtdataList",rtdataList!=null?rtdataList:""); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"娓╁害鐣岄潰淇℃伅鎺ㄩ��"); + }catch (Exception e){ + return new Response().set(1,false,"娓╁害鐣岄潰淇℃伅鎺ㄩ��"); + } } //鑾峰彇鍐呴樆鐣岄潰淇℃伅 private Response getResPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + try { + //瀹炴椂鑾峰彇鍗曚綋淇℃伅 + List<BattRtdata> rtdataList = rtdataService.getRtdataRealInfo(realDto.getBattgroupId()); + if(rtdataList!=null&&rtdataList.size()>0){ + for(int i=0;i<rtdataList.size();i++) { + BattRtdata battRtdata=rtdataList.get(i); + if(i==0){ + maxData=battRtdata.getMonRes(); + minData=battRtdata.getMonRes(); + } + if (battRtdata.getMonRes() >= maxData) { + maxData = battRtdata.getMonRes(); + } + if (battRtdata.getMonRes() <= minData) { + minData = battRtdata.getMonRes(); + } + avgData += battRtdata.getMonRes(); + } + avgData=avgData/rtdataList.size(); + } + map.put("rtdataList",rtdataList!=null?rtdataList:""); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData); + //涓婁竴娆″唴闃绘祴璇曟暟鎹� + BattresdataInf rinfData= battresdataInfService.getLastTestData(realDto.getBattgroupId()); + map.put("rinfData",rinfData!=null?rinfData:""); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"鍐呴樆鐣岄潰淇℃伅鎺ㄩ��"); + }catch (Exception e){ + return new Response().set(1,false,"鍐呴樆鐣岄潰淇℃伅鎺ㄩ��"); + } } //鑾峰彇鐢靛帇鐣岄潰淇℃伅 private Response getVolPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + Float maxData=0f; + Float minData=0f; + Float avgData=0f; + try { + //瀹炴椂鑾峰彇鍗曚綋淇℃伅 + List<BattRtdata> rtdataList = rtdataService.getRtdataRealInfo(realDto.getBattgroupId()); + if(rtdataList!=null&&rtdataList.size()>0){ + for(int i=0;i<rtdataList.size();i++) { + BattRtdata battRtdata=rtdataList.get(i); + if(i==0){ + maxData=battRtdata.getMonVol(); + minData=battRtdata.getMonVol(); + } + if (battRtdata.getMonVol() >= maxData) { + maxData = battRtdata.getMonVol(); + } + if (battRtdata.getMonVol() <= minData) { + minData = battRtdata.getMonVol(); + } + avgData += battRtdata.getMonVol(); + } + avgData=avgData/rtdataList.size(); + } + map.put("rtdataList",rtdataList!=null?rtdataList:""); + map.put("maxData",maxData); + map.put("minData",minData); + map.put("avgData",avgData); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"鐢靛帇鐣岄潰淇℃伅鎺ㄩ��"); + }catch (Exception e){ + return new Response().set(1,false,"鐢靛帇鐣岄潰淇℃伅鎺ㄩ��"); + } } //鑾峰彇鐢垫簮鐣岄潰淇℃伅 private Response getPowerPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + try { + //瀹炴椂鑾峰彇鐢垫簮淇℃伅 + PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId()); + map.put("pwrdevAcdcdata",pwrdevAcdcdata!=null?pwrdevAcdcdata:""); + map.put("pageType",realDto.getPageType()); + return new Response().setII(1,true,map,"鐢垫簮鐣岄潰淇℃伅鎺ㄩ��"); + }catch (Exception e){ + return new Response().set(1,false,"鐢垫簮鐣岄潰淇℃伅鎺ㄩ��"); + } } //鑾峰彇绯荤粺姒傝堪鐣岄潰淇℃伅 private Response getSystemPage(RealTimeDto realDto) { - return new Response().set(1); + Map<String, Object> map=new HashMap<>(); + map.put("pageType",realDto.getPageType()); + try { + //瀹炴椂鑾峰彇鐢垫睜缁勪俊鎭� + BattRtstate battRtstate = battRtstateService.getBattRealInfo(realDto.getBattgroupId()); + if(battRtstate!=null){ + battRtstate.setLastCaptestStopTypeReason(StopReasonEnum.getValue(battRtstate.getLastCaptestStopType())); + battRtstate.setControlFailTypeReason(FailReasonEnum.getValue(battRtstate.getControlFailType())); + } + map.put("battRtstate",battRtstate!=null?battRtstate:""); + //瀹炴椂鑾峰彇璁惧淇℃伅 + DeviceState deviceState = deviceStateService.getDevRealInfo(realDto.getDevId()); + map.put("deviceState",deviceState!=null?deviceState:""); + //鑾峰彇涓婁竴娆℃爣鍑嗘牳瀹逛俊鎭� + BatttestdataInf tinfData= batttestdataInfService.getLastStandardTestData(realDto.getBattgroupId()); + map.put("tinfData",tinfData!=null?tinfData:""); + //鑾峰彇杩戝崐灏忔椂鐢垫簮鏁版嵁锛屾暣娴佸櫒鏁版嵁锛屾牳瀹硅澶囨暟鎹紙鎺ㄩ�佸疄鏃讹紝鎺ュ彛鏌ヨ鏈�杩戝崐灏忔椂鏁版嵁锛� + PwrdevAcdcdata pwrdevAcdcdata = pwrdevAcdcdataService.getPwrRealInfo(realDto.getPowerId()); + map.put("pwrdevAcdcdata",pwrdevAcdcdata!=null?pwrdevAcdcdata:""); + //鐢垫簮瀵硅薄(鏁存祦鍣ㄤ娇鐢ㄦ儏鍐�) + PowerInf powerInf = powerInfService.getPowerInfById(realDto.getPowerId()); + map.put("powerInf",powerInf!=null?powerInf:""); + //鑾峰彇鐢垫睜缁勭殑钃勭數姹犱俊鎭� + List<BattRtdata> battRtdataList = rtdataService.getRtdataRealInfo(realDto.getBattgroupId()); + SticRealRtdataDto dto=setMaxMinData(battRtdataList); + map.put("sticRtdata",dto); + return new Response().setII(1,true,map,"绯荤粺姒傝堪鎺ㄩ��"); + }catch (Exception e) { + e.printStackTrace(); + } + return new Response().set(1,false,"绯荤粺姒傝堪鎺ㄩ��"); } - + //璁$畻闆嗗悎涓崟浣撶數鍘嬶紝鍐呴樆锛屾俯搴︼紝瀹归噺鐨勬渶澶ф渶灏忓�� + public SticRealRtdataDto setMaxMinData(List<BattRtdata> battRtdataList){ + SticRealRtdataDto dto=new SticRealRtdataDto(); + Float maxCap = 0.0f; + Float minCap = 0.0f; + Float maxVol = 0.0f; + Float minVol = 0.0f; + Float maxTmp = 0.0f; + Float minTmp = 0.0f; + Float maxRes = 0.0f; + Float minRes = 0.0f; + List<Integer> maxCapNumList = new ArrayList<>(); + List<Integer> minCapNumList = new ArrayList<>(); + List<Integer> maxVolNumList = new ArrayList<>(); + List<Integer> minVolNumList = new ArrayList<>(); + List<Integer> maxTmpNumList = new ArrayList<>(); + List<Integer> minTmpNumList = new ArrayList<>(); + List<Integer> maxResNumList = new ArrayList<>(); + List<Integer> minResNumList = new ArrayList<>(); + //璁$畻闆嗗悎涓崟浣撶數鍘嬶紝鍐呴樆锛屾俯搴︼紝瀹归噺鐨勬渶澶ф渶灏忓�� + for (int i=0;i<battRtdataList.size();i++) { + BattRtdata rtdata=battRtdataList.get(i); + if(i==0){ + //璧嬪�煎垵濮嬪�� + maxVol = rtdata.getMonVol(); + minVol = rtdata.getMonVol(); + maxTmp = rtdata.getMonTmp(); + minTmp = rtdata.getMonTmp(); + maxRes = rtdata.getMonRes(); + minRes = rtdata.getMonRes(); + maxCap = rtdata.getMonCap(); + minCap = rtdata.getMonCap(); + } + if(rtdata.getMonVol()>=maxVol){ + maxVol = rtdata.getMonVol(); + } + if(rtdata.getMonVol()<=minVol){ + minVol = rtdata.getMonVol(); + } + if(rtdata.getMonTmp()>=maxTmp){ + maxTmp = rtdata.getMonTmp(); + } + if(rtdata.getMonTmp()<=minTmp){ + minTmp = rtdata.getMonTmp(); + } + if(rtdata.getMonRes()>=maxRes){ + maxRes = rtdata.getMonRes(); + } + if(rtdata.getMonRes()<=minRes){ + minRes = rtdata.getMonRes(); + } + if(rtdata.getMonCap()>=maxCap){ + maxCap = rtdata.getMonCap(); + } + if(rtdata.getMonCap()<=minCap){ + minCap = rtdata.getMonCap(); + } + } + dto.setMaxCap(maxCap); + dto.setMinCap(minCap); + dto.setMaxVol(maxVol); + dto.setMinVol(minVol); + dto.setMaxTmp(maxTmp); + dto.setMinTmp(minTmp); + dto.setMaxRes(maxRes); + dto.setMinRes(minRes); + for (BattRtdata rtdata:battRtdataList) { + if(rtdata.getMonVol()==maxVol){ + maxVolNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonVol()==minVol){ + minVolNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonTmp()==maxTmp){ + maxTmpNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonTmp()==minTmp){ + minTmpNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonRes()==maxRes){ + maxResNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonRes()==minRes){ + minResNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonCap()==maxCap){ + maxCapNumList.add(rtdata.getMonNum()); + } + if(rtdata.getMonCap()==minCap){ + minCapNumList.add(rtdata.getMonNum()); + } + } + dto.setMaxCapNumList(maxCapNumList); + dto.setMinCapNumList(minCapNumList); + dto.setMaxVolNumList(maxVolNumList); + dto.setMinVolNumList(minVolNumList); + dto.setMaxTmpNumList(maxTmpNumList); + dto.setMinTmpNumList(minTmpNumList); + dto.setMaxResNumList(maxResNumList); + dto.setMinResNumList(minResNumList); + return dto; + } @OnClose public void onClose(CloseReason closeReason){ System.err.println("closeReason = " + closeReason); diff --git a/src/main/resources/mapper/BattAlmparamMapper.xml b/src/main/resources/mapper/BattAlmparamMapper.xml new file mode 100644 index 0000000..87b1535 --- /dev/null +++ b/src/main/resources/mapper/BattAlmparamMapper.xml @@ -0,0 +1,37 @@ +<?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.whyc.mapper.BattAlmparamMapper"> + + <select id="getBattAlmParam" resultType="com.whyc.pojo.db_param.BattAlmparam"> + select distinct tb_batt_almparam.*,tb_batt_inf.battgroup_name + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf,db_param.tb_batt_almparam + <where> + tb_batt_inf.battgroup_id=tb_batt_almparam.battgroup_id + and tb_batt_inf.station_id=tb_station_inf.station_id + <if test="almDto.provice!=null"> + and tb_station_inf.provice=#{almDto.provice} + </if> + <if test="almDto.city!=null"> + and tb_station_inf.city=#{almDto.city} + </if> + <if test="almDto.country!=null"> + and tb_station_inf.country=#{almDto.country} + </if> + <if test="almDto.stationName!=null"> + and tb_station_inf.station_name=#{almDto.stationName} + </if> + <if test="almDto.battgroupName!=null"> + and tb_batt_inf.battgroup_name=#{almDto.battgroupName} + </if> + <if test="almDto.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{almDto.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/BattInfMapper.xml b/src/main/resources/mapper/BattInfMapper.xml index e660dc9..1abbd67 100644 --- a/src/main/resources/mapper/BattInfMapper.xml +++ b/src/main/resources/mapper/BattInfMapper.xml @@ -110,5 +110,296 @@ </if> </where> </select> - + <select id="getDevStatistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.dev_id,tb_batt_inf.dev_name,tb_batt_inf.dev_type,tb_batt_inf.dev_num,tb_batt_inf.dev_ip + ,tb_batt_inf.station_id,tb_batt_inf.power_id + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc + </where> + </select> + <select id="getBattCountBydevId" resultType="java.lang.Integer"> + select ifnull(count(*),0) from db_station.tb_batt_inf + <where> + dev_id=#{devId} + </where> + </select> + <select id="getBattStatistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.stationType!=null"> + and tb_station_inf.station_type=#{stic.stationType} + </if> + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.monvolstd!=null"> + and tb_batt_inf.monvolstd=#{stic.monvolstd} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getMonStatistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.*,tb_station_inf.station_name from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.moncapstd!=null"> + and tb_batt_inf.moncapstd=#{stic.moncapstd} + </if> + <if test="stic.monvolstd!=null"> + and tb_batt_inf.monvolstd=#{stic.monvolstd} + </if> + <if test="stic.startTime!=null"> + and tb_batt_inf.inuse_time>=#{stic.startTime} + </if> + <if test="stic.endTime!=null"> + and tb_batt_inf.inuse_time<=#{stic.endTime} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + </where> + </select> + <select id="getBattCompare15Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getBattCompare16Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.moncapstd!=null"> + and tb_batt_inf.moncapstd=#{stic.moncapstd} + </if> + <if test="stic.inuseStartTime!=null"> + and tb_batt_inf.inuse_time>=#{stic.inuseStartTime} + </if> + <if test="stic.inuseEndTime!=null"> + and tb_batt_inf.inuse_time<=#{stic.inuseEndTimee} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getBattCompare17Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.product!=null"> + and tb_batt_inf.product=#{stic.product} + </if> + <if test="stic.inuseStartTime!=null"> + and tb_batt_inf.inuse_time>=#{stic.inuseStartTime} + </if> + <if test="stic.inuseEndTime!=null"> + and tb_batt_inf.inuse_time<=#{stic.inuseEndTimee} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getDischr5Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getDischr6Statistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> + <select id="getPerformanceStatistic" resultType="com.whyc.pojo.db_station.BattInf"> + select distinct tb_batt_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_batt_inf.dev_id asc,battgroup_id asc + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/BattalarmDataMapper.xml b/src/main/resources/mapper/BattalarmDataMapper.xml new file mode 100644 index 0000000..7c0ed22 --- /dev/null +++ b/src/main/resources/mapper/BattalarmDataMapper.xml @@ -0,0 +1,47 @@ +<?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.whyc.mapper.BattalarmDataMapper"> + + <select id="getBattAlmReal" resultType="com.whyc.pojo.db_alarm.BattalarmData"> + select tb_battalarm_data.*,tb_batt_inf.battgroup_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_alarm.tb_battalarm_data,db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_battalarm_data.battgroup_id=tb_batt_inf.battgroup_id + and tb_batt_inf.station_id=tb_station_inf.station_id + <if test="provice!=null"> + and tb_station_inf.provice=#{provice} + </if> + <if test="city!=null"> + and tb_station_inf.city=#{city} + </if> + <if test="country!=null"> + and tb_station_inf.country=#{country} + </if> + <if test="stationName!=null"> + and tb_station_inf.station_name like concat('%',#{stationName},'%') + </if> + <if test="almLevel!=null"> + and tb_battalarm_data.alm_level=#{almLevel} + </if> + <if test="almIds!=null"> + <if test="almIds.size==0"> + and tb_battalarm_data.alm_id =0 + </if> + <if test="almIds.size>0"> + and tb_battalarm_data.alm_id in + <foreach collection="almIds" item="almId" open="(" separator="," close=")"> + #{almId} + </foreach> + </if> + </if> + <if test="uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{uid} + ) + </if> + + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/BatttestdataInfMapper.xml b/src/main/resources/mapper/BatttestdataInfMapper.xml new file mode 100644 index 0000000..a6b1e32 --- /dev/null +++ b/src/main/resources/mapper/BatttestdataInfMapper.xml @@ -0,0 +1,63 @@ +<?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.whyc.mapper.BatttestdataInfMapper"> + + <select id="getBattTinfStatistic" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf"> + select tb_batttestdata_inf.* + ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + ,tb_batt_inf.battgroup_name,tb_batt_inf.power_id,tb_batt_inf.station_id,tb_batt_inf.dev_id + from db_batt_testdata.tb_batttestdata_inf,db_station.tb_station_inf,db_station.tb_batt_inf + <where> + tb_batttestdata_inf.battgroup_id=tb_batt_inf.battgroup_id + and tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city= #{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country= #{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name= #{stic.stationName} + </if> + <if test="stic.testType!=null"> + and tb_batttestdata_inf.test_type= #{stic.testType} + </if> + <if test="stic.testStartTime!=null"> + and tb_batttestdata_inf.test_starttime>=#{stic.testStartTime} + </if> + <if test="stic.testEndTime!=null"> + and tb_batttestdata_inf.test_starttime<=#{stic.testEndTime} + </if> + <if test="stic.uid>100"> + and tb_station_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + </where> + order by tb_batttestdata_inf.battgroup_id asc, tb_batttestdata_inf.test_record_count asc + </select> + <select id="getNoDischargeData" resultType="com.whyc.pojo.db_batt_testdata.BatttestdataInf"> + select * from db_batt_testdata.tb_batttestdata_inf + <where> + battgroup_id=#{battgroupId} and test_type=3 + and (test_starttype!=3 or test_timelong <7200) + <if test="testStartTime!=null"> + and tb_batttestdata_inf.test_starttime>=#{stic.testStartTime} + </if> + <if test="testEndTime!=null"> + and tb_batttestdata_inf.test_starttime<=#{stic.testEndTime} + </if> + <if test="typeList!=null"> + and test_stoptype in + <foreach item="item" index="index" collection="typeList" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/CommonMapper.xml b/src/main/resources/mapper/CommonMapper.xml index 1b5bc97..8a2a3b5 100644 --- a/src/main/resources/mapper/CommonMapper.xml +++ b/src/main/resources/mapper/CommonMapper.xml @@ -6,7 +6,7 @@ <select id="getMaxValue" resultType="java.lang.Object"> select max(${field}) from ${schema}.${table} </select> - <select id="existTable" resultType="java.lang.Boolean"> + <select id="existTable" resultType="java.lang.String"> select table_name from `INFORMATION_SCHEMA`.`TABLES` diff --git a/src/main/resources/mapper/DevalarmDataMapper.xml b/src/main/resources/mapper/DevalarmDataMapper.xml new file mode 100644 index 0000000..301dc63 --- /dev/null +++ b/src/main/resources/mapper/DevalarmDataMapper.xml @@ -0,0 +1,46 @@ +<?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.whyc.mapper.DevalarmDataMapper"> + <select id="getDevAlmReal" resultType="com.whyc.pojo.db_alarm.DevalarmData"> + select tb_devalarm_data.*,tb_batt_inf.dev_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_alarm.tb_devalarm_data,db_station.tb_batt_inf,db_station.tb_station_inf + <where> + tb_devalarm_data.dev_id=tb_batt_inf.dev_id + and tb_batt_inf.station_id=tb_station_inf.station_id + <if test="provice!=null"> + and tb_station_inf.provice=#{provice} + </if> + <if test="city!=null"> + and tb_station_inf.city=#{city} + </if> + <if test="country!=null"> + and tb_station_inf.country=#{country} + </if> + <if test="stationName!=null"> + and tb_station_inf.station_name like concat('%',#{stationName},'%') + </if> + <if test="almLevel!=null"> + and tb_devalarm_data.alm_level=#{almLevel} + </if> + <if test="almIds!=null"> + <if test="almIds.size==0"> + and tb_devalarm_data.alm_id =0 + </if> + <if test="almIds.size>0"> + and tb_devalarm_data.alm_id in + <foreach collection="almIds" item="almId" open="(" separator="," close=")"> + #{almId} + </foreach> + </if> + </if> + <if test="uid>100"> + and tb_batt_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{uid} + ) + </if> + + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/DeviceSetparamMapper.xml b/src/main/resources/mapper/DeviceSetparamMapper.xml new file mode 100644 index 0000000..af8c0bc --- /dev/null +++ b/src/main/resources/mapper/DeviceSetparamMapper.xml @@ -0,0 +1,31 @@ +<?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.whyc.mapper.DeviceSetparamMapper"> + + <update id="updateParam"> + update db_ram_db.tb_device_setparam + set + hourrate=#{hourrate}, + discurr=#{discurr}, + discap=#{discap}, + distime=#{distime}, + groupvol_low=#{groupvolLow}, + monomervol_low=#{monomervolLow}, + monomerlowcount=#{monomerlowcount}, + onlinevollowaction=#{onlinevollowaction}, + dcvolhighlimit=#{dcvolhighlimit}, + chargecurrset=#{chargecurrset}, + monomertmp_high=#{monomertmpHigh}, + monvolstd=#{monvolstd}, + diswaittime=#{diswaittime}, + moncapstd=#{moncapstd} + where dev_id = #{devId} + </update> + <select id="getParam" resultType="com.whyc.pojo.db_ram_db.DeviceSetparam"> + select tb_device_setparam.*, tb_batt_inf.battgroup_name, tb_batt_inf.dev_name,tb_station_inf.station_name, tb_station_inf.provice, tb_station_inf.city, tb_station_inf.country, tb_station_inf.full_name + from db_ram_db.tb_device_setparam, db_station.tb_batt_inf, db_station.tb_station_inf + where tb_device_setparam.dev_id = tb_batt_inf.dev_id + and tb_batt_inf.station_id = tb_station_inf.station_id + and tb_device_setparam.dev_id = #{devId} and tb_device_setparam.battgroupnum = #{battGroupNum} + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/DeviceStateMapper.xml b/src/main/resources/mapper/DeviceStateMapper.xml new file mode 100644 index 0000000..33a5492 --- /dev/null +++ b/src/main/resources/mapper/DeviceStateMapper.xml @@ -0,0 +1,38 @@ +<?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.whyc.mapper.DeviceStateMapper"> + + <select id="getDeviceStateStatistic" resultType="com.whyc.pojo.db_ram_db.DeviceState"> + select tb_device_state.* + ,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name,tb_batt_inf.dev_name + ,tb_batt_inf.power_id,tb_batt_inf.station_id + from db_ram_db.tb_device_state,db_station.tb_station_inf,db_station.tb_batt_inf + <where> + tb_device_state.dev_id=tb_batt_inf.dev_id + and tb_batt_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city= #{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country= #{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name= #{stic.stationName} + </if> + <if test="stic.devWorkstate!=null"> + and tb_device_state.dev_workstate= #{stic.devWorkstate} + </if> + <if test="stic.uid>100"> + and tb_station_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_device_state.dev_id asc + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/PowerInfMapper.xml b/src/main/resources/mapper/PowerInfMapper.xml index c72433e..7520c9f 100644 --- a/src/main/resources/mapper/PowerInfMapper.xml +++ b/src/main/resources/mapper/PowerInfMapper.xml @@ -77,5 +77,49 @@ </if> </where> </select> + <select id="getPowerStatistic" resultType="com.whyc.pojo.db_station.PowerInf"> + select distinct tb_power_inf.* + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_power_inf,db_station.tb_station_inf + <where> + tb_power_inf.station_id=tb_station_inf.station_id + <if test="stic.provice!=null"> + and tb_station_inf.provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and tb_station_inf.city=#{stic.city} + </if> + <if test="stic.country!=null"> + and tb_station_inf.country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and tb_station_inf.station_name=#{stic.stationName} + </if> + <if test="stic.stationType!=null"> + and tb_station_inf.station_type=#{stic.stationType} + </if> + <if test="stic.stationType!=null"> + and tb_power_inf.company=#{stic.company} + </if> + <if test="stic.uid>100"> + and tb_power_inf.power_id in( + select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by tb_power_inf.power_id asc + </where> + </select> + <select id="getGroupName" resultType="java.lang.String"> + select distinct ifnull(baoji_group_name,'none') from db_user.tb_baojigroup,db_user.tb_baojigroup_power + <where> + tb_baojigroup.baoji_group_id=tb_baojigroup_power.baoji_group_id + and tb_baojigroup.team_flag=1 + <if test="powerId!=null"> + and power_id=#{powerId} + </if> + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/PwrdevAlarmMapper.xml b/src/main/resources/mapper/PwrdevAlarmMapper.xml new file mode 100644 index 0000000..82be3f7 --- /dev/null +++ b/src/main/resources/mapper/PwrdevAlarmMapper.xml @@ -0,0 +1,47 @@ +<?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.whyc.mapper.PwrdevAlarmMapper"> + <select id="getPwrAlmReal" resultType="com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm"> + select tb_pwrdev_alarm.*,tb_power_inf.power_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_pwrdev_alarm.tb_pwrdev_alarm,db_station.tb_power_inf,db_station.tb_station_inf + <where> + tb_pwrdev_alarm.power_id=tb_power_inf.power_id + and tb_power_inf.station_id=tb_station_inf.station_id + <if test="provice!=null"> + and tb_station_inf.provice=#{provice} + </if> + <if test="city!=null"> + and tb_station_inf.city=#{city} + </if> + <if test="country!=null"> + and tb_station_inf.country=#{country} + </if> + <if test="stationName!=null"> + and tb_station_inf.station_name like concat('%',#{stationName},'%') + </if> + <if test="almLevel!=null"> + and tb_pwrdev_alarm.alm_level=#{almLevel} + </if> + <if test="almIds!=null"> + <if test="almIds.size==0"> + and tb_pwrdev_alarm.alm_id =0 + </if> + <if test="almIds.size>0"> + and tb_pwrdev_alarm.alm_id in + <foreach collection="almIds" item="almId" open="(" separator="," close=")"> + #{almId} + </foreach> + </if> + </if> + + <if test="uid>100"> + and tb_pwrdev_alarm.power_id in( + select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{uid} + ) + </if> + + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/PwrdevAlarmParamMapper.xml b/src/main/resources/mapper/PwrdevAlarmParamMapper.xml new file mode 100644 index 0000000..04568da --- /dev/null +++ b/src/main/resources/mapper/PwrdevAlarmParamMapper.xml @@ -0,0 +1,37 @@ +<?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.whyc.mapper.PwrdevAlarmParamMapper"> + + <select id="getPwrAlmParam" resultType="com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam"> + select distinct tb_pwrdev_alarm_param.*,tb_power_inf.power_name + ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name + from db_station.tb_power_inf,db_station.tb_station_inf,db_pwrdev_alarm.tb_pwrdev_alarm_param + <where> + tb_power_inf.power_id=tb_pwrdev_alarm_param.power_id + and tb_power_inf.station_id=tb_station_inf.station_id + <if test="almDto.provice!=null"> + and tb_station_inf.provice=#{almDto.provice} + </if> + <if test="almDto.city!=null"> + and tb_station_inf.city=#{almDto.city} + </if> + <if test="almDto.country!=null"> + and tb_station_inf.country=#{almDto.country} + </if> + <if test="almDto.stationName!=null"> + and tb_station_inf.station_name=#{almDto.stationName} + </if> + <if test="almDto.powerName!=null"> + and tb_power_inf.power_name=#{almDto.powerName} + </if> + <if test="almDto.uid>100"> + and tb_power_inf.power_id in( + select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{almDto.uid} + ) + </if> + order by tb_power_inf.power_id asc + </where> + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/StationInfMapper.xml b/src/main/resources/mapper/StationInfMapper.xml index 8e4c989..f42f909 100644 --- a/src/main/resources/mapper/StationInfMapper.xml +++ b/src/main/resources/mapper/StationInfMapper.xml @@ -179,5 +179,33 @@ </if> </where> </select> + <select id="getStationStatistic" resultType="com.whyc.pojo.db_station.StationInf"> + select distinct * from db_station.tb_station_inf + <where> + <if test="stic.provice!=null"> + and provice=#{stic.provice} + </if> + <if test="stic.city!=null"> + and city=#{stic.city} + </if> + <if test="stic.country!=null"> + and country=#{stic.country} + </if> + <if test="stic.stationName!=null"> + and station_name=#{stic.stationName} + </if> + <if test="stic.stationType!=null"> + and station_type=#{stic.stationType} + </if> + <if test="stic.uid>100"> + and tb_station_inf.station_id in( + select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr + where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id + and tb_baojigroup_usr.uid=#{stic.uid} + ) + </if> + order by station_id asc + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index 6f164c7..95ddee6 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -55,11 +55,10 @@ id in( select distinct uid from db_user.tb_baojigroup_usr <where> - baoji_group_id in( + baoji_group_id in <foreach collection="baojiIdList" item="baojiId" open="(" separator="," close=")"> #{baojiId} </foreach> - ) </where> ) </where> -- Gitblit v1.9.1