From f26dc28abc0f5efc0ab0143d3554474ebbc6c169 Mon Sep 17 00:00:00 2001 From: whycxzp <glperry@163.com> Date: 星期四, 10 四月 2025 09:32:03 +0800 Subject: [PATCH] 提交电池告警参数,电池实时数据历史和电源实时数据历史 --- src/main/java/com/whyc/service/SubTableService.java | 217 +++++++++++++++++++ src/main/java/com/whyc/service/BattRealTimeDataHistoryService.java | 31 ++ src/main/java/com/whyc/controller/BattRealTimeDataHistoryController.java | 28 ++ src/main/java/com/whyc/pojo/db_power_history/PowerRealTimeDataHistory.java | 204 ++++++++++++++++++ src/main/java/com/whyc/pojo/db_power_history/BattRealTimeDataHistory.java | 43 +++ src/main/java/com/whyc/service/PowerRealTimeDataHistoryService.java | 29 ++ src/main/java/com/whyc/controller/PowerRealTimeDataHistoryController.java | 29 ++ src/main/java/com/whyc/util/SubTablePageInfoUtil.java | 44 +++ 8 files changed, 624 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/whyc/controller/BattRealTimeDataHistoryController.java b/src/main/java/com/whyc/controller/BattRealTimeDataHistoryController.java new file mode 100644 index 0000000..8cb10d1 --- /dev/null +++ b/src/main/java/com/whyc/controller/BattRealTimeDataHistoryController.java @@ -0,0 +1,28 @@ +package com.whyc.controller; + +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Response; +import com.whyc.service.BattRealTimeDataHistoryService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; + +@RestController +@Api(tags = "鐢垫睜瀹炴椂鏁版嵁鍘嗗彶") +@RequestMapping("battRealTimeDataHistory") +public class BattRealTimeDataHistoryController { + + @Autowired + private BattRealTimeDataHistoryService service; + + @GetMapping("getPage") + public Response<PageInfo> getPage(@RequestParam int pageNum,@RequestParam int pageSize, @RequestParam int battGroupId, + @RequestParam String startTime,@RequestParam String endTime) throws ParseException, InterruptedException { + return service.getPage(pageNum,pageSize,battGroupId,startTime,endTime); + } +} diff --git a/src/main/java/com/whyc/controller/PowerRealTimeDataHistoryController.java b/src/main/java/com/whyc/controller/PowerRealTimeDataHistoryController.java new file mode 100644 index 0000000..e04bcbe --- /dev/null +++ b/src/main/java/com/whyc/controller/PowerRealTimeDataHistoryController.java @@ -0,0 +1,29 @@ +package com.whyc.controller; + +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Response; +import com.whyc.service.BattRealTimeDataHistoryService; +import com.whyc.service.PowerRealTimeDataHistoryService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; + +@RestController +@Api(tags = "鐢垫簮瀹炴椂鏁版嵁鍘嗗彶") +@RequestMapping("powerRealTimeDataHistory") +public class PowerRealTimeDataHistoryController { + + @Autowired + private PowerRealTimeDataHistoryService service; + + @GetMapping("getPage") + public Response<PageInfo> getPage(@RequestParam int pageNum,@RequestParam int pageSize, @RequestParam int powerId, + @RequestParam String startTime,@RequestParam String endTime) throws ParseException, InterruptedException { + return service.getPage(pageNum,pageSize,powerId,startTime,endTime); + } +} diff --git a/src/main/java/com/whyc/pojo/db_power_history/BattRealTimeDataHistory.java b/src/main/java/com/whyc/pojo/db_power_history/BattRealTimeDataHistory.java new file mode 100644 index 0000000..251181d --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_power_history/BattRealTimeDataHistory.java @@ -0,0 +1,43 @@ +package com.whyc.pojo.db_power_history; + +import lombok.Data; +import lombok.ToString; + +import java.util.Date; + +/** + * 鐢垫睜瀹炴椂鏁版嵁鍘嗗彶 + */ +@Data +@ToString +public class BattRealTimeDataHistory { + + private Integer num; + private Integer battGroupId; + private Date recordTime; + private Float onlineVol; + private Float groupVol; + private Float groupTmp; + private Float groupCurr; + private Integer battState; + private Date testStartTime; + private Float battTestType; + private Integer battTestLong; + private Float battTestCap; + private Float battRealCap; + private Integer monNum; + private Float monVol; + private Float monTmp; + private Float monRes; + private Float monSer; + private Float monConnRes; + + private Date startTime; + private Date endTime; + private String recordYearMonth; + + private Integer limitStart; + private Integer limitEnd; + + +} diff --git a/src/main/java/com/whyc/pojo/db_power_history/PowerRealTimeDataHistory.java b/src/main/java/com/whyc/pojo/db_power_history/PowerRealTimeDataHistory.java new file mode 100644 index 0000000..aa8bb23 --- /dev/null +++ b/src/main/java/com/whyc/pojo/db_power_history/PowerRealTimeDataHistory.java @@ -0,0 +1,204 @@ +package com.whyc.pojo.db_power_history; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.util.Date; + +/** + * 鐢垫簮瀹炴椂鏁版嵁鍘嗗彶 + */ +@Data +@ToString +public class PowerRealTimeDataHistory { + + private Integer num; + private Integer powerId; + private Integer devType; + private Date recordTime; + @ApiModelProperty("鍏呯數鏈鸿緭鍑虹數鍘�") + private Float charOutVol; + @ApiModelProperty("鍏呯數鏈鸿緭鍑虹數娴�") + private Float charOutCurr; + @ApiModelProperty("钃勭數姹犵數鍘�(鏁寸粍锛�") + private Float groupVol; + @ApiModelProperty("钃勭數姹犵數娴�(鏁寸粍)") + private Float groupCurr; + @ApiModelProperty("钃勭數姹犳俯搴︼紙鏁寸粍锛�") + private Float groupTmp; + @ApiModelProperty("鎺у埗姣嶇嚎鐢靛帇") + private Float busVol; + @ApiModelProperty("涓�璺氦娴丄鐩哥數鍘�") + private Float ac1VolA; + @ApiModelProperty("涓�璺氦娴丅鐩哥數鍘�") + private Float ac1VolB; + @ApiModelProperty("涓�璺氦娴丆鐩哥數鍘�") + private Float ac1VolC; + @ApiModelProperty("浜岃矾浜ゆ祦A鐩哥數鍘�") + private Float ac2VolA; + @ApiModelProperty("浜岃矾浜ゆ祦B鐩哥數鍘�") + private Float ac2VolB; + @ApiModelProperty("浜岃矾浜ゆ祦C鐩哥數鍘�") + private Float ac2VolC; + @ApiModelProperty("缁濈紭鐩戞祴姣嶇嚎姝e鍦扮數鍘�") + private Float busVolPositive; + @ApiModelProperty("缁濈紭鐩戞祴姣嶇嚎璐熷鍦扮數鍘�") + private Float busVolNegative; + @ApiModelProperty("缁濈紭鐩戞祴姣嶇嚎姝e鍦扮數闃�") + private Float busResPositive; + @ApiModelProperty("缁濈紭鐩戞祴姣嶇嚎璐熷鍦扮數闃�") + private Float busResNegative; + @ApiModelProperty("鍏呯數鏈哄潎鍏�/娴厖锛�0锛氭诞鍏� 锛�1锛氬潎鍏咃級") + private Integer charJunFloat; + @ApiModelProperty("鍏呯數鏈哄紑鏈�/鍏虫満锛�0锛氬叧鏈� 1锛氬紑鏈猴級") + private Integer charOpenClose; + @ApiModelProperty("鍏呯數鏈烘ā鍧楀紓甯�/姝e父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer charModelError; + @ApiModelProperty("鍏呯數鏈鸿緭鍑鸿繃鍘�/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer charOutOverVol; + @ApiModelProperty("鍏呯數鏈鸿緭鍑烘瑺鍘�/姝e父锛�0锛氭甯� 1锛氭瑺鍘嬶級") + private Integer charOutLessVol; + @ApiModelProperty("钃勭數姹犵粍杩囧帇/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer battOverVol; + @ApiModelProperty("钃勭數姹犵粍娆犲帇/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer battLessVol; + @ApiModelProperty("钃勭數姹犵粍鍗曡妭鐢垫睜杩囧帇/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer battMonOverVol; + @ApiModelProperty("钃勭數姹犵粍鍗曡妭鐢垫睜娆犲帇/姝e父锛�0锛氭甯� 1锛氭瑺鍘嬶級") + private Integer battMonLessVol; + @ApiModelProperty("钃勭數姹犲厖鏀剧數鐘舵�侊紙0锛氬厖鐢� 1锛氭斁鐢碉級") + private Integer battState; + @ApiModelProperty("鎺ф瘝杩囧帇/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer controlBusOverVol; + @ApiModelProperty("鎺ф瘝娆犲帇/姝e父锛�0锛氭甯� 1锛氭瑺鍘嬶級") + private Integer controlBusLessVol; + @ApiModelProperty("缁濈紭姣嶇嚎鐢靛帇寮傚父/姝e父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer insualBusVolError; + @ApiModelProperty("鎺ф瘝姝f瘝绾跨粷缂樺紓甯�/姝e父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer controlBusPositiveError; + @ApiModelProperty("鎺ф瘝璐熸瘝绾跨粷缂樺紓甯�/姝e父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer controlBusNegativeError; + @ApiModelProperty("缁濈紭姣嶇嚎浜ゆ祦绐滃叆鐢靛帇杩囧帇/姝e父锛�0锛氭甯� 1锛氳繃鍘嬶級") + private Integer insualBusAcVolOverVol; + @ApiModelProperty("鐢垫睜宸℃浠紓甯�/姝e父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer battPatrolDetectorError; + @ApiModelProperty("缁濈紭寮傚父锛�0锛氭甯� 1锛氬紓甯革級") + private Integer insualError; + @ApiModelProperty("1#鍏�1#浜ゆ祦杩涚嚎寮�鍏砆F11锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn1Qf11; + @ApiModelProperty("1#鍏�2#浜ゆ祦杩涚嚎寮�鍏砆F12锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn1Qf12; + @ApiModelProperty("1#鍏呰緭鍑鸿嚦鈪犳姣嶇嚎寮�鍏矰K11锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBusDk11; + @ApiModelProperty("1#鍏呰緭鍑鸿嚦1缁勭數姹犲紑鍏矰K12锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBattDk12; + @ApiModelProperty("2缁勮搫鐢垫睜杈撳嚭寮�鍏�2QF1锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer battOutQf1; + @ApiModelProperty("姣嶈仈寮�鍏�1lzk(0:閫�鍑� 1锛氭姇鍏�)") + private Integer busSwitchN1lzk; + @ApiModelProperty("1#浜ゆ祦鏁呴殰(0锛氶��鍑� 1锛氭姇鍏�)") + private Integer ac1Fault; + @ApiModelProperty("2#浜ゆ祦鏁呴殰锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer ac2Fault; + @ApiModelProperty("涓诲紑鍏虫晠闅滐紙0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer mainSwitchFault; + @ApiModelProperty("棣堢嚎鑴辨墸鏁呴殰锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer feederTripFault; + @ApiModelProperty("闃查浄鍣ㄦ晠闅滐紙0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer thunderFault; + @ApiModelProperty("浜屾棣堢嚎鐩掗�氳鏁呴殰[bit0-1#棣堢嚎鐩掗�氳鏁呴殰 bit1-2#棣堢嚎鐩掗�氳鏁呴殰 ... bit7-8#棣堢嚎鐩掗�氳鏁呴殰]") + private Integer feedersCommFault; + @ApiModelProperty("浜屾7-9鍙锋満缁勭洿娴佺郴缁�1#棣堢嚎鏌滈绾垮紑鍏崇姸鎬乕bit0-ZK201 bit1-ZK202 ... bit5-ZK206]") + private Integer dcFeeder7To9Switch1; + @ApiModelProperty("浜屾7鍙锋満缁勭洿娴佸垎鐢垫煖棣堢嚎寮�鍏崇姸鎬乕bit0-ZK201 bit1-ZK202 bit29-ZK230]") + private Integer dcFeeder7Switch; + @ApiModelProperty("涓�娈�7鍙锋満缁勭洿娴佸垎鐢垫煖涓�娈垫瘝绾�1#杩涚嚎寮�鍏砕K11") + private Integer dcFeeder7Bus1Zk11; + @ApiModelProperty("涓�娈�7鍙锋満缁勭洿娴佸垎鐢垫煖涓�娈垫瘝绾�2#杩涚嚎寮�鍏砕K12") + private Integer dcFeeder7Bus2Zk12; + @ApiModelProperty("浜屾8鍙锋満缁勭洿娴佸垎鐢垫煖棣堢嚎寮�鍏砙bit0-棣堢嚎寮�鍏砕K201 bit1-棣堢嚎寮�鍏砕K202 ... bit29-棣堢嚎寮�鍏砕K230 ]") + private Integer dcFeeder8Switch; + @ApiModelProperty("涓�娈�8鍙锋満鐩存祦鍒嗙數鏌滀竴娈垫瘝绾�1#杩涚嚎寮�鍏砕K11") + private Integer dcFeeder8Bus1Zk11; + @ApiModelProperty("涓�娈�8鍙锋満鐩存祦鍒嗙數鏌滀竴娈垫瘝绾�2#杩涚嚎寮�鍏砕K12") + private Integer dcFeeder8Bus2Zk12; + @ApiModelProperty("浜屾9鍙锋満缁勭洿娴佸垎鐢垫煖棣堢嚎寮�鍏砙bit0-棣堢嚎寮�鍏砕K201 bit1-棣堢嚎寮�鍏砕K202... bit29-棣堢嚎寮�鍏砕K230]") + private Integer dcFeeder9Switch; + @ApiModelProperty("涓�娈�9鍙锋満缁勭洿娴佸垎鐢垫煖涓�娈垫瘝绾�1#杩涚嚎寮�鍏砕K11") + private Integer dcFeeder9Bus1Zk11; + @ApiModelProperty("涓�娈�9鍙锋満缁勭洿娴佸垎鐢垫煖涓�娈垫瘝绾�2#杩涚嚎寮�鍏砕K12") + private Integer dcFeeder9Bus2Zk12; + @ApiModelProperty("涓�娈�7鍙锋満缁勪氦娴佸垎鐢垫煖棣堢嚎寮�鍏砙bit0-棣堢嚎寮�鍏砆101 bit1-棣堢嚎寮�鍏砆102... bit29-棣堢嚎寮�鍏砆130]") + private Integer acFeeder7Switch; + @ApiModelProperty("涓�娈�7鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎寮�鍏砆11") + private Integer acFeeder7AcIn1Q11; + @ApiModelProperty("涓�娈�7鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎寮�鍏砆12") + private Integer acFeeder7AcIn2Q12; + @ApiModelProperty("涓�娈�7鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder7AcIn1Fault; + @ApiModelProperty("涓�娈�7鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder7AcIn2Fault; + @ApiModelProperty("涓�娈�9鍙锋満缁勪氦娴佸垎鐢垫煖棣堢嚎寮�鍏砙bit0-棣堢嚎寮�鍏砆101 bit1-棣堢嚎寮�鍏砆102 bit29-棣堢嚎寮�鍏砆130]") + private Integer acFeeder9Switch; + @ApiModelProperty("涓�娈�9鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎寮�鍏砆11") + private Integer acFeeder9AcIn1Q11; + @ApiModelProperty("涓�娈�9鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎寮�鍏砆12") + private Integer acFeeder9AcIn2Q12; + @ApiModelProperty("涓�娈�9鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder9AcIn1Fault; + @ApiModelProperty("涓�娈�9鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder9AcIn2Fault; + @ApiModelProperty("浜屾缁濈紭鐩戞祴浠垎鏈洪�氫俊鐘舵�乕bit0-1#缁濈紭鐩戞祴浠� bit1-2#缁濈紭鐩戞祴浠� bit3-3#缁濈紭鐩戞祴浠猐锛�0-姝e父 1-鏁呴殰锛�") + private Integer insualCommFault; + @ApiModelProperty("浜屾缁濈紭鐩戞祴浠垎鏈虹粷缂樼姸鎬乕bit0-1#缁濈紭鐩戞祴浠� bit1-23缁濈紭鐩戞祴浠� bit2-3#缁濈紭鐩戞祴浠猐锛�0-姝e父 1-鏁呴殰锛�") + private Integer insualInsualFault; + @ApiModelProperty("浜屾缁濈紭鐩戞祴浠富鏈洪�氫俊鐘舵�乕0-姝e父 1-鏁呴殰]") + private Integer insualMiainCommFault; + @ApiModelProperty("2#鍏�1#浜ゆ祦杩涚嚎寮�鍏砆F21锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn2Qf21; + @ApiModelProperty("2#鍏�2#浜ゆ祦杩涚嚎寮�鍏砆F22锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn2Qf22; + @ApiModelProperty("2#鍏呰緭鍑鸿嚦鈪犳姣嶇嚎寮�鍏矰K21锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBusDk21; + @ApiModelProperty("2#鍏呰緭鍑鸿嚦1缁勭數姹犲紑鍏矰K22锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBattDk22; + @ApiModelProperty("浜屾7鍙锋満缁勭洿娴佸垎鐢垫煖浜屾姣嶇嚎1#杩涚嚎寮�鍏砕K21") + private Integer dcFeeder7Bus1Zk21; + @ApiModelProperty("浜屾7鍙锋満缁勭洿娴佸垎鐢垫煖浜屾姣嶇嚎2#杩涚嚎寮�鍏砕K22") + private Integer dcFeeder7Bus2Zk22; + @ApiModelProperty("浜屾8鍙锋満鐩存祦鍒嗙數鏌滀簩娈垫瘝绾�1#杩涚嚎寮�鍏砕K21") + private Integer dcFeeder8Bus1Zk21; + @ApiModelProperty("浜屾8鍙锋満鐩存祦鍒嗙數鏌滀簩娈垫瘝绾�2#杩涚嚎寮�鍏砕K22") + private Integer dcFeeder8Bus2Zk22; + @ApiModelProperty("浜屾9鍙锋満缁勭洿娴佸垎鐢垫煖浜屾姣嶇嚎1#杩涚嚎寮�鍏砕K21") + private Integer dcFeeder9Bus1Zk21; + @ApiModelProperty("浜屾9鍙锋満缁勭洿娴佸垎鐢垫煖浜屾姣嶇嚎2#杩涚嚎寮�鍏砕K22") + private Integer dcFeeder9Bus2Zk22; + @ApiModelProperty("浜屾8鍙锋満缁勪氦娴佸垎鐢垫煖棣堢嚎寮�鍏砙bit0-棣堢嚎寮�鍏砆101 bit1-棣堢嚎寮�鍏砆102... bit29-棣堢嚎寮�鍏砆130]") + private Integer acFeeder8Switch; + @ApiModelProperty("浜屾8鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎寮�鍏砆11") + private Integer acFeeder8AcIn1Q11; + @ApiModelProperty("浜屾8鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎寮�鍏砆12") + private Integer acFeeder8AcIn2Q12; + @ApiModelProperty("浜屾8鍙锋満缁勪氦娴佸垎鐢垫煖1#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder8AcIn1Fault; + @ApiModelProperty("浜屾8鍙锋満缁勪氦娴佸垎鐢垫煖2#浜ゆ祦杩涚嚎鏁呴殰") + private Integer acFeeder8AcIn2Fault; + @ApiModelProperty("3#鍏�1#浜ゆ祦杩涚嚎寮�鍏砆F31锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn3Qf31; + @ApiModelProperty("3#鍏�2#浜ゆ祦杩涚嚎寮�鍏砆F32锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer acIn3Qf32; + @ApiModelProperty("3#鍏呮姇鍚�1缁勭數姹犲紑鍏矰K31锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBatt1Dk31; + @ApiModelProperty("3#鍏呮姇鍚�2缁勭數姹犲紑鍏矰K31锛�0锛氶��鍑� 1锛氭姇鍏ワ級") + private Integer charOutBatt2Dk31; + + private Date startTime; + private Date endTime; + private String recordYearMonth; + + private int limitStart; + private int limitEnd; + +} diff --git a/src/main/java/com/whyc/service/BattRealTimeDataHistoryService.java b/src/main/java/com/whyc/service/BattRealTimeDataHistoryService.java new file mode 100644 index 0000000..5f265bc --- /dev/null +++ b/src/main/java/com/whyc/service/BattRealTimeDataHistoryService.java @@ -0,0 +1,31 @@ +package com.whyc.service; + +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Response; +import com.whyc.pojo.db_power_history.BattRealTimeDataHistory; +import com.whyc.util.SubTablePageInfoUtil; +import com.whyc.util.ThreadLocalUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; + +@Service +public class BattRealTimeDataHistoryService { + + @Autowired + private SubTablePageInfoUtil subTablePageInfoUtil; + + public Response<PageInfo> getPage(int pageNum, int pageSize, int battGroupId, + String startTime, String endTime) throws ParseException, InterruptedException { + + PageInfo<Object> pageInfo = subTablePageInfoUtil.getPageInfoByMonthTable(pageNum, pageSize, + ThreadLocalUtil.parse(startTime, 1), ThreadLocalUtil.parse(endTime, 1), + "db_power_history", + "tb_batt_realdata_" + battGroupId, + new BattRealTimeDataHistory() + ); + return new Response<PageInfo>().set(1, pageInfo); + } + +} diff --git a/src/main/java/com/whyc/service/PowerRealTimeDataHistoryService.java b/src/main/java/com/whyc/service/PowerRealTimeDataHistoryService.java new file mode 100644 index 0000000..7b884d5 --- /dev/null +++ b/src/main/java/com/whyc/service/PowerRealTimeDataHistoryService.java @@ -0,0 +1,29 @@ +package com.whyc.service; + +import com.github.pagehelper.PageInfo; +import com.whyc.dto.Response; +import com.whyc.pojo.db_power_history.PowerRealTimeDataHistory; +import com.whyc.util.SubTablePageInfoUtil; +import com.whyc.util.ThreadLocalUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; + +@Service +public class PowerRealTimeDataHistoryService { + + @Autowired + private SubTablePageInfoUtil subTablePageInfoUtil; + + + public Response<PageInfo> getPage(int pageNum, int pageSize, int powerId, String startTime, String endTime) throws ParseException, InterruptedException { + PageInfo<Object> pageInfo = subTablePageInfoUtil.getPageInfoByMonthTable(pageNum, pageSize, + ThreadLocalUtil.parse(startTime, 1), ThreadLocalUtil.parse(endTime, 1), + "db_power_history", + "tb_power_realdata_" + powerId, + new PowerRealTimeDataHistory() + ); + return new Response<PageInfo>().set(1, pageInfo); + } +} diff --git a/src/main/java/com/whyc/service/SubTableService.java b/src/main/java/com/whyc/service/SubTableService.java index 4cc80c6..37c8ecc 100644 --- a/src/main/java/com/whyc/service/SubTableService.java +++ b/src/main/java/com/whyc/service/SubTableService.java @@ -6,7 +6,9 @@ import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear; import com.whyc.pojo.db_dis_batt.BattTestInfData; 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.util.ActionUtil; import com.whyc.util.ThreadLocalUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -189,6 +191,221 @@ }); return list; } + + public int getBattRealTimeDataHisCount(BattRealTimeDataHistory tempHistory) { + String sql="select count(1) as number from db_power_history."+tempHistory.getRecordYearMonth()+" where 1=1 "; + if(tempHistory.getStartTime()!=null){ + sql+=" and record_time >='"+ ThreadLocalUtil.format(tempHistory.getStartTime(),1)+"' "; + } + if(tempHistory.getEndTime()!=null){ + sql+=" and record_time <='"+ThreadLocalUtil.format(tempHistory.getEndTime(),1)+"' "; + } + 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 int getPowerRealTimeDataHisCount(PowerRealTimeDataHistory tempHistory) { + String sql="select count(1) as number from db_power_history."+tempHistory.getRecordYearMonth()+" where 1=1 "; + if(tempHistory.getStartTime()!=null){ + sql+=" and record_time >='"+ ThreadLocalUtil.format(tempHistory.getStartTime(),1)+"' "; + } + if(tempHistory.getEndTime()!=null){ + sql+=" and record_time <='"+ThreadLocalUtil.format(tempHistory.getEndTime(),1)+"' "; + } + 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<BattRealTimeDataHistory> getBattRealTimeDataHisList(BattRealTimeDataHistory tempHistory) { + String sql="select * from db_power_history."+tempHistory.getRecordYearMonth()+" where 1=1 "; + if(tempHistory.getStartTime()!=null){ + sql+=" and record_time >='"+ ThreadLocalUtil.format(tempHistory.getStartTime(),1)+"' "; + } + if(tempHistory.getEndTime()!=null){ + sql+=" and record_time <='"+ThreadLocalUtil.format(tempHistory.getEndTime(),1)+"' "; + } + sql+=" ORDER BY record_time desc limit "+ tempHistory.getLimitStart()+","+ tempHistory.getLimitEnd()+" "; + List<BattRealTimeDataHistory> list=sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<BattRealTimeDataHistory> list=new ArrayList(); + while (rs.next()){ + BattRealTimeDataHistory data=new BattRealTimeDataHistory(); + data.setBattGroupId(rs.getInt("binf_id")); + data.setRecordTime(rs.getTimestamp("record_time")); + data.setOnlineVol(rs.getFloat("online_vol")); + data.setGroupVol(rs.getFloat("group_vol")); + data.setGroupTmp(rs.getFloat("group_tmp")); + data.setGroupCurr(rs.getFloat("group_curr")); + data.setBattState(rs.getInt("batt_state")); + data.setTestStartTime(rs.getTimestamp("test_start_time")); + data.setBattTestType(rs.getFloat("batt_test_type")); + data.setBattTestLong(rs.getInt("batt_test_tlong")); + data.setBattTestCap(rs.getFloat("batt_test_cap")); + data.setBattRealCap(rs.getFloat("batt_real_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.setMonSer(rs.getFloat("mon_ser")); + data.setMonConnRes(rs.getFloat("mon_conn_res")); + + list.add(data); + } + return list; + } + }); + return list; + } + + public List<PowerRealTimeDataHistory> getPowerRealTimeDataHisList(PowerRealTimeDataHistory tempHistory) { + String sql="select * from db_power_history."+tempHistory.getRecordYearMonth()+" where 1=1 "; + if(tempHistory.getStartTime()!=null){ + sql+=" and record_time >='"+ ThreadLocalUtil.format(tempHistory.getStartTime(),1)+"' "; + } + if(tempHistory.getEndTime()!=null){ + sql+=" and record_time <='"+ThreadLocalUtil.format(tempHistory.getEndTime(),1)+"' "; + } + sql+=" ORDER BY record_time desc limit "+ tempHistory.getLimitStart()+","+ tempHistory.getLimitEnd()+" "; + List<PowerRealTimeDataHistory> list=sqlExecuteService.executeQuery_call(sql, new CallBack() { + @Override + public List getResults(ResultSet rs) throws SQLException { + List<PowerRealTimeDataHistory> list=new ArrayList(); + while (rs.next()){ + PowerRealTimeDataHistory data=new PowerRealTimeDataHistory(); + data.setPowerId(rs.getInt("power_id")); + data.setDevType(rs.getInt("dev_type")); + data.setRecordTime(rs.getTimestamp("record_time")); + data.setCharOutVol(rs.getFloat("char_out_vol")); + data.setCharOutCurr(rs.getFloat("char_out_curr")); + data.setGroupVol(rs.getFloat("group_vol")); + data.setGroupCurr(rs.getFloat("group_curr")); + data.setGroupTmp(rs.getFloat("group_tmp")); + data.setBusVol(rs.getFloat("bus_vol")); + data.setAc1VolA(rs.getFloat("ac1_vola")); + data.setAc1VolB(rs.getFloat("ac1_volb")); + data.setAc1VolC(rs.getFloat("ac1_volc")); + data.setAc2VolA(rs.getFloat("ac2_vola")); + data.setAc2VolB(rs.getFloat("ac2_volb")); + data.setAc2VolC(rs.getFloat("ac2_volc")); + data.setBusVolPositive(rs.getFloat("bus_vol_positive")); + data.setBusVolNegative(rs.getFloat("bus_vol_negative")); + data.setBusResPositive(rs.getFloat("bus_res_positive")); + data.setBusResNegative(rs.getFloat("bus_res_negative")); + data.setCharJunFloat(rs.getInt("char_jun_float")); + data.setCharOpenClose(rs.getInt("char_open_close")); + data.setCharModelError(rs.getInt("char_model_error")); + data.setCharOutOverVol(rs.getInt("char_out_overvol")); + data.setCharOutLessVol(rs.getInt("char_out_lessvol")); + data.setBattOverVol(rs.getInt("batt_overvol")); + data.setBattLessVol(rs.getInt("batt_lessvol")); + data.setBattMonOverVol(rs.getInt("batt_mon_overvol")); + data.setBattMonLessVol(rs.getInt("batt_mon_lessvol")); + data.setBattState(rs.getInt("batt_state")); + data.setControlBusOverVol(rs.getInt("control_bus_overvol")); + data.setControlBusLessVol(rs.getInt("control_bus_lessvol")); + data.setInsualBusVolError(rs.getInt("insual_bus_vol_error")); + data.setControlBusPositiveError(rs.getInt("control_bus_positive_error")); + data.setControlBusNegativeError(rs.getInt("control_bus_negative_error")); + data.setInsualBusAcVolOverVol(rs.getInt("insual_bus_acvol_overvol")); + data.setBattPatrolDetectorError(rs.getInt("batt_patrol_detector_error")); + data.setInsualError(rs.getInt("insual_error")); + data.setAcIn1Qf11(rs.getInt("acin1_qf11")); + data.setAcIn1Qf12(rs.getInt("acin1_qf12")); + data.setCharOutBusDk11(rs.getInt("char_out_bus_dk11")); + data.setCharOutBattDk12(rs.getInt("char_out_batt_dk12")); + data.setBattOutQf1(rs.getInt("batt_out_qf1")); + data.setBusSwitchN1lzk(rs.getInt("bus_switch_n1lzk")); + data.setAc1Fault(rs.getInt("ac1_fault")); + data.setAc2Fault(rs.getInt("ac2_fault")); + data.setMainSwitchFault(rs.getInt("main_switch_fault")); + data.setFeederTripFault(rs.getInt("feeder_trip_fault")); + data.setThunderFault(rs.getInt("thunder_fault")); + data.setFeedersCommFault(rs.getInt("feeders_comm_fault")); + data.setDcFeeder7To9Switch1(rs.getInt("dc_feeder7to9_switch1")); + data.setDcFeeder7Switch(rs.getInt("dc_feeder7_switch")); + data.setDcFeeder7Bus1Zk11(rs.getInt("dc_feeder7_bus1_zk11")); + data.setDcFeeder7Bus2Zk12(rs.getInt("dc_feeder7_bus2_zk12")); + data.setDcFeeder8Switch(rs.getInt("dc_feeder8_switch")); + data.setDcFeeder8Bus1Zk11(rs.getInt("dc_feeder8_bus1_zk11")); + data.setDcFeeder8Bus2Zk12(rs.getInt("dc_feeder8_bus2_zk12")); + data.setDcFeeder9Switch(rs.getInt("dc_feeder9_switch")); + data.setDcFeeder9Bus1Zk11(rs.getInt("dc_feeder9_bus1_zk11")); + data.setDcFeeder9Bus2Zk12(rs.getInt("dc_feeder9_bus2_zk12")); + data.setAcFeeder7Switch(rs.getInt("ac_feeder7_switch")); + data.setAcFeeder7AcIn1Q11(rs.getInt("ac_feeder7_acin1_q11")); + data.setAcFeeder7AcIn2Q12(rs.getInt("ac_feeder7_acin2_q12")); + data.setAcFeeder7AcIn1Fault(rs.getInt("ac_feeder7_acin1_fault")); + data.setAcFeeder7AcIn2Fault(rs.getInt("ac_feeder7_acin2_fault")); + data.setAcFeeder9Switch(rs.getInt("ac_feeder9_switch")); + data.setAcFeeder9AcIn1Q11(rs.getInt("ac_feeder9_acin1_q11")); + data.setAcFeeder9AcIn2Q12(rs.getInt("ac_feeder9_acin2_q12")); + data.setAcFeeder9AcIn1Fault(rs.getInt("ac_feeder9_acin1_fault")); + data.setAcFeeder9AcIn2Fault(rs.getInt("ac_feeder9_acin2_fault")); + data.setInsualCommFault(rs.getInt("insual_comm_fault")); + data.setInsualInsualFault(rs.getInt("insual_insual_fault")); + data.setInsualMiainCommFault(rs.getInt("insual_miain_comm_fault")); + data.setAcIn2Qf21(rs.getInt("acin2_qf21")); + data.setAcIn2Qf22(rs.getInt("acin2_qf22")); + data.setCharOutBusDk21(rs.getInt("char_out_bus_dk21")); + data.setCharOutBattDk22(rs.getInt("char_out_batt_dk22")); + data.setDcFeeder7Bus1Zk21(rs.getInt("dc_feeder7_bus1_zk21")); + data.setDcFeeder7Bus2Zk22(rs.getInt("dc_feeder7_bus2_zk22")); + data.setDcFeeder8Bus1Zk21(rs.getInt("dc_feeder8_bus1_zk21")); + data.setDcFeeder8Bus2Zk22(rs.getInt("dc_feeder8_bus2_zk22")); + data.setDcFeeder9Bus1Zk21(rs.getInt("dc_feeder9_bus1_zk21")); + data.setDcFeeder9Bus2Zk22(rs.getInt("dc_feeder9_bus2_zk22")); + data.setAcFeeder8Switch(rs.getInt("ac_feeder8_switch")); + data.setAcFeeder8AcIn1Q11(rs.getInt("ac_feeder8_acin1_q11")); + data.setAcFeeder8AcIn2Q12(rs.getInt("ac_feeder8_acin2_q12")); + data.setAcFeeder8AcIn1Fault(rs.getInt("ac_feeder8_acin1_fault")); + data.setAcFeeder8AcIn2Fault(rs.getInt("ac_feeder8_acin2_fault")); + data.setAcIn3Qf31(rs.getInt("acin3_qf31")); + data.setAcIn3Qf32(rs.getInt("acin3_qf32")); + data.setCharOutBatt1Dk31(rs.getInt("char_out_batt1_dk31")); + data.setCharOutBatt2Dk31(rs.getInt("char_out_batt2_dk31")); + + + list.add(data); + } + return list; + } + }); + return list; + } + //鐢垫簮鍛婅鍘嗗彶瀹炴椂璁$畻姣忓紶琛ㄦ煡璇㈡�绘暟 public int getPowerHisCount(PowerAlarmHistory powerAlarmHistory) { String sql="SELECT count(*) as number FROM db_power_alarm."+ powerAlarmHistory.getRecordYear()+" history " + diff --git a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java index 956cb48..48bb96e 100644 --- a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java +++ b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java @@ -9,7 +9,9 @@ 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; @@ -229,6 +231,23 @@ 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(); }); } @@ -278,7 +297,8 @@ battAlarmHistory.setLimitEnd(limitList.get(1)); List<BattAlarmHistory> list = service.getBattHisList(battAlarmHistory); dataList.addAll(list); - }else if (pojo instanceof BattStationTempHistory){ + } + else if (pojo instanceof BattStationTempHistory){ BattStationTempHistory tempHistory = new BattStationTempHistory(); tempHistory.setStartTime(queryTime.get(0)); tempHistory.setEndTime(queryTime.get(1)); @@ -289,6 +309,28 @@ 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; -- Gitblit v1.9.1