package com.sinosoft.cm.chart.util; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.sinosoft.cm.chart.service.SystemDataSourceChartServiceImpl; import flex.messaging.io.ArrayList; public class SystemDataSourceChartFactory { public final static String XLT_SUM="xianlutiaozha"; public final static String DG_SOU_SUN_LEI_XING_AND_SUM="shousunleixing"; public final static String DG_SOU_SUN_ZHU_PEI_SUM= "shousunzhupei"; public final static String DG_SOU_SUN_BY_LEVEL="shousunbylevel"; private static SystemDataSourceChartFactory cf=new SystemDataSourceChartFactory(); private static final Log log = LogFactory.getLog(SystemDataSourceChartServiceImpl.class); private SystemDataSourceChartFactory() { } public static SystemDataSourceChartFactory getChartFactory(){ if(cf==null){ cf=new SystemDataSourceChartFactory(); } 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("shousunleixing".equals(charType.trim())){ return cf.getMakeSheBeiShouSunType(map); }else if("shousunzhupei".equals(charType.trim())){ return cf.getMakeSheBeiShouSun(map); }else if("shousunbylevel".equals(charType.trim())){ return cf.getMakeSheBeiShouSunByLevel(map); } return null; } /* * * ROUTE_DMJTD_LJSDXLTZQK * {LJSDXLTZ_TZZS1,500KV线路跳闸总数}, * {LJSDXLTZ_CHCG1,500KV线路重合成功}, {LJSDXLTZ_QSCG1,500KV线路强送成功}, * {LJSDXLTZ_YJGZYS1,500KV线路永久故障已送}, {LJSDXLTZ_WHFTS1,500KV线路未恢复条数}, * * {LJSDXLTZ_TZZS2,220KV线路跳闸总数}, {LJSDXLTZ_CHCG2,220KV线路重合成功}, * {LJSDXLTZ_QSCG2,220KV线路强送成功}, {LJSDXLTZ_YJGZYS2,220KV线路永久故障已送}, * {LJSDXLTZ_WHFTS2,220KV线路未恢复条数}, * * {LJSDXLTZ_TZZS3,110KV线路跳闸总数}, * {LJSDXLTZ_CHCG3,110KV线路重合成功}, {LJSDXLTZ_QSCG3,110KV线路强送成功}, * {LJSDXLTZ_YJGZYS3,110KV线路永久故障已送}, * {LJSDXLTZ_WHFTS3,110KV线路未恢复条数}, * * {LJSDXLTZ_TZZS4,35KV线路跳闸总数}, {LJSDXLTZ_WHFTS4,35KV线路未恢复条数}, * * {LJSDXLTZ_TZZS5,10KV线路跳闸总数}, {LJSDXLTZ_WHFTS5,10KV线路未恢复条数}, {COLUMN_1,0}, * {COLUMN_2,0}, {COLUMN_3,0}, {COLUMN_4,0}, {COLUMN_5,0}, {COLUMN_6,0} */ private Map getMakeXianlutiaozha(Map map){ Map makeMap=new HashMap(); makeMap.put("sum", "LJSDXLTZ_TZZS1-LJSDXLTZ_TZZS2-LJSDXLTZ_TZZS3-LJSDXLTZ_TZZS4-LJSDXLTZ_TZZS5"); makeMap.put("unsum", "LJSDXLTZ_WHFTS1-LJSDXLTZ_WHFTS2-LJSDXLTZ_WHFTS3-LJSDXLTZ_WHFTS4-LJSDXLTZ_TZZS5"); 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", "PRESSURE_LOSS_ONE-PRESSURE_LOSS_TWO-PRESSURE_LOSS_THREE-PRESSURE_LOSS_FOUR"); makeMap.put("unsum", "NO_RECOVER_ONE-NO_RECOVER_TWO-NO_RECOVER_THREE-NO_RECOVER_FOUR"); 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,"-"); } /** * 获取处理之后的数据 * @param mapData 需要处理的数据 * @param labelMap 需要处理数据的标签 * @param sprate 标签的分隔符 * @return */ public static Map getMakeData(Map mapData,Map labelMap,String sprate){ cf=getChartFactory(); 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(); map.put("aa","1"); map.put("bb","1"); map.put("cc","1"); map.put("dd","2"); map.put("ee","3"); map=getMakeData(map,mapLable,"-"); System.out.println(map); } /** * 获取处理之后的数据 * @param mapData 需要处理的数据 * @param labelMap 需要处理数据的标签 * @param sprate 标签的分隔符 * @return * @throws Exception */ public static Map 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