public static Map<String, Integer> readXls() throws IOException {
//用來獲取每一個小號重復多次,被多少賬號用了。來平均 58 agent 查詢出來的數據。
Map<String, Integer> map = new HashMap<String, Integer>();
InputStream is = new FileInputStream("C:\\Users\\25\\Desktop\\dankeAnalyze\\新建文件夾\\58總數據20190613.xlsx");
XSSFWorkbook hssfWorkbook = new XSSFWorkbook(is);
// 循環工作表Sheet
for (int numSheet = 0; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
XSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
if (hssfSheet == null) {
continue;
}
// 循環行Row
NumberFormat nf = NumberFormat.getInstance();
for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
XSSFRow hssfRow = hssfSheet.getRow(rowNum);
if (hssfRow != null) {
String phone_58 = (nf.format(hssfRow.getCell(11).getNumericCellValue())).replace(",", "");
XSSFCell dkstatus = hssfRow.getCell(17);
if(!getValue(dkstatus).equals("服務中")||phone_58==null||phone_58.length()!=11/*||!city.equals("北京")*/){
continue;
}
//通過 登錄名獲取展示手機號
if(map.containsKey(phone_58)){
map.put(phone_58, map.get(phone_58)+1);
}else{
map.put(phone_58, 1);
}
}
}
}
for(Map.Entry<String, Integer> entry : map.entrySet()){
System.out.println(entry.getKey()+":"+entry.getValue());
}
return map;
}