From a7fef2846505b08e0711345b17902e7381612d23 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期二, 25 三月 2025 14:02:16 +0800 Subject: [PATCH] 查询锁的蓝牙开启时间段记录添加area_path --- src/main/java/com/whyc/util/SubTablePageInfoUtil.java | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java index 1a9895d..16f9353 100644 --- a/src/main/java/com/whyc/util/SubTablePageInfoUtil.java +++ b/src/main/java/com/whyc/util/SubTablePageInfoUtil.java @@ -3,6 +3,9 @@ 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; @@ -28,6 +31,9 @@ @Autowired private SubTableService service; + @Autowired(required = false) + private LockInfMapper linfMapper; + /**鎸夊勾浠借〃鍒嗛〉鏌ヨ*/ @@ -49,7 +55,7 @@ continue; } //====== 鏍规嵁涓嶅悓绫诲瀷绫诲瀷瀵硅薄瀵瑰簲璋冩暣 ====== - if(pojo instanceof LockHis) { + if(pojo instanceof LockAlarmHis) { LockAlarmHis his = new LockAlarmHis(); BeanUtils.copyProperties(pojo, his); his.setStartTime(queryTime.get(0)); @@ -88,7 +94,7 @@ 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)); @@ -97,7 +103,11 @@ 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); } @@ -300,4 +310,33 @@ } 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; + } } \ No newline at end of file -- Gitblit v1.9.1