commit code

This commit is contained in:
super_liu
2021-06-08 16:16:26 +08:00
commit 7dcf0b0406
724 changed files with 145710 additions and 0 deletions
@@ -0,0 +1,40 @@
package com.ydw.bat.wkflow.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description: TODO
* @author: super_liu
* @date: 2021年03月04日 17:13
*/
public class Utils {
public static Map<String, JSONArray> jsonArrGroup(JSONArray arr, String groupName, String sGroupName) {
Map<String, JSONArray> map = new HashMap<>();
String tempIdStr = "";
JSONArray list;
for(Object obj : arr){
JSONObject jsonObject = (JSONObject) obj;
tempIdStr = jsonObject.getString(groupName);
if(tempIdStr.equals("")){
continue;
}
if(map.containsKey(tempIdStr)){
list = map.get(tempIdStr);
list.add(obj);
}else{
list = new JSONArray();
list.add(obj);
map.put(tempIdStr, list);
}
}
return map;
}
}