|
@ -465,10 +465,11 @@ public class DatacollectService implements IDatacollectService {
|
|
|
}
|
|
|
|
|
|
strSql += strWhere;
|
|
|
//总条数和最大值查询
|
|
|
String sqlCount = "select count(1) as COUNT,max(" + maxKey + ") as MAX_KEYVALUE from (" + strSql+")";
|
|
|
JSONObject obj = db.load(sqlCount);
|
|
|
if(obj==null)
|
|
|
//总条数
|
|
|
String sqlCount = "select count(1) as COUNT from (" + strSql+")";
|
|
|
String sqlMax = "select max(" + maxKey + ") as MAX_KEYVALUE from " + adapterTableName + strWhere;
|
|
|
JSONObject objCount = db.load(sqlCount);
|
|
|
if(objCount==null)
|
|
|
{
|
|
|
if(db.errorMessage.length()>0)
|
|
|
{
|
|
@ -479,7 +480,7 @@ public class DatacollectService implements IDatacollectService {
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
int count = obj.getInt("COUNT");
|
|
|
int count = objCount.getInt("COUNT");
|
|
|
|
|
|
if(count==0) //0条记录,无需采集
|
|
|
{
|
|
@ -487,8 +488,11 @@ public class DatacollectService implements IDatacollectService {
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取最大值
|
|
|
JSONObject objMax = db.load(sqlMax);
|
|
|
|
|
|
int successCount = 0;
|
|
|
String maxKeyvalue = obj.optString("MAX_KEYVALUE");
|
|
|
String maxKeyvalue = objMax.optString("MAX_KEYVALUE");
|
|
|
//修改最大值
|
|
|
if(maxKeyvalue!=null&& maxKeyvalue.length()>0)
|
|
|
{
|
|
@ -685,9 +689,10 @@ public class DatacollectService implements IDatacollectService {
|
|
|
}
|
|
|
strSql += strWhere;
|
|
|
//总条数和最大值查询
|
|
|
String sqlCount = "select count(1) as COUNT,max(" + maxKey + ") as MAX_KEYVALUE from (" + strSql +")";
|
|
|
String sqlCount = "select count(1) as COUNT from (" + strSql+")";
|
|
|
String sqlMax = "select max(" + maxKey + ") as MAX_KEYVALUE from " + adapterTableName + strWhere;
|
|
|
|
|
|
//webservice获取数据//获取总条数和最大值
|
|
|
//webservice获取数据总条数
|
|
|
String strCount = WebserviceUtil.request(url,"ExcuteSQL",new Object[]{"",sqlCount});
|
|
|
List<JSONObject> dataCount = getListFromXml(strCount);
|
|
|
|
|
@ -698,8 +703,12 @@ public class DatacollectService implements IDatacollectService {
|
|
|
message = "0条记录,无需采集。";
|
|
|
}
|
|
|
else {
|
|
|
//webservice获取最大值
|
|
|
String strMax = WebserviceUtil.request(url,"ExcuteSQL",new Object[]{"",sqlMax});
|
|
|
List<JSONObject> dataMax = getListFromXml(strCount);
|
|
|
int successCount = 0;
|
|
|
String maxKeyvalue = dataCount.get(0).getString("MAX_KEYVALUE");
|
|
|
String maxKeyvalue = dataMax.get(0).getString("MAX_KEYVALUE");
|
|
|
|
|
|
//修改最大值
|
|
|
if (maxKeyvalue != null && maxKeyvalue.length() > 0) {
|
|
|
datacollectLogDao.updateJobDatasetKeyvalue(ds.getId(), maxKeyvalue);
|