电炸全国案件接口新增案件去重

parent fead9005
......@@ -6,6 +6,7 @@ import com.founder.interservice.qgzyfw.domain.GabConfig;
import com.founder.interservice.util.StringUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -13,10 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
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;
import java.util.*;
@Controller
@CrossOrigin //跨域访问
......@@ -229,9 +228,9 @@ public class MinistrySuspectInfoController {
if(!resList.isEmpty() && resList.size()>0){
resultList.addAll(resList);
}
}
if(!resultList.isEmpty() && resultList != null){
resultList = removeRepetitiveList(resultList);
resultObj.put("code", ResultEnum.SUCCESS.getCode());
resultObj.put("message",ResultEnum.SUCCESS.getMessage());
}else {
......@@ -247,5 +246,32 @@ public class MinistrySuspectInfoController {
}
return resultObj;
}
@Async
public List<Map<String,Object>> removeRepetitiveList(List<Map<String, Object>> resultList) {
List<Map<String,Object>> newList = new ArrayList<Map<String,Object>>();
for(int i=0; i<resultList.size(); i++){
Map<String,Object> oldMap = resultList.get(i);
if(newList.size()>0){
boolean isContain = false;
for(int j=0; j<newList.size();j++){
Map<String,Object> newMap = newList.get(j);
if(newMap.get("ASJBH").equals(oldMap.get("ASJBH"))){
for(String key :oldMap.keySet()){
newMap.put(key, oldMap.get(key));
}
isContain = true;
break;
}
}
if(!isContain){
newList.add(oldMap);
}
}else{
newList.add(oldMap);
}
}
return newList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment