|
|
@@ -1,16 +1,13 @@
|
|
|
package com.shkpr.service.aimodelpower.dbdao.shizilaishuiDataSource;
|
|
|
|
|
|
-import com.shkpr.service.aimodelpower.bizmgr.KprAimWaterCollecationBizFun;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
-import org.springframework.dao.DataAccessException;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
import javax.sql.DataSource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
@@ -26,362 +23,359 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
@Repository
|
|
|
public class WaterZILAISHUIDao {
|
|
|
- @Resource
|
|
|
- private JdbcTemplate oneTemplate;
|
|
|
-
|
|
|
@Autowired
|
|
|
@Qualifier("childDatasource")
|
|
|
private DataSource childDataSource;
|
|
|
|
|
|
- //TODO orcale相关
|
|
|
- //TODO 获取满足条件的历史水量数据总数
|
|
|
- public Integer getTabWaterHistoryCount(String extend){
|
|
|
- int maxAttempts = 10; // 最大重试次数
|
|
|
- int attempt = 0;
|
|
|
- long delay = 1000; // 初始延迟时间(毫秒)
|
|
|
- while (attempt < maxAttempts) {
|
|
|
- try {
|
|
|
- String sql = "select count(1) from cqda.V_SHIZILAISHUI_HISTORY2 ";
|
|
|
- if ("water_volume_prediction_jiangjin2".equals(KprAimWaterCollecationBizFun.databaseName)) {
|
|
|
- sql = "select count(1) from cqda.V_JIANGJIN_HISTORY";
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(extend)) {
|
|
|
- sql += extend;
|
|
|
- }
|
|
|
- int count = oneTemplate.queryForObject(sql, Integer.class);
|
|
|
- return count;
|
|
|
- } catch (Exception ex) {
|
|
|
- // 捕获连接获取失败异常
|
|
|
- attempt++;
|
|
|
- if (attempt >= maxAttempts) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- try {
|
|
|
- Thread.sleep(delay); // 延迟重试
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- }
|
|
|
- delay *= 2; // 指数退避策略
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+// //TODO orcale相关
|
|
|
+// //TODO 获取满足条件的历史水量数据总数
|
|
|
+// public Integer getTabWaterHistoryCount(String extend){
|
|
|
+// int maxAttempts = 10; // 最大重试次数
|
|
|
+// int attempt = 0;
|
|
|
+// long delay = 1000; // 初始延迟时间(毫秒)
|
|
|
+// while (attempt < maxAttempts) {
|
|
|
+// try {
|
|
|
+// String sql = "select count(1) from cqda.V_SHIZILAISHUI_HISTORY2 ";
|
|
|
+// if ("water_volume_prediction_jiangjin2".equals(KprAimWaterCollecationBizFun.databaseName)) {
|
|
|
+// sql = "select count(1) from cqda.V_JIANGJIN_HISTORY";
|
|
|
+// }
|
|
|
+// if (!StringUtils.isEmpty(extend)) {
|
|
|
+// sql += extend;
|
|
|
+// }
|
|
|
+// int count = oneTemplate.queryForObject(sql, Integer.class);
|
|
|
+// return count;
|
|
|
+// } catch (Exception ex) {
|
|
|
+// // 捕获连接获取失败异常
|
|
|
+// attempt++;
|
|
|
+// if (attempt >= maxAttempts) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// Thread.sleep(delay); // 延迟重试
|
|
|
+// } catch (InterruptedException e) {
|
|
|
+// Thread.currentThread().interrupt();
|
|
|
+// }
|
|
|
+// delay *= 2; // 指数退避策略
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
//TODO 分页获取历史水量数据
|
|
|
- public List<Map<String,Object>> getPageZILAISHUI_HISTORY2(int limit,int offset,String extend){
|
|
|
- int maxAttempts = 10; // 最大重试次数
|
|
|
- int attempt = 0;
|
|
|
- long delay = 1000; // 初始延迟时间(毫秒)
|
|
|
- while (attempt < maxAttempts) {
|
|
|
- try {
|
|
|
- String tableName = "cqda.V_SHIZILAISHUI_HISTORY2";
|
|
|
- String filedOrgName = "NAME";
|
|
|
- if ("water_volume_prediction_jiangjin2".equals(KprAimWaterCollecationBizFun.databaseName)) {
|
|
|
- tableName = "cqda.V_JIANGJIN_HISTORY ";
|
|
|
- filedOrgName = "ORG_NAME";
|
|
|
- }
|
|
|
- String sql = "select " +
|
|
|
- " a.TAG_CODE,a." + filedOrgName + ",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 " + tableName + " t where rownum <= " + limit + ") a " +
|
|
|
- " where rownumber > " + offset;
|
|
|
- if (!StringUtils.isEmpty(extend)) {
|
|
|
- sql = "select " +
|
|
|
- " a.TAG_CODE,a." + filedOrgName + ",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 " + tableName + " t where rownum <= " + limit + " " + extend + ") a " +
|
|
|
- " where rownumber >" + offset;
|
|
|
- }
|
|
|
- List<Map<String, Object>> tableData = oneTemplate.queryForList(sql);
|
|
|
- return tableData;
|
|
|
- } catch (Exception ex) {
|
|
|
- // 捕获连接获取失败异常
|
|
|
- attempt++;
|
|
|
- if (attempt >= maxAttempts) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- try {
|
|
|
- Thread.sleep(delay); // 延迟重试
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- }
|
|
|
- delay *= 2; // 指数退避策略
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
+// public List<Map<String,Object>> getPageZILAISHUI_HISTORY2(int limit,int offset,String extend){
|
|
|
+// int maxAttempts = 10; // 最大重试次数
|
|
|
+// int attempt = 0;
|
|
|
+// long delay = 1000; // 初始延迟时间(毫秒)
|
|
|
+// while (attempt < maxAttempts) {
|
|
|
+// try {
|
|
|
+// String tableName = "cqda.V_SHIZILAISHUI_HISTORY2";
|
|
|
+// String filedOrgName = "NAME";
|
|
|
+// if ("water_volume_prediction_jiangjin2".equals(KprAimWaterCollecationBizFun.databaseName)) {
|
|
|
+// tableName = "cqda.V_JIANGJIN_HISTORY ";
|
|
|
+// filedOrgName = "ORG_NAME";
|
|
|
+// }
|
|
|
+// String sql = "select " +
|
|
|
+// " a.TAG_CODE,a." + filedOrgName + ",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 " + tableName + " t where rownum <= " + limit + ") a " +
|
|
|
+// " where rownumber > " + offset;
|
|
|
+// if (!StringUtils.isEmpty(extend)) {
|
|
|
+// sql = "select " +
|
|
|
+// " a.TAG_CODE,a." + filedOrgName + ",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 " + tableName + " t where rownum <= " + limit + " " + extend + ") a " +
|
|
|
+// " where rownumber >" + offset;
|
|
|
+// }
|
|
|
+// List<Map<String, Object>> tableData = oneTemplate.queryForList(sql);
|
|
|
+// return tableData;
|
|
|
+// } catch (Exception ex) {
|
|
|
+// // 捕获连接获取失败异常
|
|
|
+// attempt++;
|
|
|
+// if (attempt >= maxAttempts) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// Thread.sleep(delay); // 延迟重试
|
|
|
+// } catch (InterruptedException e) {
|
|
|
+// Thread.currentThread().interrupt();
|
|
|
+// }
|
|
|
+// delay *= 2; // 指数退避策略
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return null;
|
|
|
+// }
|
|
|
|
|
|
//TODO pgsql water_volume_prediction数据库相关
|
|
|
//TODO 查询设备关系表信息·不分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionConfigList(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionConfigList(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collection_config ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql+=extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水历史记录表·分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionRecordList(int limit,int offset,String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionRecordList(int limit, int offset, String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collecation_record ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
- sql += " LIMIT " + limit + " OFFSET "+ offset;
|
|
|
+ sql += " LIMIT " + limit + " OFFSET " + offset;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水15分钟用水量记录表·分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionRecordAllListNew(int limit,int offset,String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionRecordAllListNew(int limit, int offset, String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collecation_record_all_new ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
- sql += " LIMIT " + limit + " OFFSET "+ offset;
|
|
|
+ sql += " LIMIT " + limit + " OFFSET " + offset;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水15分钟用水量记录表·不分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionRecordAllListAllNew(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionRecordAllListAllNew(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collecation_record_all_new ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水小时用水量记录表·分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionRecordAllList(int limit,int offset,String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionRecordAllList(int limit, int offset, String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collecation_record_all ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
- sql += " LIMIT " + limit + " OFFSET "+ offset;
|
|
|
+ sql += " LIMIT " + limit + " OFFSET " + offset;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水小时用水量记录表·不分页
|
|
|
- public List<Map<String,Object>> getWaterCollectionRecordAllListAll(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterCollectionRecordAllListAll(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_collecation_record_all ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<Map<String,Object>> getPumpCollectionRecordAllListAll(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getPumpCollectionRecordAllListAll(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_pump_record_all ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 插入自来水历史记录表
|
|
|
- public int insertWaterCollectionRecord(String extend){
|
|
|
- try{
|
|
|
+ public int insertWaterCollectionRecord(String extend) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO water_collecation_record " +
|
|
|
"(collcation_tag,org_name,time,value,update_time) VALUES ";
|
|
|
- if(StringUtils.isEmpty(extend)){
|
|
|
+ if (StringUtils.isEmpty(extend)) {
|
|
|
return -1;
|
|
|
}
|
|
|
- sql+=extend;
|
|
|
+ sql += extend;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 插入自来水15分钟用水量记录表
|
|
|
- public int insertWaterCollectionRecordAllNew(String extend){
|
|
|
- try{
|
|
|
+ public int insertWaterCollectionRecordAllNew(String extend) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO water_collecation_record_all_new " +
|
|
|
"(org_name,time,value,value_tag,collcation_tag_array) VALUES ";
|
|
|
- if(StringUtils.isEmpty(extend)){
|
|
|
+ if (StringUtils.isEmpty(extend)) {
|
|
|
return -1;
|
|
|
}
|
|
|
- sql+=extend;
|
|
|
+ sql += extend;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 修改自来水15分钟用水量记录表value
|
|
|
- public int updateWaterCollectionRecordAllNew(String value,String extend){
|
|
|
- try{
|
|
|
+ public int updateWaterCollectionRecordAllNew(String value, String extend) {
|
|
|
+ try {
|
|
|
String sql = "UPDATE water_collecation_record_all_new " +
|
|
|
- " SET \"value\" = "+value+" " +
|
|
|
+ " SET \"value\" = " + value + " " +
|
|
|
" ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql = sql +extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql = sql + extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//TODO 插入自来水小时用水量记录表
|
|
|
- public int insertWaterCollectionRecordAll(String extend){
|
|
|
- try{
|
|
|
+ public int insertWaterCollectionRecordAll(String extend) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO water_collecation_record_all " +
|
|
|
"(org_name,time,value,value_tag,collcation_tag_array) VALUES ";
|
|
|
- if(StringUtils.isEmpty(extend)){
|
|
|
+ if (StringUtils.isEmpty(extend)) {
|
|
|
return -1;
|
|
|
}
|
|
|
- sql+=extend;
|
|
|
+ sql += extend;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 修改自来水小时用水量记录表value
|
|
|
- public int updateWaterCollectionRecordAll(String value,String extend){
|
|
|
- try{
|
|
|
+ public int updateWaterCollectionRecordAll(String value, String extend) {
|
|
|
+ try {
|
|
|
String sql = "UPDATE water_collecation_record_all " +
|
|
|
- " SET \"value\" = "+value+" " +
|
|
|
+ " SET \"value\" = " + value + " " +
|
|
|
" ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql = sql +extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql = sql + extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 插入自来水日用水预测数据
|
|
|
- public int insertTbmWater(String extend){
|
|
|
- try{
|
|
|
+ public int insertTbmWater(String extend) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO tb_m_water " +
|
|
|
"('Date','Month','Week','ActualWaterWithdrawals','ActualWaterSupply'," +
|
|
|
" 'ForecastWaterWithdrawals','ForecastActualWaterSupply','isAbnormal','isForecast','LastModifyTime','orgId' ) " +
|
|
|
" VALUES ";
|
|
|
- if(StringUtils.isEmpty(extend)){
|
|
|
+ if (StringUtils.isEmpty(extend)) {
|
|
|
return -1;
|
|
|
}
|
|
|
- sql+=extend;
|
|
|
+ sql += extend;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 修改自来水日用水预测数据
|
|
|
- public int updateTbmWater(String[] value,String extend){
|
|
|
- try{
|
|
|
+ public int updateTbmWater(String[] value, String extend) {
|
|
|
+ try {
|
|
|
String sql = "UPDATE tb_m_water " +
|
|
|
- " SET \"Date\" = "+value[0]+" " +
|
|
|
- " AND \"Month\" = "+value[1]+" " +
|
|
|
- " AND \"Week\" = "+value[2]+" " +
|
|
|
- " AND \"ActualWaterWithdrawals\" = "+value[3]+" " +
|
|
|
- " AND \"ActualWaterSupply\" = "+value[4]+" " +
|
|
|
- " AND \"ForecastWaterWithdrawals\" = "+value[5]+" " +
|
|
|
- " AND \"ForecastActualWaterSupply\" = "+value[6]+" " +
|
|
|
- " AND \"isAbnormal\" = "+value[7]+" " +
|
|
|
- " AND \"isForecast\" = "+value[8]+" " +
|
|
|
- " AND \"LastModifyTime\" = "+value[9]+" " +
|
|
|
- " AND \"orgId\" = "+value[10]+" " +
|
|
|
+ " SET \"Date\" = " + value[0] + " " +
|
|
|
+ " AND \"Month\" = " + value[1] + " " +
|
|
|
+ " AND \"Week\" = " + value[2] + " " +
|
|
|
+ " AND \"ActualWaterWithdrawals\" = " + value[3] + " " +
|
|
|
+ " AND \"ActualWaterSupply\" = " + value[4] + " " +
|
|
|
+ " AND \"ForecastWaterWithdrawals\" = " + value[5] + " " +
|
|
|
+ " AND \"ForecastActualWaterSupply\" = " + value[6] + " " +
|
|
|
+ " AND \"isAbnormal\" = " + value[7] + " " +
|
|
|
+ " AND \"isForecast\" = " + value[8] + " " +
|
|
|
+ " AND \"LastModifyTime\" = " + value[9] + " " +
|
|
|
+ " AND \"orgId\" = " + value[10] + " " +
|
|
|
" ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql = sql +extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql = sql + extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 添加或修改日预测数据
|
|
|
- public int insertOrUpdateTbmWater(Map<String,Object> value){
|
|
|
- try{
|
|
|
+ public int insertOrUpdateTbmWater(Map<String, Object> value) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO tb_m_water " +
|
|
|
"(\"Date\",\"Month\",\"Week\"";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ActualWaterWithdrawals"))){
|
|
|
- sql += " , \"ActualWaterWithdrawals\" ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"ActualWaterWithdrawals\" ";
|
|
|
}
|
|
|
// if(!ObjectUtils.isEmpty(value.get("ActualWaterSupply"))){
|
|
|
- sql += " ,\"ActualWaterSupply\"";
|
|
|
+ sql += " ,\"ActualWaterSupply\"";
|
|
|
// }
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"ForecastWaterWithdrawals\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"ForecastWaterWithdrawals\"";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ForecastActualWaterSupply"))){
|
|
|
- sql += " , \"ForecastActualWaterSupply\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ForecastActualWaterSupply"))) {
|
|
|
+ sql += " , \"ForecastActualWaterSupply\"";
|
|
|
}
|
|
|
- sql +=",\"isAbnormal\",\"isForecast\",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
- sql +=" ( ";
|
|
|
+ sql += ",\"isAbnormal\",\"isForecast\",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
+ sql += " ( ";
|
|
|
int i = 1;
|
|
|
- for (Object key : value.keySet()){
|
|
|
- if(i==value.keySet().size()){
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))){
|
|
|
+ for (Object key : value.keySet()) {
|
|
|
+ if (i == value.size()) {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "'";
|
|
|
}
|
|
|
- }else {
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))) {
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ,";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "',";
|
|
|
}
|
|
|
}
|
|
|
@@ -390,65 +384,65 @@ public class WaterZILAISHUIDao {
|
|
|
sql += " )";
|
|
|
sql += " ON CONFLICT (\"Date\",\"orgId\") " +
|
|
|
" DO UPDATE " +
|
|
|
- " SET \"Date\" = '"+value.get("Date")+"' " +
|
|
|
- " , \"Month\" = '"+value.get("Month")+"' " +
|
|
|
- " , \"Week\" = '"+value.get("Week")+"' ";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ActualWaterWithdrawals"))){
|
|
|
- sql += " , \"ActualWaterWithdrawals\" = '"+value.get("ActualWaterWithdrawals")+"' ";
|
|
|
+ " SET \"Date\" = '" + value.get("Date") + "' " +
|
|
|
+ " , \"Month\" = '" + value.get("Month") + "' " +
|
|
|
+ " , \"Week\" = '" + value.get("Week") + "' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"ActualWaterWithdrawals\" = '" + value.get("ActualWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ActualWaterSupply"))){
|
|
|
- sql += " ,\"ActualWaterSupply\" = '"+value.get("ActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ActualWaterSupply"))) {
|
|
|
+ sql += " ,\"ActualWaterSupply\" = '" + value.get("ActualWaterSupply") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"ForecastWaterWithdrawals\" = '"+value.get("ForecastWaterWithdrawals")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"ForecastWaterWithdrawals\" = '" + value.get("ForecastWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("ForecastActualWaterSupply"))){
|
|
|
- sql += " , \"ForecastActualWaterSupply\" = '"+value.get("ForecastActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("ForecastActualWaterSupply"))) {
|
|
|
+ sql += " , \"ForecastActualWaterSupply\" = '" + value.get("ForecastActualWaterSupply") + "' ";
|
|
|
}
|
|
|
|
|
|
- sql += " , \"isAbnormal\" = '"+value.get("isAbnormal")+"' " +
|
|
|
- " , \"isForecast\" = '"+value.get("isForecast")+"' " +
|
|
|
- " , \"LastModifyTime\" = '"+value.get("LastModifyTime")+"' " +
|
|
|
- " , \"orgId\" = '"+value.get("orgId")+"' ";
|
|
|
+ sql += " , \"isAbnormal\" = '" + value.get("isAbnormal") + "' " +
|
|
|
+ " , \"isForecast\" = '" + value.get("isForecast") + "' " +
|
|
|
+ " , \"LastModifyTime\" = '" + value.get("LastModifyTime") + "' " +
|
|
|
+ " , \"orgId\" = '" + value.get("orgId") + "' ";
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 添加或修改日小时预测数据
|
|
|
- public int insertOrUpdateTbmHourWater(Map<String,Object> value){
|
|
|
- try{
|
|
|
+ public int insertOrUpdateTbmHourWater(Map<String, Object> value) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO tb_m_hourwater " +
|
|
|
"(\"Date\",\"Hour\"";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"HourForecastWaterWithdrawals\" ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourForecastWaterWithdrawals\" ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += " ,\"HourForecastActualWaterSupply\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += " ,\"HourForecastActualWaterSupply\"";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))){
|
|
|
- sql += " , \"HourActualWaterWithdrawals\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourActualWaterWithdrawals\"";
|
|
|
}
|
|
|
// if(!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))){
|
|
|
- sql += " , \"HourActualWaterSupply\"";
|
|
|
+ sql += " , \"HourActualWaterSupply\"";
|
|
|
// }
|
|
|
- sql+= ",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
- sql +=" ( ";
|
|
|
+ sql += ",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
+ sql += " ( ";
|
|
|
int i = 1;
|
|
|
- for (Object key : value.keySet()){
|
|
|
- if(i==value.keySet().size()){
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))){
|
|
|
+ for (Object key : value.keySet()) {
|
|
|
+ if (i == value.size()) {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "'";
|
|
|
}
|
|
|
- }else {
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))) {
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ,";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "',";
|
|
|
}
|
|
|
}
|
|
|
@@ -457,62 +451,62 @@ public class WaterZILAISHUIDao {
|
|
|
sql += " )";
|
|
|
sql += " ON CONFLICT (\"Date\",\"orgId\",\"Hour\") " +
|
|
|
" DO UPDATE " +
|
|
|
- " SET \"Date\" = '"+value.get("Date")+"' " +
|
|
|
- " , \"Hour\" = '"+value.get("Hour")+"' ";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"HourForecastWaterWithdrawals\" = '"+value.get("HourForecastWaterWithdrawals")+"' ";
|
|
|
+ " SET \"Date\" = '" + value.get("Date") + "' " +
|
|
|
+ " , \"Hour\" = '" + value.get("Hour") + "' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourForecastWaterWithdrawals\" = '" + value.get("HourForecastWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += " ,\"HourForecastActualWaterSupply\" = '"+value.get("HourForecastActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += " ,\"HourForecastActualWaterSupply\" = '" + value.get("HourForecastActualWaterSupply") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))){
|
|
|
- sql += " , \"HourActualWaterWithdrawals\" = '"+value.get("HourActualWaterWithdrawals")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourActualWaterWithdrawals\" = '" + value.get("HourActualWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))){
|
|
|
- sql += " , \"HourActualWaterSupply\" = '"+value.get("HourActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))) {
|
|
|
+ sql += " , \"HourActualWaterSupply\" = '" + value.get("HourActualWaterSupply") + "' ";
|
|
|
}
|
|
|
|
|
|
- sql += " , \"LastModifyTime\" = '"+value.get("LastModifyTime")+"' " +
|
|
|
- " , \"orgId\" = '"+value.get("orgId")+"' ";
|
|
|
+ sql += " , \"LastModifyTime\" = '" + value.get("LastModifyTime") + "' " +
|
|
|
+ " , \"orgId\" = '" + value.get("orgId") + "' ";
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 添加或修改15分钟预测数据
|
|
|
- public int insertOrUpdateTbmHourWaterNew(Map<String,Object> value){
|
|
|
- try{
|
|
|
+ public int insertOrUpdateTbmHourWaterNew(Map<String, Object> value) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO tb_m_hourwater_new " +
|
|
|
"(\"Date\",\"Hour\"";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"HourForecastWaterWithdrawals\" ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourForecastWaterWithdrawals\" ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += " ,\"HourForecastActualWaterSupply\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += " ,\"HourForecastActualWaterSupply\"";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))){
|
|
|
- sql += " , \"HourActualWaterWithdrawals\"";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourActualWaterWithdrawals\"";
|
|
|
}
|
|
|
// if(!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))){
|
|
|
- sql += " , \"HourActualWaterSupply\"";
|
|
|
+ sql += " , \"HourActualWaterSupply\"";
|
|
|
// }
|
|
|
- sql+= ",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
- sql +=" ( ";
|
|
|
+ sql += ",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
+ sql += " ( ";
|
|
|
int i = 1;
|
|
|
- for (Object key : value.keySet()){
|
|
|
- if(i==value.keySet().size()){
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))){
|
|
|
+ for (Object key : value.keySet()) {
|
|
|
+ if (i == value.size()) {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "'";
|
|
|
}
|
|
|
- }else {
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))) {
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ,";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "',";
|
|
|
}
|
|
|
}
|
|
|
@@ -521,53 +515,53 @@ public class WaterZILAISHUIDao {
|
|
|
sql += " )";
|
|
|
sql += " ON CONFLICT (\"Date\",\"orgId\",\"Hour\") " +
|
|
|
" DO UPDATE " +
|
|
|
- " SET \"Date\" = '"+value.get("Date")+"' " +
|
|
|
- " , \"Hour\" = '"+value.get("Hour")+"' ";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))){
|
|
|
- sql += " , \"HourForecastWaterWithdrawals\" = '"+value.get("HourForecastWaterWithdrawals")+"' ";
|
|
|
+ " SET \"Date\" = '" + value.get("Date") + "' " +
|
|
|
+ " , \"Hour\" = '" + value.get("Hour") + "' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourForecastWaterWithdrawals\" = '" + value.get("HourForecastWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += " ,\"HourForecastActualWaterSupply\" = '"+value.get("HourForecastActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += " ,\"HourForecastActualWaterSupply\" = '" + value.get("HourForecastActualWaterSupply") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))){
|
|
|
- sql += " , \"HourActualWaterWithdrawals\" = '"+value.get("HourActualWaterWithdrawals")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterWithdrawals"))) {
|
|
|
+ sql += " , \"HourActualWaterWithdrawals\" = '" + value.get("HourActualWaterWithdrawals") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))){
|
|
|
- sql += " , \"HourActualWaterSupply\" = '"+value.get("HourActualWaterSupply")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourActualWaterSupply"))) {
|
|
|
+ sql += " , \"HourActualWaterSupply\" = '" + value.get("HourActualWaterSupply") + "' ";
|
|
|
}
|
|
|
|
|
|
- sql += " , \"LastModifyTime\" = '"+value.get("LastModifyTime")+"' " +
|
|
|
- " , \"orgId\" = '"+value.get("orgId")+"' ";
|
|
|
+ sql += " , \"LastModifyTime\" = '" + value.get("LastModifyTime") + "' " +
|
|
|
+ " , \"orgId\" = '" + value.get("orgId") + "' ";
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 添加或修改日小时开泵预测表
|
|
|
- public int insertOrUpdateTbmHourwaterWatersupply(Map<String,Object> value){
|
|
|
- try{
|
|
|
+ public int insertOrUpdateTbmHourwaterWatersupply(Map<String, Object> value) {
|
|
|
+ try {
|
|
|
String sql = "INSERT INTO tb_m_hourwater_watersupply " +
|
|
|
"(\"Date\",\"Hour\",\"PumpID\",\"PumpStatus\",";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += "\"HourForecastActualWaterSupply\" ,";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += "\"HourForecastActualWaterSupply\" ,";
|
|
|
}
|
|
|
- sql+= "\"PumpWater\",\"RealPumpStatus\",\"PumpEnergy\",\"RealPumpEnergy\",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
- sql +=" ( ";
|
|
|
+ sql += "\"PumpWater\",\"RealPumpStatus\",\"PumpEnergy\",\"RealPumpEnergy\",\"LastModifyTime\",\"orgId\" ) VALUES ";
|
|
|
+ sql += " ( ";
|
|
|
int i = 1;
|
|
|
- for (Object key : value.keySet()){
|
|
|
- if(i==value.keySet().size()){
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))){
|
|
|
+ for (Object key : value.keySet()) {
|
|
|
+ if (i == value.size()) {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "'";
|
|
|
}
|
|
|
- }else {
|
|
|
- if(ObjectUtils.isEmpty(value.get(key))) {
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isEmpty(value.get(key))) {
|
|
|
sql += " NULL ,";
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sql += "'" + value.get(key) + "',";
|
|
|
}
|
|
|
}
|
|
|
@@ -576,32 +570,32 @@ public class WaterZILAISHUIDao {
|
|
|
sql += " )";
|
|
|
sql += " ON CONFLICT (\"Date\",\"orgId\",\"Hour\",\"PumpID\") " +
|
|
|
" DO UPDATE " +
|
|
|
- " SET \"Date\" = '"+value.get("Date")+"' " +
|
|
|
- " , \"Hour\" = '"+value.get("Hour")+"' "+
|
|
|
- " , \"PumpID\" = '"+value.get("PumpID")+"' "+
|
|
|
- " , \"PumpStatus\" = "+value.get("PumpStatus")+" ";
|
|
|
- if(!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))){
|
|
|
- sql += " ,\"HourForecastActualWaterSupply\" = '"+value.get("HourForecastActualWaterSupply")+"' ";
|
|
|
+ " SET \"Date\" = '" + value.get("Date") + "' " +
|
|
|
+ " , \"Hour\" = '" + value.get("Hour") + "' " +
|
|
|
+ " , \"PumpID\" = '" + value.get("PumpID") + "' " +
|
|
|
+ " , \"PumpStatus\" = " + value.get("PumpStatus") + " ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("HourForecastActualWaterSupply"))) {
|
|
|
+ sql += " ,\"HourForecastActualWaterSupply\" = '" + value.get("HourForecastActualWaterSupply") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("PumpWater"))){
|
|
|
- sql += " , \"PumpWater\" = '"+value.get("PumpWater")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("PumpWater"))) {
|
|
|
+ sql += " , \"PumpWater\" = '" + value.get("PumpWater") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("RealPumpStatus"))){
|
|
|
- sql += " , \"RealPumpStatus\" = "+value.get("RealPumpStatus")+" ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("RealPumpStatus"))) {
|
|
|
+ sql += " , \"RealPumpStatus\" = " + value.get("RealPumpStatus") + " ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("PumpEnergy"))){
|
|
|
- sql += " , \"PumpEnergy\" = '"+value.get("PumpEnergy")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("PumpEnergy"))) {
|
|
|
+ sql += " , \"PumpEnergy\" = '" + value.get("PumpEnergy") + "' ";
|
|
|
}
|
|
|
- if(!ObjectUtils.isEmpty(value.get("RealPumpEnergy"))){
|
|
|
- sql += " , \"RealPumpEnergy\" = '"+value.get("RealPumpEnergy")+"' ";
|
|
|
+ if (!ObjectUtils.isEmpty(value.get("RealPumpEnergy"))) {
|
|
|
+ sql += " , \"RealPumpEnergy\" = '" + value.get("RealPumpEnergy") + "' ";
|
|
|
}
|
|
|
|
|
|
- sql += " , \"LastModifyTime\" = '"+value.get("LastModifyTime")+"' " +
|
|
|
- " , \"orgId\" = '"+value.get("orgId")+"' ";
|
|
|
+ sql += " , \"LastModifyTime\" = '" + value.get("LastModifyTime") + "' " +
|
|
|
+ " , \"orgId\" = '" + value.get("orgId") + "' ";
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
@@ -610,61 +604,61 @@ public class WaterZILAISHUIDao {
|
|
|
* TODO 泵组优化相关
|
|
|
*/
|
|
|
//TODO 获取泵数据采集配置
|
|
|
- public List<Map<String,Object>> getWaterPumpCollectionConfigList(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterPumpCollectionConfigList(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_pump_collection_config ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql+=extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水小时泵数据记录表·分页
|
|
|
- public List<Map<String,Object>> getWaterPumpRecordAllList(int limit,int offset,String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterPumpRecordAllList(int limit, int offset, String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_pump_record_all ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
- sql += " LIMIT " + limit + " OFFSET "+ offset;
|
|
|
+ sql += " LIMIT " + limit + " OFFSET " + offset;
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//TODO 查询市自来水小时泵数据记录表·不分页
|
|
|
- public List<Map<String,Object>> getWaterPumpRecordAllListAll(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWaterPumpRecordAllListAll(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM water_pump_record_all ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public List<Map<String,Object>> getWatertPumpEnergy(String extend){
|
|
|
- try{
|
|
|
+ public List<Map<String, Object>> getWatertPumpEnergy(String extend) {
|
|
|
+ try {
|
|
|
String sql = "SELECT * FROM tb_m_pump_energy ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
sql += extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
- List<Map<String,Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
+ List<Map<String, Object>> tableData = pgJdbc.queryForList(sql);
|
|
|
return tableData;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
@@ -753,18 +747,18 @@ public class WaterZILAISHUIDao {
|
|
|
|
|
|
|
|
|
//TODO 修改自来水小时泵数据记录表value
|
|
|
- public int updateWaterPumpRecordAll(String value,String extend){
|
|
|
- try{
|
|
|
+ public int updateWaterPumpRecordAll(String value, String extend) {
|
|
|
+ try {
|
|
|
String sql = "UPDATE water_level_record_all " +
|
|
|
- " SET \"value\" = "+value+" " +
|
|
|
+ " SET \"value\" = " + value + " " +
|
|
|
" ";
|
|
|
- if(!StringUtils.isEmpty(extend)){
|
|
|
- sql = sql +extend;
|
|
|
+ if (!StringUtils.isEmpty(extend)) {
|
|
|
+ sql = sql + extend;
|
|
|
}
|
|
|
JdbcTemplate pgJdbc = new JdbcTemplate(childDataSource);
|
|
|
Integer resCode = pgJdbc.update(sql);
|
|
|
return resCode;
|
|
|
- }catch(Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
return -1;
|
|
|
}
|
|
|
}
|