|
@@ -37,41 +37,73 @@ public class ZilaishuiRealListDao {
|
|
@Qualifier("child3Datasource")
|
|
@Qualifier("child3Datasource")
|
|
private DataSource child3DataSource;
|
|
private DataSource child3DataSource;
|
|
|
|
|
|
- //TODO orcale相关
|
|
|
|
|
|
+ // Oracle相关
|
|
public Integer getTabWaterHistoryCount(String extend){
|
|
public Integer getTabWaterHistoryCount(String extend){
|
|
- try {
|
|
|
|
- String sql = "select count(1) from cqda.V_SHIZILAISHUI_HISTORY2 WHERE 1=1 ";
|
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
|
- sql += extend;
|
|
|
|
|
|
+ int maxRetries = 10; // 最大重试次数
|
|
|
|
+ int retryDelay = 2000; // 每次重试等待时间(毫秒)
|
|
|
|
+
|
|
|
|
+ for (int attempt = 1; attempt <= maxRetries; attempt++) {
|
|
|
|
+ try {
|
|
|
|
+ String sql = "select count(1) from cqda.V_SHIZILAISHUI_HISTORY2 WHERE 1=1 ";
|
|
|
|
+ if(!StringUtils.isEmpty(extend)){
|
|
|
|
+ sql += extend;
|
|
|
|
+ }
|
|
|
|
+ int count = twoTemplate.queryForObject(sql, Integer.class);
|
|
|
|
+ return count;
|
|
|
|
+ } catch(Exception ex) {
|
|
|
|
+ System.err.println("查询历史水量总数失败,第" + attempt + "次尝试:" + ex.getMessage());
|
|
|
|
+ if (attempt == maxRetries) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(retryDelay);
|
|
|
|
+ } catch (InterruptedException ie) {
|
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- int count = twoTemplate.queryForObject(sql, Integer.class);
|
|
|
|
- return count;
|
|
|
|
- }catch(Exception ex){
|
|
|
|
- return null;
|
|
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
- //TODO 分页获取历史水量数据
|
|
|
|
- public List<Map<String,Object>> getPageZILAISHUI_HISTORY2(int limit,int offset,String extend){
|
|
|
|
- try {
|
|
|
|
- String sql = "select " +
|
|
|
|
- " a.TAG_CODE,a.NAME,a.VAL,TO_CHAR(a.QCQUISITION_TIME,'yyyy-mm-dd hh24:mi:ss') AS QCQUISITION_TIME," +
|
|
|
|
- " TO_CHAR(a.UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS UPDATE_TIME " +
|
|
|
|
- " from ( select t.*,rownum AS rownumber from cqda.V_SHIZILAISHUI_HISTORY2 t where rownum <= "+limit+") a " +
|
|
|
|
- " where rownumber > "+offset;
|
|
|
|
- if (!StringUtils.isEmpty(extend)) {
|
|
|
|
- sql = "select " +
|
|
|
|
|
|
+
|
|
|
|
+ // 分页获取历史水量数据
|
|
|
|
+ public List<Map<String,Object>> getPageZILAISHUI_HISTORY2(int limit, int offset, String extend){
|
|
|
|
+ int maxRetries = 10; // 最大重试次数
|
|
|
|
+ int retryDelay = 2000; // 每次重试等待时间(毫秒)
|
|
|
|
+
|
|
|
|
+ for (int attempt = 1; attempt <= maxRetries; attempt++) {
|
|
|
|
+ try {
|
|
|
|
+ String sql = "select " +
|
|
" a.TAG_CODE,a.NAME,a.VAL,TO_CHAR(a.QCQUISITION_TIME,'yyyy-mm-dd hh24:mi:ss') AS QCQUISITION_TIME," +
|
|
" a.TAG_CODE,a.NAME,a.VAL,TO_CHAR(a.QCQUISITION_TIME,'yyyy-mm-dd hh24:mi:ss') AS QCQUISITION_TIME," +
|
|
" TO_CHAR(a.UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS UPDATE_TIME " +
|
|
" TO_CHAR(a.UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS UPDATE_TIME " +
|
|
- " from ( select t.*,rownum AS rownumber from cqda.V_SHIZILAISHUI_HISTORY2 t where rownum <= "+limit+" "+extend+") a " +
|
|
|
|
- " where rownumber >"+offset;
|
|
|
|
|
|
+ " from ( select t.*,rownum AS rownumber from cqda.V_SHIZILAISHUI_HISTORY2 t where rownum <= "+limit+") a " +
|
|
|
|
+ " where rownumber > "+offset;
|
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
|
+ sql = "select " +
|
|
|
|
+ " a.TAG_CODE,a.NAME,a.VAL,TO_CHAR(a.QCQUISITION_TIME,'yyyy-mm-dd hh24:mi:ss') AS QCQUISITION_TIME," +
|
|
|
|
+ " TO_CHAR(a.UPDATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS UPDATE_TIME " +
|
|
|
|
+ " from ( select t.*,rownum AS rownumber from cqda.V_SHIZILAISHUI_HISTORY2 t where rownum <= "+limit+" "+extend+") a " +
|
|
|
|
+ " where rownumber >"+offset;
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> tableData = twoTemplate.queryForList(sql);
|
|
|
|
+ return tableData;
|
|
|
|
+ } catch(Exception ex) {
|
|
|
|
+ System.err.println("分页查询历史水量数据失败,第" + attempt + "次尝试:" + ex.getMessage());
|
|
|
|
+ if (attempt == maxRetries) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(retryDelay);
|
|
|
|
+ } catch (InterruptedException ie) {
|
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- List<Map<String, Object>> tableData = twoTemplate.queryForList(sql);
|
|
|
|
- return tableData;
|
|
|
|
- }catch(Exception ex){
|
|
|
|
- return null;
|
|
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//TODO pgsql 相关
|
|
//TODO pgsql 相关
|
|
//TODO 查询设备关系表信息·不分页
|
|
//TODO 查询设备关系表信息·不分页
|
|
public List<Map<String,Object>> getWaterLevelCollectionConfigList(String extend){
|
|
public List<Map<String,Object>> getWaterLevelCollectionConfigList(String extend){
|