修改脑图查询接口

parent 3fd69a86
......@@ -719,137 +719,4 @@ public class DataController {
return resultObj;
}
@RequestMapping(value = "/queryJdAndThxxBySfzh")
@ResponseBody
public JSONObject queryJdAndThxxBySfzh(String sfzh,String type,String caseId,String caseName){
List<String> sjhmTypes = Arrays.asList("20","4394","3996","6003"); //手机号码类别
List<String> jdxxTypes = Arrays.asList("6095","6096"); //快递类别
List<String> thgxTypes = Arrays.asList("45878","4103","4396","4088","45936","45935"); //同户关系类别45878:母亲,4103:父亲,4396:母子关系,4088:配偶,45936:母子,45935:父子
JSONObject jsonObejct = new JSONObject();
JSONObject jsonObj = new JSONObject();
List<Relation> relationList = new ArrayList<>();
try {
if(type.equals("thxx")){
String thxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sfzh);
if(null != thxxResult &&thxxResult.startsWith("{")){
jsonObj = JSONObject.parseObject(thxxResult);
}
if(jsonObj != null){
String dataList = jsonObj.getString("data");
JSONObject dataObj = JSONObject.parseObject(dataList);
if(dataObj != null){
JSONArray childrens = dataObj.getJSONArray("data");
if(childrens != null && childrens.size() > 0){
for (int i = 0; i < childrens.size();i++){
JSONObject children = childrens.getJSONObject(i);
if (thgxTypes.contains(children.getString("relativeType"))){ //关系
Relation relation = new Relation();
relation.setObjecttotype(children.getString("objectToType"));
relation.setObjecttotypename(children.getString("objectToTypeName"));
relation.setObjecttovalue(children.getString("objectToValue"));
relation.setObjectfromtype(children.getString("objectFromType"));
relation.setObjectfromvalue(children.getString("objectFromValue"));
relation.setObjectfromtypename(children.getString("objectFromTypeName"));
relation.setRelativetype(children.getString("relativeType"));
relation.setRelativetypename(children.getString("relativeTypeName"));
relationList.add(relation);
}
}
}
relationList = removeJSonObject(relationList);
}
}
}else if(type.equals("jdxx")){
String thxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sfzh);
if(null != thxxResult &&thxxResult.startsWith("{")){
jsonObj = JSONObject.parseObject(thxxResult);
}
if(jsonObj != null){
String dataList = jsonObj.getString("data");
JSONObject dataObj = JSONObject.parseObject(dataList);
if(dataObj != null){
JSONArray childrens = dataObj.getJSONArray("data");
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"))){ //关系
String sjhm = getSjhmsList(children);
JSONObject jsonObject = null;
if(sjhm != null ){
String jdxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sjhm);
if(null != jdxxResult &&jdxxResult.startsWith("{")){
jsonObject = JSONObject.parseObject(jdxxResult);
}
if(jsonObject != null){
String jdxxList = jsonObject.getString("data");
JSONObject jdxxObj = JSONObject.parseObject(jdxxList);
if(jdxxObj != null){
JSONArray jdxxChildrenList = jdxxObj.getJSONArray("data");
if(jdxxChildrenList != null && jdxxChildrenList.size() > 0){
for (int j = 0; j < jdxxChildrenList.size();j++){
JSONObject jdxxChildrens = jdxxChildrenList.getJSONObject(j);
if (jdxxTypes.contains(jdxxChildrens.getString("relativeType"))){ //关系
Relation relation = new Relation();
relation.setObjecttotype(jdxxChildrens.getString("objectToType"));
relation.setObjecttotypename(jdxxChildrens.getString("objectToTypeName"));
relation.setObjecttovalue(jdxxChildrens.getString("objectToValue"));
relation.setObjectfromtype(jdxxChildrens.getString("objectFromType"));
relation.setObjectfromvalue(jdxxChildrens.getString("objectFromValue"));
relation.setObjectfromtypename(jdxxChildrens.getString("objectFromTypeName"));
relation.setRelativetype(jdxxChildrens.getString("relativeType"));
relation.setRelativetypename(jdxxChildrens.getString("relativeTypeName"));
relationList.add(relation);
}
}
}
}
}
}
}
}
}
}
}
}
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;
}
/**
* 提取手机号码的关联信息
* @return
*/
private String getSjhmsList(JSONObject children){
String sjhm = children.getString("objectToValue");
//可能会有7位或者10位的手机号码或者电话号码,但是这儿统一只展示11位的手机号码或者电话号码
if(sjhm.length() == 11 || sjhm.length() == 8 || sjhm.length() == 13){
return sjhm;
}
return null;
}
@Async
public List<Relation> removeJSonObject(List<Relation> jsonObjects){
Set<Relation> set = new TreeSet<Relation>(new Comparator<Relation>() {
@Override
public int compare(Relation o1, Relation o2) {
return o1.getObjecttovalue().compareTo(o2.getObjecttovalue());
}
});
set.addAll(jsonObjects);
return new ArrayList<Relation>(set);
}
}
package com.founder.interservice.controller;
import com.founder.interservice.enums.ResultEnum;
import com.founder.interservice.model.Relation;
import com.founder.interservice.recordLog.service.RecordLogService;
import com.founder.interservice.service.DataService;
import com.founder.interservice.service.IphoneTrackService;
import com.founder.interservice.service.PushWaDataService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* @ClassName: NaotuController
* @Auther: 曹鹏
* @Description: java类作用描述
* @CreateDate: 2018-08-15 13:43
* @Version: 1.0
*/
@Controller
@CrossOrigin
public class NaotuController {
@Autowired
private DataService dataService;
//查询日志记录
@Autowired
private RecordLogService recordLogService;
@Autowired
private IphoneTrackService iphoneTrackService;
@Autowired
private PushWaDataService pushWaDataService;
@Value("${wabigdata.pgis.url}")
private String PGIS_URL;
@Value("${wabigdata.pgis_title.url}")
private String PGIS_TITLE_URL;
@RequestMapping(value = "/queryJdAndThxxBySfzh")
@ResponseBody
public JSONObject queryJdAndThxxBySfzh(String sfzh, String type, String caseId, String caseName){
List<String> sjhmTypes = Arrays.asList("20","4394","3996","6003"); //手机号码类别
List<String> jdxxTypes = Arrays.asList("6095","6096"); //快递类别
List<String> thgxTypes = Arrays.asList("45878","4103","4396","4088","45936","45935"); //同户关系类别45878:母亲,4103:父亲,4396:母子关系,4088:配偶,45936:母子,45935:父子
JSONObject jsonObejct = new JSONObject();
JSONObject jsonObj = new JSONObject();
List<Relation> relationList = new ArrayList<>();
try {
if(type.equals("thxx")){
String thxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sfzh);
if(null != thxxResult &&thxxResult.startsWith("{")){
jsonObj = JSONObject.fromObject(thxxResult);
}
if(jsonObj != null){
String dataList = jsonObj.getString("data");
JSONObject dataObj = JSONObject.fromObject(dataList);
if(dataObj != null){
JSONArray childrens = dataObj.getJSONArray("data");
if(childrens != null && childrens.size() > 0){
for (int i = 0; i < childrens.size();i++){
JSONObject children = childrens.getJSONObject(i);
if (thgxTypes.contains(children.getString("relativeType"))){ //关系
Relation relation = new Relation();
relation.setObjecttotype(children.getString("objectToType"));
relation.setObjecttotypename(children.getString("objectToTypeName"));
relation.setObjecttovalue(children.getString("objectToValue"));
relation.setObjectfromtype(children.getString("objectFromType"));
relation.setObjectfromvalue(children.getString("objectFromValue"));
relation.setObjectfromtypename(children.getString("objectFromTypeName"));
relation.setRelativetype(children.getString("relativeType"));
relation.setRelativetypename(children.getString("relativeTypeName"));
relationList.add(relation);
}
}
}
relationList = removeJSonObject(relationList);
}
}
}else if(type.equals("jdxx")){
String thxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sfzh);
if(null != thxxResult &&thxxResult.startsWith("{")){
jsonObj = JSONObject.fromObject(thxxResult);
}
if(jsonObj != null){
String dataList = jsonObj.getString("data");
JSONObject dataObj = JSONObject.fromObject(dataList);
if(dataObj != null){
JSONArray childrens = dataObj.getJSONArray("data");
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"))){ //关系
String sjhm = getSjhmsList(children);
JSONObject jsonObject = null;
if(sjhm != null ){
String jdxxResult = pushWaDataService.pushRelations(caseId,caseName,caseId,sjhm);
if(null != jdxxResult &&jdxxResult.startsWith("{")){
jsonObject = JSONObject.fromObject(jdxxResult);
}
if(jsonObject != null){
String jdxxList = jsonObject.getString("data");
JSONObject jdxxObj = JSONObject.fromObject(jdxxList);
if(jdxxObj != null){
JSONArray jdxxChildrenList = jdxxObj.getJSONArray("data");
if(jdxxChildrenList != null && jdxxChildrenList.size() > 0){
for (int j = 0; j < jdxxChildrenList.size();j++){
JSONObject jdxxChildrens = jdxxChildrenList.getJSONObject(j);
if (jdxxTypes.contains(jdxxChildrens.getString("relativeType"))){ //关系
Relation relation = new Relation();
relation.setObjecttotype(jdxxChildrens.getString("objectToType"));
relation.setObjecttotypename(jdxxChildrens.getString("objectToTypeName"));
relation.setObjecttovalue(jdxxChildrens.getString("objectToValue"));
relation.setObjectfromtype(jdxxChildrens.getString("objectFromType"));
relation.setObjectfromvalue(jdxxChildrens.getString("objectFromValue"));
relation.setObjectfromtypename(jdxxChildrens.getString("objectFromTypeName"));
relation.setRelativetype(jdxxChildrens.getString("relativeType"));
relation.setRelativetypename(jdxxChildrens.getString("relativeTypeName"));
relationList.add(relation);
}
}
}
}
}
}
}
}
}
}
}
}
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;
}
/**
* 提取手机号码的关联信息
* @return
*/
private String getSjhmsList(JSONObject children){
String sjhm = children.getString("objectToValue");
//可能会有7位或者10位的手机号码或者电话号码,但是这儿统一只展示11位的手机号码或者电话号码
if(sjhm.length() == 11 || sjhm.length() == 8 || sjhm.length() == 13){
return sjhm;
}
return null;
}
@Async
public List<Relation> removeJSonObject(List<Relation> jsonObjects){
Set<Relation> set = new TreeSet<Relation>(new Comparator<Relation>() {
@Override
public int compare(Relation o1, Relation o2) {
return o1.getObjecttovalue().compareTo(o2.getObjecttovalue());
}
});
set.addAll(jsonObjects);
return new ArrayList<Relation>(set);
}
}
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