|
|
@@ -119,13 +119,12 @@ public class ZoneDataWarnHandler {
|
|
|
findStartClock = rules.get(i).getStarts()-1;
|
|
|
}
|
|
|
queryBeginUTC = TimeTool.convertDateStr2UTC(String.format("%s %02d:00:00", curDate, findStartClock+1));
|
|
|
+ queryBeginUTC = queryBeginUTC - TimeTool.MS_ONE_DAY;//最多只往前分析1天
|
|
|
ruleStartClock = findStartClock+1;
|
|
|
|
|
|
if (doForTodayBefore){//只分析昨日
|
|
|
- queryBeginUTC = queryBeginUTC - TimeTool.MS_ONE_DAY;
|
|
|
queryEndUTC = TimeTool.getTodayBeginUTC()-TimeTool.MS_ONE_SEC;
|
|
|
conditionMinUTC = Math.min(conditionMinUTC-TimeTool.MS_ONE_DAY, queryBeginUTC);//针对昨日:触发规则列表中第一个时段的起始时刻
|
|
|
-
|
|
|
/*queryBeginUTC = TimeTool.getTodayBeginUTC()-TimeTool.MS_ONE_HOUR;
|
|
|
queryEndUTC = TimeTool.getTodayBeginUTC()-TimeTool.MS_ONE_SEC;
|
|
|
conditionMinUTC = Math.min(conditionMinUTC-TimeTool.MS_ONE_DAY, queryBeginUTC);//针对昨日:触发规则列表中第一个时段的起始时刻
|
|
|
@@ -136,7 +135,8 @@ public class ZoneDataWarnHandler {
|
|
|
thisStepTempRes.resetData();
|
|
|
}else {
|
|
|
int sampleClock = (int)((thisStepTempRes.getLastCompareSampleTime()/1000/60/60%24+8)%24);
|
|
|
- if (sampleClock >= ruleStartClock && sampleClock <= ruleEndClock){
|
|
|
+ if ((sampleClock >= ruleStartClock && sampleClock <= ruleEndClock)
|
|
|
+ || ((sampleClock+1)%24) == ruleStartClock){
|
|
|
queryBeginUTC = Math.max(queryBeginUTC, thisStepTempRes.getLastCompareSampleTime() + TimeTool.MS_ONE_HOUR);
|
|
|
}else//样本跨了时段则重新计数
|
|
|
thisStepTempRes.resetData();
|
|
|
@@ -258,7 +258,8 @@ public class ZoneDataWarnHandler {
|
|
|
thisStepTempRes.resetData();
|
|
|
}else {
|
|
|
int sampleInMonth = TimeTool.getMonthIndex(thisStepTempRes.getLastCompareSampleTime());
|
|
|
- if (sampleInMonth >= ruleStartRange && sampleInMonth <= ruleEndRange){
|
|
|
+ if ((sampleInMonth >= ruleStartRange && sampleInMonth <= ruleEndRange)
|
|
|
+ || (sampleInMonth%12+1) == ruleStartRange){
|
|
|
queryBeginUTC = Math.max(queryBeginUTC, TimeTool.getTimeChgMonth(thisStepTempRes.getLastCompareSampleTime(), 1));
|
|
|
}else//样本跨了时段则重新计数
|
|
|
thisStepTempRes.resetData();
|
|
|
@@ -385,7 +386,8 @@ public class ZoneDataWarnHandler {
|
|
|
thisStepTempRes.resetData();
|
|
|
}else {
|
|
|
int sampleInMonth = TimeTool.getMonthIndex(thisStepTempRes.getLastCompareSampleTime());
|
|
|
- if (sampleInMonth >= ruleStartRange && sampleInMonth <= ruleEndRange){
|
|
|
+ if ((sampleInMonth >= ruleStartRange && sampleInMonth <= ruleEndRange)
|
|
|
+ || (sampleInMonth%12+1) == ruleStartRange){
|
|
|
queryBeginUTC = Math.max(queryBeginUTC, thisStepTempRes.getLastCompareSampleTime() + TimeTool.MS_ONE_DAY);
|
|
|
}else//样本跨了时段则重新计数
|
|
|
thisStepTempRes.resetData();
|
|
|
@@ -868,6 +870,16 @@ public class ZoneDataWarnHandler {
|
|
|
filterExtend.append(String.format(" AND adf.%s <> 0.0 ", storeField));
|
|
|
}
|
|
|
break;
|
|
|
+ case WarnItemType.METER_DIFF:{
|
|
|
+ doTimeField = String.format("mdf.%s", doTimeField);
|
|
|
+ queryField = String.format("mdf.zone_id,'%s' as key,(mdf.%s/swo.%s)*100 AS value,%s as date"
|
|
|
+ , backField
|
|
|
+ , storeField
|
|
|
+ , storeField
|
|
|
+ , doTimeField);
|
|
|
+ filterExtend.append(String.format(" AND swo.%s <> 0.0 ", storeField));
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -912,6 +924,14 @@ public class ZoneDataWarnHandler {
|
|
|
, filterExtend.toString());
|
|
|
}
|
|
|
break;
|
|
|
+ case WarnItemType.METER_DIFF:{
|
|
|
+ arrDbs = getMixDataDBService().batchQueryMeterDiffData(desTable
|
|
|
+ , queryField
|
|
|
+ , objId
|
|
|
+ , orderBy
|
|
|
+ , filterExtend.toString());
|
|
|
+ }
|
|
|
+ break;
|
|
|
case WarnItemType.RBI:{
|
|
|
arrDbs = getMixDataDBService().batchQueryRbiRankData(desTable
|
|
|
, objId
|