Authored by 王凤

合并分支 'swy' 到 'master'

不知道是干啥的,但就是缺少了



查看合并请求 !7
package com.sitech.database.dao;
import com.sitech.ismp.messageObject.TbAtoDynamicThreshold;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created with IntelliJ IDEA.
* User: dongyj
* Date: 16-11-1
* Time: 上午10:12
* To change this template use File | Settings | File Templates.
*/
public class TbAtoDynamicThresholdDao extends BaseDao {
@SuppressWarnings("unchecked")
public List<TbAtoDynamicThreshold> queryDynamicCfgByKpiId(TbAtoDynamicThreshold tbAtoDynamicThreshold) {
try {
Map map = new HashMap();
map.put("UNIT_ID",tbAtoDynamicThreshold.getUNIT_ID().trim());
map.put("EXT_UNIT_ID",getExtUnitId(tbAtoDynamicThreshold.getUNIT_ID().trim()));
map.put("KPI_ID",tbAtoDynamicThreshold.getKPI_ID().trim());
map.put("CLL_TIME",tbAtoDynamicThreshold.getSTART_TIME());
map.put("DB_TIME",tbAtoDynamicThreshold.getEND_TIME());
return sqlmapClient.queryForList("queryDynamicCfgByKpiId", map);
} catch (Exception e) {
error.error("Exception while queryEventCfgByKpiId("+tbAtoDynamicThreshold+")", e);
return null;
}
}
/**
* 新增动态阀值数据
* @param tbAtoDynamicThreshold
*/
public void insertTbAtoDynamicThreshold(TbAtoDynamicThreshold tbAtoDynamicThreshold) {
try {
sqlmapClient.insert("insertTbAtoDynamicThreshold", tbAtoDynamicThreshold);
} catch (Exception e) {
error.error("Exception while insertTbAtoDynamicThreshold.", e);
}
}
/**
* 删除表中所有动态阀值配置
* @return
*/
public int deleteTbAtoDynamicThresholdAll() {
try {
return sqlmapClient.delete("deleteTbAtoDynamicThresholdAll", null);
} catch (Exception e) {
error.error("Exception while deleteTbAtoDynamicThresholdAll.", e);
return -1;
}
}
/**
* 根据guid[]删除动态阀值配置
* @param id
* @return
*/
public int deleteTbAtoDynamicThreshold(String[] id) {
HashMap<String, String[]> params = new HashMap<String, String[]>();
params.put("ID", id);
try {
return sqlmapClient.delete("deleteTbAtoDynamicThreshold", params);
} catch (Exception e) {
error.error("Exception while deleteTbAtoDynamicThreshold.", e);
return -1;
}
}
public static String getExtUnitId(String unitId) {
Matcher platform = Pattern.compile("^(10\\-\\d+\\-\\d++).*:([^\\-]+).*$").matcher(unitId);
if (platform.find()) {
return platform.group(1) + ":" + platform.group(2);
}
return "";
}
}
... ...
... ... @@ -189,31 +189,22 @@ public class SQLTarget extends CollBase {
Vector recordSet = new Vector();
PreparedStatement pstmt = null;
ResultSet result = null;
if (!getState()) {
return recordSet;
}
try {
pstmt = dbConnection.prepareStatement(sql);
} catch (SQLException e) {
throw new RuntimeException("Exception while exec sql :" + sql, e);
}
if (!getState()) {
return recordSet;
}
boolean hasResult = false;
try {
hasResult = pstmt.execute();
} catch (SQLException e) {
logger.error("pstmt.execute() has error!",e);
e.printStackTrace();
}
try {
pstmt = dbConnection.prepareStatement(sql);
//避免在采集9i数据库时,在CollOracleBySql.getTableSpaces()方法中无法执行catch里面的方法,
// 将此处的捕捉异常去掉,统一捕获异常 2017-5-25 swy(代码之前是没有在这里捕获异常的)
boolean hasResult = pstmt.execute();
if (hasResult) {
result = pstmt.getResultSet();
ResultSetMetaData rsmd = result.getMetaData();
int iColumnCount = rsmd.getColumnCount();
while (result.next()) {
Vector vTemp = new Vector();
java.util.Vector vTemp = new Vector();
for (int i = 0; i < iColumnCount; i++) {
Object oTemp = result.getObject(i + 1);
String sTemp = oTemp == null ? "" : oTemp.toString();
... ...