| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.mapper.CommonMapper; |
| | | import com.whyc.mapper.LockInfMapper; |
| | | import com.whyc.pojo.db_area.LockInf; |
| | | import com.whyc.pojo.db_lock_alarm.LockAlarm; |
| | | import com.whyc.pojo.db_lock_alarm.LockAlarmHis; |
| | | import com.whyc.pojo.db_lock_his.LockHis; |
| | | import com.whyc.service.SubTableService; |
| | |
| | | @Autowired |
| | | private SubTableService service; |
| | | |
| | | @Autowired(required = false) |
| | | private LockInfMapper linfMapper; |
| | | |
| | | |
| | | |
| | | /**按年份表分页查询*/ |
| | |
| | | continue; |
| | | } |
| | | //====== 根据不同类型类型对象对应调整 ====== |
| | | if(pojo instanceof LockHis) { |
| | | if(pojo instanceof LockAlarmHis) { |
| | | LockAlarmHis his = new LockAlarmHis(); |
| | | BeanUtils.copyProperties(pojo, his); |
| | | his.setStartTime(queryTime.get(0)); |
| | |
| | | List<Date> queryTime = queryTimeForSubTables.get(key); |
| | | //====== 根据不同类型类型对象对应调整 ====== |
| | | String recordYear = tablePrefix + "_" + key; |
| | | if(pojo instanceof LockHis) { |
| | | if(pojo instanceof LockAlarmHis) { |
| | | LockAlarmHis his = new LockAlarmHis(); |
| | | BeanUtils.copyProperties(pojo, his); |
| | | his.setStartTime(queryTime.get(0)); |
| | |
| | | List<Integer> limitList = tableAndLimitMap.get(key); |
| | | his.setLimitStart(limitList.get(0)); |
| | | his.setLimitEnd(limitList.get(1)); |
| | | List<LockHis> list = service.getLockAlmHisList(his); |
| | | List<LockAlarmHis> list = service.getLockAlmHisList(his); |
| | | for (LockAlarmHis alm:list) { |
| | | LockInf linf=linfMapper.getlinfBylockId(alm.getLockId()); |
| | | alm.setLinf(linf); |
| | | } |
| | | dataList.addAll(list); |
| | | } |
| | | |
| | |
| | | } |
| | | return resultTableList; |
| | | } |
| | | //实时界面点击查看历史信息 |
| | | public List getLockHisWithReal(Date startTime,Date endTime, |
| | | String dbName,String tablePrefix, |
| | | Object pojo) throws ParseException { |
| | | Map<String, List<Date>> queryTimeForSubTables = DateUtil.getQueryTimeForSubTablesDescWithOutDefault(startTime, endTime); |
| | | Set<String> tableYearKeySet = queryTimeForSubTables.keySet(); |
| | | List<Object> dataList = new LinkedList<>(); |
| | | 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 LockHis) { |
| | | LockHis his = new LockHis(); |
| | | BeanUtils.copyProperties(pojo, his); |
| | | his.setStartTime(queryTime.get(0)); |
| | | his.setEndTime(queryTime.get(1)); |
| | | his.setRecordYear(tableName); |
| | | List<LockHis> list = service.getLockHisWithReal(his); |
| | | dataList.addAll(list); |
| | | } |
| | | } |
| | | return dataList; |
| | | } |
| | | } |