展开全部
请问一下是excel的行转32313133353236313431303231363533e78988e69d8331333366303831列吗 ? 写了个工具类解决了。
public Map getColumnToRow(String path,int x,int y){
Map> map=new HashMap<>();
String[][] str=ExcelHelper.poiReader(path, null);
for(int i=1;i
String cid=str[i][x];
String brandname=str[i][y];
if(map.get(cid)==null){
Set set=new HashSet<>();
set.add(brandname);
map.put(cid, set);
}else{
Set set=map.get(cid);
set.add(brandname);
map.put(cid, set);
}
}
Map result=new HashMap<>();
for(String cid:map.keySet()){
Set set=map.get(cid);
String xx="";
for(String s:set){
xx+=s+",";
}
result.put(cid, xx);
}
return result;
}