| 
					
				 | 
			
			
				@ -171,10 +171,10 @@ public class ServiceMonitorService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void usage(String beginTime, String endTime) throws JsonProcessingException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DBObject match = getMatchFields(beginTime, endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DBObject group = getFlowGroupFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DBObject flowGroup = getFlowGroupFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DBObject sort = getSortFields(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // run aggregation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        AggregationOutput flowOutput = getBusinessLog().aggregate(match, group, sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        AggregationOutput flowOutput = getBusinessLog().aggregate(match, flowGroup, sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer successCountF = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer failureCountF = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String routeId = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -247,7 +247,7 @@ public class ServiceMonitorService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (count >= 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String begin = StringUtil.toString(dbObject.get("beginTime")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String end = StringUtil.toString(dbObject.get("endTime")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                long interval = getInterval(begin, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                long interval = getIntervalExact(begin, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                flowDelay = flowDelay.add(BigDecimal.valueOf(interval)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -264,7 +264,7 @@ public class ServiceMonitorService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                DBObject dbObjectTemp = serviceMap.remove(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String begin = StringUtil.toString(dbObjectTemp.get("fireTime")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String end = StringUtil.toString(dbObject.get("fireTime")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                long interval = getInterval(begin, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                long interval = getIntervalExact(begin, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (delayMap.containsKey(code)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BigDecimal delayTemp = delayMap.get(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    delayMap.put(code, delayTemp.add(BigDecimal.valueOf(interval))); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -327,6 +327,13 @@ public class ServiceMonitorService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public long getInterval(String beginTime, String endTime) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date from = DateUtil.toTimestamp(beginTime, DateUtil.DEFAULT_YMDHMSDATE_FORMAT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date to = DateUtil.toTimestamp(endTime, DateUtil.DEFAULT_YMDHMSDATE_FORMAT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long interval = (to.getTime() - from.getTime())/1000; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return interval; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public long getIntervalExact(String beginTime, String endTime) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date from = DateUtil.toTimestamp(beginTime, DateUtil.DEFAULT_TIMESTAMP_FORMAT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date to = DateUtil.toTimestamp(endTime, DateUtil.DEFAULT_TIMESTAMP_FORMAT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long interval = (to.getTime() - from.getTime())/1000; 
			 |