package com.sinosoft.cm.chart.util; import java.util.HashMap; import java.util.List; import java.util.Map; import flex.messaging.io.ArrayList; public class ChartFactory { private static ChartFactory cf=new ChartFactory(); private ChartFactory() { } public static ChartFactory getChartFactory(){ if(cf==null){ cf=new ChartFactory(); } return cf; } /** * 获取数据的汇众数据 * @param charType * @param map * @return */ public static Map getMakeData(String charType,Map map){ cf=getChartFactory(); if("xianlutiaozha".equals(charType.trim())){ return cf.getMakeXianlutiaozha(map); }else if("biandianzhantingyun".equals(charType.trim())){ return cf.getMakeBianDianZhanTingYun(map); }else if("shebeisousun".equals(charType.trim())){ return cf.getMakeSheBeiShouSun(map); }else if("shebeisousuntype".equals(charType.trim())){ return cf.getMakeSheBeiShouSunType(map); }else if("shebeisousunlevel".equals(charType.trim())){ return cf.getMakeSheBeiShouSunByLevel(map); }else if("yonghutingdian".equals(charType.trim())){ return cf.getYongHuTingDian(map); }else if("yonghutingdianf".equals(charType.trim())){ return cf.getYongHuTingDianFloat(map); } return null; } public static String getTabelName(String tabelName){ Map map=new HashMap(); map.put("xianLuTiaoZha","ROUTE_OFLINE_DETAIL"); map.put("bianDianZhanTingYun","BDZ_XQ_DETAIL"); map.put("sheBeiShouSun","XLDG_XQ_DETAIL"); map.put("zhongYaoYongHu","TDQK_XQ_DETAIL"); map.put("yingJiRenYuanTouRu","YJZY_XQ_DETAIL"); return getTabelName(tabelName); } /* {"state":"SUCCESS","total":1,"rows":[{"TRIP_OUT_TWO":"842", "FD_OBJECTID":"338145700760612400113623100000", "UPDATEDATE":"0","REMARK_ONE":"","COMP_ID":"0", "DEPT_NAME":"0","TRIP_OUT_FOUR":"812", "TRIP_OUT_FIVE":"752","REMARK_THREE":"", "NO_RECOVER_FIVE":"91", "TRIP_OUT_TOTAL_ONE":"58","WARNING_NUMBER":"防风防汛-F-2016-5" ,"NO_RECOVER_FOUR":"109","REMARK_TWO":"","NO_RECOVER_TWO":"51", "NO_RECOVER_ONE":"88","DATA_TYPE":"0","TRIP_OUT_TOTAL_TWO":"51","COLUMN_4":"0", "COLUMN_3":"0","NO_RECOVER_THREE":"109","TRIP_OUT_TOTAL_THREE":"47","APPEAR_TIME":"2016-03-03 20:24:35","PARENT_NAME":"广东电网公司", "TRIP_OUT_THREE":"700","TRIP_OUT_ONE":"778","REPORT_TYPE":"1", "LOSS_LOAD":"81","PARENT_ID":"11","REPORT_ID":"778145700786871220000079100000"}]}*/ /** * 获取线路跳闸的汇总数据 * @param map * @return */ private Map getMakeXianlutiaozha(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "TRIP_OUT_ONE-TRIP_OUT_TWO-TRIP_OUT_THREE-TRIP_OUT_FOUR-TRIP_OUT_FIVE"); makeMap.put("unsum", "NO_RECOVER_ONE-NO_RECOVER_TWO-NO_RECOVER_THREE-NO_RECOVER_FOUR-NO_RECOVER_FIVE"); return getMakeData(map,makeMap,"-"); } /** * PRESSURE_LOSS_ONE,NO_RECOVER_ONE, -----500kV线路 * PRESSURE_LOSS_ONE,NO_RECOVER_TWO, -----220kV线路 * PRESSURE_LOSS_ONE,NO_RECOVER_THREE, -----110kV线路 * PRESSURE_LOSS_ONE,NO_RECOVER_FOUR -----35kV线路 */ /** *获取变电站停运汇总数据 * @param map * @return */ private Map getMakeBianDianZhanTingYun(Map map){ Map makeMap=new HashMap(); //makeMap.put("sum", "SHIYAZUO_500KV-SHIYAZUO_220KV-SHIYAZUO_35KV"); //makeMap.put("unsum", "WEIHUIFUZUO_500KV-WEIHUIFUZUO_220KV-WEIHUIFUZUO_35KV"); makeMap.put("sum", "SHIYAZUO_500KV-SHIYAZUO_220KV-SHIYAZUO_110KV-SHIYAZUO_35KV"); makeMap.put("unsum", "WEIHUIFUZUO_500KV-WEIHUIFUZUO_220KV-WEIHUIFUZUO_110KV-WEIHUIFUZUO_35KV"); return getMakeData(map,makeMap,"-"); } /** * PLON_DAOTA_500, PLON_BIANXING_500, UNRECOVER_500, ------500kV倒杆变现未恢复 * PLON_DAOTA_220,PLON_BIANXING_220, UNRECOVER_220, ------220kV倒杆变现未恢复 * PLON_DAOTA_110,PLON_BIANXING_110,DUANGAN_110,DAOGAN_110,DIANGAN_QIGNXIE_110, UNRECOVER_110, ------110倒塌断杆倾斜变形未恢复 * PLON_DAOTA_35,PLON_BIANXING_35,DUANGAN_35,DAOGAN_35,DIANGAN_QIGNXIE_35, UNRECOVER_35, ------35倒塌断杆倾斜变形未恢复 * PLON_DAOTA_10,PLON_BIANXING_10,DUANGAN_10,DAOGAN_10,DIANGAN_QIGNXIE_10, UNRECOVER_10, ------10倒塌断杆倾斜变形未恢复 * DAUNGAN_DIYA,DAOGAN_DIYA,QINGGAN_DIYA, UNRECOVER_DIYA ------低压断杆倒杆倾斜未恢复 */ /** * 获取设备受损汇总数据 * @param map * @return */ private Map getMakeSheBeiShouSunType(Map map){ Map makeMap=new HashMap(); makeMap.put("tietadaota", "PLON_DAOTA_500-PLON_DAOTA_220" + "-PLON_DAOTA_110-PLON_DAOTA_35" + "-PLON_DAOTA_10"); makeMap.put("tietabianxing", "PLON_BIANXING_500-PLON_BIANXING_220-PLON_BIANXING_110-PLON_BIANXING_35-PLON_BIANXING_10"); makeMap.put("duangan", "DUANGAN_110-DUANGAN_35-DUANGAN_10" + "-DAUNGAN_DIYA"); makeMap.put("daogan", "DAOGAN_110-DAOGAN_35-DAOGAN_10-DAOGAN_DIYA"); makeMap.put("dianganqinxie", "DIANGAN_QIGNXIE_110-DIANGAN_QIGNXIE_35" + "-DIANGAN_QIGNXIE_10" + "-QINGGAN_DIYA"); makeMap.put("sum", "PLON_DAOTA_500-PLON_BIANXING_500" + "-PLON_DAOTA_220-PLON_BIANXING_220" + "-PLON_DAOTA_110-PLON_BIANXING_110-DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110" + "-PLON_DAOTA_35-PLON_BIANXING_35-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35" + "-PLON_DAOTA_10-PLON_BIANXING_10-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10" + "-DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); makeMap.put("unsum", "UNRECOVER_500-UNRECOVER_220-UNRECOVER_110-UNRECOVER_35-UNRECOVER_10-UNRECOVER_DIYA"); return getMakeData(map,makeMap,"-"); } /** * 获取设备受损汇总数据 * @param map * @return */ /** * PLON_DAOTA_500,PLON_BIANXING_500, UNRECOVER_500, ------500kV倒杆变现未恢复 * PLON_DAOTA_220,PLON_BIANXING_220, UNRECOVER_220, ------220kV倒杆变现未恢复 * PLON_DAOTA_110,PLON_BIANXING_110, DUANGAN_110,DAOGAN_110,DIANGAN_QIGNXIE_110, UNRECOVER_110, ------110倒塌断杆倾斜变形未恢复 * PLON_DAOTA_35,PLON_BIANXING_35,DUANGAN_35,DAOGAN_35,DIANGAN_QIGNXIE_35, UNRECOVER_35, ------35倒塌断杆倾斜变形未恢复 * PLON_DAOTA_10,PLON_BIANXING_10,DUANGAN_10,DAOGAN_10,DIANGAN_QIGNXIE_10, UNRECOVER_10, ------10倒塌断杆倾斜变形未恢复 * DAUNGAN_DIYA,DAOGAN_DIYA,QINGGAN_DIYA, UNRECOVER_DIYA ------低压断杆倒杆倾斜未恢复 */ private Map getMakeSheBeiShouSun(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "PLON_DAOTA_500-PLON_BIANXING_500" + "-PLON_DAOTA_220-PLON_BIANXING_220" + "-PLON_DAOTA_110-PLON_BIANXING_110-DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110" + "-PLON_DAOTA_35-PLON_BIANXING_35-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35" + "-PLON_DAOTA_10-PLON_BIANXING_10-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10" + "-DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); makeMap.put("unsum", "UNRECOVER_500-UNRECOVER_220-UNRECOVER_110-UNRECOVER_35-UNRECOVER_10-UNRECOVER_DIYA"); makeMap.put("main", "PLON_DAOTA_500-PLON_BIANXING_500" + "-PLON_DAOTA_220-PLON_BIANXING_220" + "-PLON_DAOTA_110-PLON_BIANXING_110-DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110" + "-PLON_DAOTA_35-PLON_BIANXING_35-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35"); makeMap.put("help", "PLON_DAOTA_10-PLON_BIANXING_10-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10" + "-DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); makeMap.put("tieta", "PLON_DAOTA_500-PLON_BIANXING_500" + "-PLON_DAOTA_220-PLON_BIANXING_220" + "-PLON_DAOTA_110-PLON_BIANXING_110" + "-PLON_DAOTA_35-PLON_BIANXING_35" + "-PLON_DAOTA_10-PLON_BIANXING_10"); makeMap.put("diangan", "DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110" + "-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35" + "-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10" + "-DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); return getMakeData(map,makeMap,"-"); } /** * PLON_DAOTA_500,PLON_BIANXING_500, UNRECOVER_500, ------500kV倒杆变现未恢复 * PLON_DAOTA_220,PLON_BIANXING_220, UNRECOVER_220, ------220kV倒杆变现未恢复 * PLON_DAOTA_110,PLON_BIANXING_110, DUANGAN_110,DAOGAN_110,DIANGAN_QIGNXIE_110, UNRECOVER_110, ------110倒塌断杆倾斜变形未恢复 * PLON_DAOTA_35,PLON_BIANXING_35,DUANGAN_35,DAOGAN_35,DIANGAN_QIGNXIE_35, UNRECOVER_35, ------35倒塌断杆倾斜变形未恢复 * PLON_DAOTA_10,PLON_BIANXING_10,DUANGAN_10,DAOGAN_10,DIANGAN_QIGNXIE_10, UNRECOVER_10, ------10倒塌断杆倾斜变形未恢复 * DAUNGAN_DIYA,DAOGAN_DIYA,QINGGAN_DIYA, UNRECOVER_DIYA ------低压断杆倒杆倾斜未恢复 */ private Map getMakeSheBeiShouSunByLevel(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "PLON_DAOTA_500-PLON_BIANXING_500" + "-PLON_DAOTA_220-PLON_BIANXING_220" + "-PLON_DAOTA_110-PLON_BIANXING_110-DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110" + "-PLON_DAOTA_35-PLON_BIANXING_35-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35" + "-PLON_DAOTA_10-PLON_BIANXING_10-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10" + "-DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); makeMap.put("unsum", "UNRECOVER_500-UNRECOVER_220-UNRECOVER_110-UNRECOVER_35-UNRECOVER_10-UNRECOVER_DIYA"); makeMap.put("five", "PLON_DAOTA_500-PLON_BIANXING_500"); makeMap.put("two", "PLON_DAOTA_220-PLON_BIANXING_220"); makeMap.put("one", "PLON_DAOTA_110-PLON_BIANXING_110-DUANGAN_110-DAOGAN_110-DIANGAN_QIGNXIE_110"); makeMap.put("three", "PLON_DAOTA_35-PLON_BIANXING_35-DUANGAN_35-DAOGAN_35-DIANGAN_QIGNXIE_35"); makeMap.put("ten", "PLON_DAOTA_10-PLON_BIANXING_10-DUANGAN_10-DAOGAN_10-DIANGAN_QIGNXIE_10"); makeMap.put("diya", "DAUNGAN_DIYA-DAOGAN_DIYA-QINGGAN_DIYA"); return getMakeData(map,makeMap,"-"); } /** TQ_TD_COUNT,TQ_UNRECOVERED, ----台区停电数 YH_TD_COUNT,YH_UNRECOVERED, ----用户停电数 TJYH_TD_COUNT,TJYH_UNRECOVERED, ----特级用户停电数 YJYH_TD_COUNT,YJYH_UNRECOVERED, ----一级用户停电数 EJYH_TD_COUNT,EJYH_UNRECOVERED, ----二级用户停电数 ENERGY_LOSS */ /** * 获取设备受损汇总数据 * @param map * @return */ private Map getYongHuTingDian(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "TJYH_TD_COUNT-YJYH_TD_COUNT-EJYH_TD_COUNT"); makeMap.put("unsum", "TJYH_UNRECOVERED-YJYH_UNRECOVERED-EJYH_UNRECOVERED"); return getMakeData(map,makeMap,"-"); } private Map getYongHuTingDianFloat(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "TJYH_TD_COUNT-YJYH_TD_COUNT-EJYH_TD_COUNT"); makeMap.put("unsum", "TJYH_UNRECOVERED-YJYH_UNRECOVERED-EJYH_UNRECOVERED"); return getMakeDataFloat(map,makeMap,"-"); } public static Map getMakeDataFloat(Map mapData,Map labelMap,String sprate){ cf=getChartFactory(); for(String key:labelMap.keySet()){ String[] sumArr=labelMap.get(key).split(sprate); Float sum = new Float(0); for(int index=0,len=sumArr.length;index getMakeData(Map mapData,Map labelMap,String sprate){ cf=getChartFactory(); for(String key:labelMap.keySet()){ String[] sumArr=labelMap.get(key).split(sprate); Float sum = new Float(0); for(int index=0,len=sumArr.length;index getMakeData(Map mapData,Map labelMap,String sprate,StringMake makeHandle) throws Exception{ for(String key:labelMap.keySet()){ String[] sumArr=labelMap.get(key).split(sprate); Long sum = new Long(0); for(int index=0,len=sumArr.length;index