/** * 计算出某应用一段时间内的值 * * @version 2012-4-9 * @param groupName * @param appName * @param startDate * @param endDate * @return map<time, TairSumData> */ public Map<String, TairSumData> findTairProviderAppChart( String groupName, String appName, String startDate, String endDate) { Map<String, TairSumData> timeTairDateMap = new HashMap<String, TairSumData>(); List<TairNamespacePo> tairNamespaceList = dao.findTairProviderChartByAppName(groupName, appName, startDate, endDate); for (TairNamespacePo po : tairNamespaceList) { String collctTime = po.getCollectTime(); TairSumData appTairData = timeTairDateMap.get(collctTime); if (appTairData == null) { appTairData = new TairSumData(); timeTairDateMap.put(collctTime, appTairData); } appTairData.addAppCallSum(po.getCallSumNum()); appTairData.calculateRushQps(po.getRushQps()); appTairData.calculateRushRt(po.getRushRt()); appTairData.appTairNamespaceList(po); } return timeTairDateMap; }
/** * 已tair的groupName为单位找到消耗tair的应用情况 * * @param groupName * @param date * @return */ public Map<String, TairSumData> findTairProviderTopApp(String groupName, String date) { Map<String, TairSumData> appTairDataMap = new HashMap<String, TairSumData>(); List<TairNamespacePo> tairNamespaceList = dao.findTairProviderSummaryList(groupName, date); for (TairNamespacePo po : tairNamespaceList) { String appName = po.getAppName(); TairSumData appTairData = appTairDataMap.get(appName); if (appTairData == null) { appTairData = new TairSumData(); appTairData.setAppName(appName); appTairDataMap.put(appName, appTairData); } appTairData.addAppCallSum(po.getCallSumNum()); appTairData.calculateRushQps(po.getRushQps()); appTairData.calculateRushRt(po.getRushRt()); appTairData.appTairNamespaceList(po); } return appTairDataMap; }