Commit 8c66e037 by 刘亚鑫

新增虚实身份接口

parent 86c7626d
package com.founder.commonutils.peopleEntity;
import java.util.List;
public class PeopleInfo {
private String objectType;/*01:车牌号码 03:证件号码 04:手机号码 05:IMSI 06:QQ 07:微信 08:IMEI*/
private String objectValue;
private List<PeopleInfo> children;
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public String getObjectValue() {
return objectValue;
}
public void setObjectValue(String objectValue) {
this.objectValue = objectValue;
}
public List<PeopleInfo> getChildren() {
return children;
}
public void setChildren(List<PeopleInfo> children) {
this.children = children;
}
}
package com.founder.peopleapi.controller;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.peopleapi.service.PeopleService;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 技侦接口管理 前端控制器
* </p>
*
* @author liuyaxin
* @since 2021-04-21
*/
@Api(description = "接口管理")
@RestController
@RequestMapping("/people")
public class PeopleContoller {
@Autowired
private PeopleService peopleService;
@ApiOperation(value = "虚实身份信息")
@OperLog(message = "虚实身份信息", operation = OperationType.QUERY)
@PostMapping("/getXsSfXx")
public MapRestResult getXsSfXx(@ApiParam(name = "objectValue", value = "标识号值", required = true)
@RequestParam String objectValue,
@ApiParam(name = "objectType", value = "标识号类型", required = true)
@RequestParam String objectType) {
return peopleService.getXsSfXx(objectType, objectValue);
}
}
package com.founder.peopleapi.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PeopleInfoMapper {
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.founder.peopleapi.mapper.PeopleInfoMapper">
</mapper>
package com.founder.peopleapi.service;
import com.founder.commonutils.publicEntity.MapRestResult;
public interface PeopleService {
MapRestResult getXsSfXx(String objectType,String objectValue);
}
package com.founder.peopleapi.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.peopleEntity.PeopleInfo;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.peopleapi.service.PeopleService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@Service
public class PeopleServiceImpl implements PeopleService {
@Autowired
private RestTemplate restTemplate;
/*objectType 01:车牌号 03:证件号 04:手机号 05:IMSI 06:QQ 07:微信 08:IMEI*/
@Override
public MapRestResult getXsSfXx(String objectType, String objectValue) {
List resultList = new ArrayList();
if ("01".equals(objectType)) {
List<PeopleInfo> czList = getCarInfo(objectType, objectValue);
for (PeopleInfo peopleInfo : czList) {
if ("03".equals(peopleInfo.getObjectType())) {
PeopleInfo peopleInfo1 = xsxxByZjhm(peopleInfo.getObjectType(), peopleInfo.getObjectValue());
resultList.add(peopleInfo1);
}
}
} else if ("03".equals(objectType)) {
PeopleInfo peopleInfo = xsxxByZjhm(objectType, objectValue);
resultList.add(peopleInfo);
} else if ("04".equals(objectType)) {
List<PeopleInfo> czList = getSjSmInfo(objectType, objectValue);
for (PeopleInfo peopleInfo : czList) {
if ("03".equals(peopleInfo.getObjectType())) {
PeopleInfo peopleInfo1 = xsxxByZjhm(peopleInfo.getObjectType(), peopleInfo.getObjectValue());
resultList.add(peopleInfo1);
}
}
} else {
return MapRestResult.error("无法查询此标识号类型");
}
return MapRestResult.build(200,"成功获取虚实身份信息!",resultList);
}
/*通过证件号获取各类信息*/
public PeopleInfo xsxxByZjhm(String objectType, String objectValue) {
PeopleInfo peopleInfo = new PeopleInfo();
peopleInfo.setObjectType(objectType);
peopleInfo.setObjectValue(objectValue);
List<PeopleInfo> carInfo = getCarInfo(objectType, objectValue);
List xssfxxList = new ArrayList();
List<PeopleInfo> jzInfo = getSjSmInfo(objectType, objectValue);
for (PeopleInfo peopleInfo1 : jzInfo) {
if ("04".equals(peopleInfo1.getObjectType())) {
List list = getXnXxInfo(peopleInfo1.getObjectType(), peopleInfo1.getObjectValue());
peopleInfo1.setChildren(list);
xssfxxList.add(peopleInfo1);
}
}
List childrenList = new ArrayList();
childrenList.addAll(jzInfo);
childrenList.addAll(carInfo);
peopleInfo.setChildren(childrenList);
return peopleInfo;
}
/*标识号类型bshlx:01车辆;02身份证号;03手机号;04IMEI;05IMSI;06QQ;07微信*/
/*获取车主信息*/
public List getCarInfo(String objectType, String objectValue) {
List childrenList = new ArrayList();
HttpEntity<JSONObject> jsonObject = restTemplate.getForEntity("http://26.3.13.120:8501/common/getQgCarXxByHm?hphm=" + objectValue, JSONObject.class);
if (StringUtils.isNotEmpty(String.valueOf(jsonObject.getBody()))) {
if (jsonObject.getBody().containsKey("data")) {
LinkedHashMap resultJson = (LinkedHashMap) jsonObject.getBody().get("data");//获取返回的数据结果
System.out.println(resultJson.toString());
List<LinkedHashMap> array = (List<LinkedHashMap>) resultJson.get("rows");
for (int i = 0; i < array.size(); i++) {
LinkedHashMap object = array.get(i);
String zjhm = (String) object.get("sfzh");
String cphm = (String) object.get("hphm");
PeopleInfo peopleInfo = new PeopleInfo();
if ("01".equals(objectType)) {
peopleInfo.setObjectType("03");
peopleInfo.setObjectValue(zjhm);
childrenList.add(peopleInfo);
} else if ("03".equals(objectType)) {
peopleInfo.setObjectType("01");
peopleInfo.setObjectValue(cphm);
childrenList.add(peopleInfo);
}
}
}
}
return childrenList;
}
/*手机实名*/
public List getSjSmInfo(String objectType, String objectValue) {
List childrenList = new ArrayList();
String url = null;
if ("03".equals(objectType)) {
url = "http://26.3.13.120:8501/nmsj/getMySfSjGl?zjhm=" + objectValue;
} else if ("04".equals(objectType)) {
url = "http://26.3.13.120:8501/nmsj/getMySfSjGl?sjhm=" + objectValue;
}
HttpEntity<JSONObject> jsonObject = restTemplate.getForEntity(url, JSONObject.class);
if (StringUtils.isNotEmpty(String.valueOf(jsonObject.getBody()))) {
if (jsonObject.getBody().containsKey("data")) {
LinkedHashMap resultJson = (LinkedHashMap) jsonObject.getBody().get("data");//获取返回的数据结果
List<LinkedHashMap> array = (List<LinkedHashMap>) resultJson.get("rows");
System.out.println(array.toString());
for (int i = 0; i < array.size(); i++) {
LinkedHashMap object = array.get(i);
String zjhm = (String) object.get("zjhm");
String bshxx = (String) object.get("bshxx");
String bshlx = (String) object.get("bshlx");
PeopleInfo peopleInfo = new PeopleInfo();
if ("03".equals(objectType)) {/*该03为证件号码*/
if ("03".equals(bshlx)) {/*此03为手机号码*/
peopleInfo.setObjectType("04");
peopleInfo.setObjectValue(bshxx);
childrenList.add(peopleInfo);
}
} else if ("04".equals(objectType)) {/*此04为手机号码*/
peopleInfo.setObjectType("03");
peopleInfo.setObjectValue(zjhm);
childrenList.add(peopleInfo);
}
}
}
}
return childrenList;
}
/*手机虚拟信息*/
public List getXnXxInfo(String objectType, String objectValue) {
/*手机信息目录*/
List childrenList = new ArrayList();
HttpEntity<JSONObject> jsonObject = restTemplate.getForEntity("http://26.3.13.120:8501/nmsj/getMyWxQqZcXxFw?xnhm=" + objectValue, JSONObject.class);
if (StringUtils.isNotEmpty(String.valueOf(jsonObject.getBody()))) {
if (jsonObject.getBody().containsKey("data")) {
LinkedHashMap resultJson = (LinkedHashMap) jsonObject.getBody().get("data");//获取返回的数据结果
List<LinkedHashMap> array = (List<LinkedHashMap>) resultJson.get("rows");
for (int i = 0; i < array.size(); i++) {
LinkedHashMap object = array.get(i);
String bshxx = (String) object.get("bshxx");
String bshlx = (String) object.get("bshlx");
PeopleInfo peopleInfo1 = new PeopleInfo();
if ("06".equals(bshlx)) {
peopleInfo1.setObjectType("06");
peopleInfo1.setObjectValue(bshxx);
childrenList.add(peopleInfo1);
} else if ("07".equals(bshlx)) {
peopleInfo1.setObjectType("07");
peopleInfo1.setObjectValue(bshxx);
childrenList.add(peopleInfo1);
}
}
}
}
HttpEntity<JSONObject> jsonObject2 = restTemplate.getForEntity("http://26.3.13.120:8501/nmsj/getMySjSmBsh?sjhm=" + objectValue, JSONObject.class);
if (StringUtils.isNotEmpty(String.valueOf(jsonObject2.getBody()))) {
if (jsonObject2.getBody().containsKey("data")) {
LinkedHashMap resultJson = (LinkedHashMap) jsonObject2.getBody().get("data");//获取返回的数据结果
List<LinkedHashMap> array = (List<LinkedHashMap>) resultJson.get("rows");
System.out.println(array);
for (int i = 0; i < array.size(); i++) {
LinkedHashMap object = array.get(i);
String bshxx = (String) object.get("bshxx");
String bshlx = (String) object.get("bshlx");
PeopleInfo peopleInfo1 = new PeopleInfo();
if ("04".equals(bshlx)) {
peopleInfo1.setObjectType("08");
peopleInfo1.setObjectValue(bshxx);
childrenList.add(peopleInfo1);
} else if ("05".equals(bshlx)) {
peopleInfo1.setObjectType("05");
peopleInfo1.setObjectValue(bshxx);
childrenList.add(peopleInfo1);
}
}
}
}
return childrenList;
}
}
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