新增脑图虚拟身份查询接口

parent a7db0b57
......@@ -27,6 +27,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......@@ -842,6 +843,96 @@ public class DataController {
}
return jsonObejct;
}
@RequestMapping(value = "/queryXnsfxx")
@ResponseBody
public JSONObject queryXnsfxx(String objectValue, String type,String caseId, String caseName){
List<String> sjhmTypes = Arrays.asList("20","4394","3996","6003"); //手机号码类别
List<String> memsTypes = Arrays.asList("4314","4315"); //4315:IMEI;4314:IMSI
List<String> qqWeTypes = Arrays.asList("558","4615"); //558:qq;4615:微信ID
List<String> cyzjTypes = Arrays.asList("1");
JSONObject jsonObejct = new JSONObject();
JSONObject jsonObj = new JSONObject();
List<Relation> relationList = new ArrayList<>();
List<Relation> qqweList = new ArrayList<>();
try {
if(type.equals("sfzh")){
String sfzhResult = pushWaDataService.pushRelations(caseId,caseName,"",objectValue);
if(null != sfzhResult &&sfzhResult.startsWith("{")){
jsonObj = JSONObject.parseObject(sfzhResult);
}
if(jsonObj != null){
String dataList = jsonObj.getString("data");
JSONArray childrens = JSONObject.parseArray(dataList);
if(childrens != null && childrens.size() > 0){
for (int i = 0; i < childrens.size();i++){
JSONObject children = childrens.getJSONObject(i);
if (sjhmTypes.contains(children.getString("relativeType")) && cyzjTypes.contains(children.getString("objectFromType"))){ //关系
relationList.add(getRelationModel(children));
}
}
relationList = removeJSonObject(relationList);
}
}
}else if(type.equals("sjhm")) {
String sjhmResult = pushWaDataService.pushRelations(caseId, caseName, "", objectValue);
if (null != sjhmResult && sjhmResult.startsWith("{")) {
jsonObj = JSONObject.parseObject(sjhmResult);
}
if (jsonObj != null) {
String dataList = jsonObj.getString("data");
JSONArray childrens = JSONObject.parseArray(dataList);
if (childrens != null && childrens.size() > 0) {
for (int i = 0; i < childrens.size(); i++) {
JSONObject children = childrens.getJSONObject(i);
if (memsTypes.contains(children.getString("objectToType"))) {
relationList.add(getRelationModel(children));
}
}
relationList = removeJSonObject(relationList);
//根据imsi查询qq和微信ID
for(int j=0;j<relationList.size();j++){
Relation re = relationList.get(j);
if("4314".contains(re.getObjecttotype())){
JSONObject jobj = new JSONObject();
String qqweResult = pushWaDataService.pushRelations(caseId, caseName, "", re.getObjecttovalue());
if(qqweResult!=null && qqweResult.startsWith("{")){
jobj = JSONObject.parseObject(qqweResult);
}
if(jobj != null ){
String qqweDataList = jobj.getString("data");
JSONArray qqweChildrens = JSONObject.parseArray(qqweDataList);
if (qqweChildrens != null && qqweChildrens.size() > 0) {
for (int i = 0; i < qqweChildrens.size(); i++) {
JSONObject child = qqweChildrens.getJSONObject(i);
if (qqWeTypes.contains(child.getString("objectToType"))) {
qqweList.add(getRelationModel(child));
}
}
}
}
}
}
//qq和微信ID去重
qqweList = removeJSonObject(qqweList);
relationList.addAll(qqweList);
}
}
}
if(!relationList.isEmpty() && relationList != null){
jsonObejct.put("code", ResultEnum.SUCCESS.getCode());
jsonObejct.put("message",ResultEnum.SUCCESS.getMessage());
}else {
jsonObejct.put("code", ResultEnum.SUCCESS.getCode());
jsonObejct.put("message","无数据");
}
jsonObejct.put("dataList",relationList);
}catch (Exception e){
e.printStackTrace();
jsonObejct.put("code", ResultEnum.RESULT_ERROR.getCode());
jsonObejct.put("message",ResultEnum.RESULT_ERROR.getMessage());
}
return jsonObejct;
}
/**
* 提取手机号码的关联信息
......@@ -855,6 +946,33 @@ public class DataController {
}
return null;
}
private Relation getRelationModel(JSONObject jsonObject){
Relation relation = new Relation();
relation.setObjecttotype(jsonObject.getString("objectToType"));
relation.setObjecttotypename(jsonObject.getString("objectToTypeName"));
relation.setObjecttovalue(jsonObject.getString("objectToValue"));
relation.setObjectfromtype(jsonObject.getString("objectFromType"));
relation.setObjectfromvalue(jsonObject.getString("objectFromValue"));
relation.setObjectfromtypename(jsonObject.getString("objectFromTypeName"));
relation.setRelativetype(jsonObject.getString("relativeType"));
relation.setRelativetypename(jsonObject.getString("relativeTypeName"));
relation.setFirst_timestamp(getDate(jsonObject.getString("first_timestamp")));
return relation;
}
private String getDate(String sjc){
if(sjc != null){
Date date = new Date();
if( sjc.length() == 10){
date.setTime(Long.parseLong(sjc)*1000);
}else if(sjc.length() == 13){
date.setTime(Long.parseLong(sjc));
}
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
return dateStr;
}
return "";
}
@Async
public List<Relation> removeJSonObject(List<Relation> jsonObjects){
......
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