| | |
| | | |
| | | @GetMapping("getBattHisRealInAlm") |
| | | @ApiOperation("电池告警点击具体告警信息查看从告警开始时间到现在的历史实时数据") |
| | | public Response getBattHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam String startTime,@RequestParam(required = false) Integer monNum) throws ParseException, InterruptedException { |
| | | return battRealdataIdService.getBattHisRealInAlm(battgroupId,startTime,monNum); |
| | | public Response getBattHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam String startTime,@RequestParam(required = false) Integer almId) throws ParseException, InterruptedException { |
| | | return battRealdataIdService.getBattHisRealInAlm(battgroupId,startTime,almId); |
| | | } |
| | | |
| | | } |
| | |
| | | return new Response().set(1, dataListSorted); |
| | | } |
| | | //电池告警点击具体告警信息查看从告警开始时间到现在的历史实时数据 |
| | | public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer monNum) throws ParseException, InterruptedException { |
| | | public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer almId) throws ParseException, InterruptedException { |
| | | List<RealDateDTO> dataList = new LinkedList<>(); |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1),new Date()); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | |
| | | int tableNum = subTablePageInfoService.judgeTable_realdata(table); |
| | | List<RealDateDTO> list = new ArrayList(); |
| | | if (tableNum > 0) { |
| | | //获取指定时间段内最大最小recordNum确保数据的完整 |
| | | 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,1,maxRecordNum,minRecordNum); |
| | | list = subTablePageInfoService.getBattHisRealInAlm(realdata); |
| | | } |
| | | dataList.addAll(list); |
| | | latch.countDown(); |
| | |
| | | //优良电源数量统计(1.2.7) |
| | | public Response getPwr7Statistic(Pwr7Stic stic) throws NoSuchFieldException, IllegalAccessException { |
| | | Date inuseTimeStart =new Date(); |
| | | if(stic.getInuseYear()==1){ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(5); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | }else{ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | if(stic.getInuseYear()!=null){ |
| | | if(stic.getInuseYear()==1){ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(5); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | }else{ |
| | | //投入使用时间条件筛选 |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | } |
| | | stic.setPwrInUseTime(inuseTimeStart); |
| | | } |
| | | stic.setPwrInUseTime(inuseTimeStart); |
| | | //1查询符合条件的电池组 |
| | | List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic); |
| | | if(pinfList==null||pinfList.size()==0){ |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //电池数据历史实时处理(预警分析) |
| | | public List<RealDateDTO> getBattHisRealInAlm(BattRealdataId realdata) { |
| | | 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)+"' "; |
| | | 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; |
| | | } |
| | | //获取指定时间段内最大最小recordNum确保数据的完整 |
| | | public List getMaxAndMinRecordNum(BattRealdataId realdata) { |
| | | String sql="select max(record_num) as maxRecordNum,min(record_num) as minRecordNum " + |