| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private UserInfService userInfService; |
| | | |
| | | //按年月分表 |
| | | /**按年份表分页查询*/ |
| | | public PageInfo<Object> getPageInfo(int pageNum,int pageSize, |
| | | Date startTime,Date endTime, |
| | |
| | | |
| | | //数值 |
| | | String tableName = tablePrefix+"_"+tableYear; |
| | | String existTableName = commonMapper.existTable(dbName, tableName); |
| | | if(existTableName == null){ |
| | | boolean existTableName = commonMapper.existTable(dbName, tableName); |
| | | if(!existTableName){ |
| | | continue; |
| | | } |
| | | //====== 根据不同类型类型对象对应调整 ====== |
| | |
| | | Date startTime, Date endTime, |
| | | String dbName, String tablePrefix, |
| | | Object pojo) throws ParseException, InterruptedException { |
| | | Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesByMonthDesc(startTime, endTime); |
| | | Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesByMonthDesc2(startTime, endTime); |
| | | //查询分表是否存在,存在则查询结果 |
| | | Map<String,Integer> queryCountMap = new LinkedHashMap<>(); |
| | | Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); |
| | |
| | | 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(); |
| | | }); |
| | | } |
| | |
| | | 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; |