Commit 21ac0eb4 by lilei

修改根据标识号查询全国案件的接口

parent fd3a3fa3
package org.springblade.founder.asj.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 案件基本信息
*
* @author szLi
* @date 2022/4/13
*/
@Data
@ApiModel(value="案事件基本信息")
public class AsjResult {
@ApiModelProperty(value = "案件编号")
private String asjbh;
@ApiModelProperty(value = "案件名称")
private String ajmc;
@ApiModelProperty(value = "案件类别代码")
private String ajlbdm;
private String ajlbdmStr;
@ApiModelProperty(value = "小案类别")
private String zatzJyqk;
private String zatzJyqkStr;
@ApiModelProperty(value = "细案类别")
private String ajxlb;
private String ajxlbStr;
@ApiModelProperty(value = "简要案情")
private String jyaq;
@ApiModelProperty(value = "案发时间")
private String afsj;
@ApiModelProperty(value = "案发时间开始时间")
private String afsjKssj;
@ApiModelProperty(value = "案发时间结束时间")
private String afsjJssj;
@ApiModelProperty(value = "案发地区划")
private String afdXzqhdm;
private String afdXzqhdmStr;
@ApiModelProperty(value = "案发地区划省份:分组使用")
private String afdXzqhdmSf;
private String afdXzqhdmSfStr;
@ApiModelProperty(value = "案发地区划地市:分组使用")
private String afdXzqhdmDs;
private String afdXzqhdmDsStr;
@ApiModelProperty(value = "案发地地址名称")
private String afddDzmc;
@ApiModelProperty(value = "案发地详址")
private String afdDzmc;
@ApiModelProperty(value = "案发地地域类别")
private String afdDylbdm;
private String afdDylbdmStr;
@ApiModelProperty(value = "立案单位")
private String ladwdm;
private String ladwdmStr;
@ApiModelProperty(value = "立案日期")
private String larq;
@ApiModelProperty(value = "受理时间")
private String slsj;
@ApiModelProperty(value = "侦查阶段")
private String zcjddm;
private String zcjddmStr;
@ApiModelProperty(value = "接警编号")
private String jjbh;
@ApiModelProperty(value = "现场勘验编号")
private String xckybh;
@ApiModelProperty(value = "侦查终结时间")
private String zczjsj;
@ApiModelProperty(value = "侦查终结单位代码")
private String zczjDwdm;
private String zczjDwdmStr;
@ApiModelProperty(value = "协办人")
private String xbrXm;
private String xbrZjhm;
private String xbrLxdh;
@ApiModelProperty(value = "主办人")
private String zbrXm;
private String zbrZjhm;
private String zbrLxdh;
private String zbdwdm;
private String zbdwdmStr;
@ApiModelProperty(value = "损失价值(人民币元)")
private String ssjzrmby;
@ApiModelProperty(value = "案事件发生地点_经度")
private String afdDqjd;
@ApiModelProperty(value = "案事件发生地点_纬度")
private String afdDqwd;
@ApiModelProperty(value = "现勘经度")
private String xkJd;
@ApiModelProperty(value = "现勘纬度")
private String xkWd;
@ApiModelProperty(value = "警情经度")
private String jqJd;
@ApiModelProperty(value = "警情纬度")
private String jqWd;
@ApiModelProperty(value = "校验经度")
private String jyJd;
@ApiModelProperty(value = "校验纬度")
private String jyWd;
@ApiModelProperty(value = "到案状态")
private String xyrDaztdmStr;
@ApiModelProperty(value = "抓获日期")
private String zhrq;
@ApiModelProperty(value = "抓获单位")
private String zhdwdmStr;
@ApiModelProperty(value = "查询号码")
private String source;
@ApiModelProperty(value = "案件分类 2-电诈;3-传统盗抢骗;4-其他")
private String ajfl;
@ApiModelProperty(value = "破案状态,0-未破;1-已破")
private String pazt;
@ApiModelProperty(value = "现场照片数量")
private int xctpCount;
@ApiModelProperty(value = "信息登记时间")
private String djsj;
@ApiModelProperty(value = "信息登记人员_姓名")
private String xxdjryXm;
@ApiModelProperty(value = "信息操作单位_公安机关机构代码")
private String xxdjdwGajgjgdm;
private String xxdjdwGajgjgdmStr;
}
...@@ -10,7 +10,11 @@ import org.apache.http.entity.StringEntity; ...@@ -10,7 +10,11 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springblade.founder.asj.entity.AsjResult;
import org.springblade.founder.asj.entity.TbXszCbypQgaj; import org.springblade.founder.asj.entity.TbXszCbypQgaj;
import org.springblade.founder.utils.HttpUtils;
import org.springblade.founder.utils.QgryHjUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -18,114 +22,97 @@ import java.util.ArrayList; ...@@ -18,114 +22,97 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service @Service
public class QgAsjQueryService { public class QgAsjQueryService {
@Value("${ssdw}") @Value("${ssdw}")
private String ssdw; private String ssdw;
@Value("${grade}") @Value("${QGAsjApiUrl}")
private String grade; private String QGAsjApiUrl;
@Value("${zhyyPath}")
private String zhyyPath;
public List<TbXszCbypQgaj> getQgAsjByBsh(String bsh) { public List<TbXszCbypQgaj> getQgAsjByBsh(String bsh) {
List tbStAsjQGList = null; List<AsjResult> qgajList = getSaxxQg("jyaq", bsh, "0");
try { ArrayList<TbXszCbypQgaj> resultList = new ArrayList<>();
String os = "['{\"JYAQ\":\"%" + bsh + "%\",\"XXSC_PDBZ\":\"0\"}']"; for (AsjResult asjResult : qgajList) {
Map<Object, Object> param = new HashMap<>(); TbXszCbypQgaj qgaj = new TbXszCbypQgaj();
param.put("zylx", "asj"); BeanUtils.copyProperties(asjResult, qgaj);
param.put("os", os); qgaj.setAsjfsddXzqhdm(asjResult.getAfdXzqhdm());
String url = zhyyPath + "/getGabZyInfoByJyaqMatj.action"; qgaj.setXzqhdmSj(asjResult.getAsjbh().substring(1, 3) + "0000");
//Map map=restTemplate.postForObject(url,param,Map.class); qgaj.setLadwGajgjgdm(asjResult.getLadwdm());
//dataResult=(List)map.get("dataResult"); qgaj.setLadwGajgMc(asjResult.getLadwdmStr());
//http链接工具 resultList.add(qgaj);
CloseableHttpClient httpClient = HttpClients.createDefault(); }
return resultList;
}
HttpPost httpPost = new HttpPost(url); public List<AsjResult> getSaxxQg(String type,String gjc,String qsajPdbz) {
StringEntity entity = new StringEntity(JSONArray.toJSONString(param)); JSONObject object = new JSONObject();
entity.setContentType("application/json");//发送json数据需要设置contentType object.put("type",type);
entity.setContentEncoding("utf-8"); object.put("gjc",gjc);
httpPost.setEntity(entity); object.put("page",1);
object.put("limit",1000);
Map<String, String> headers = new HashMap<>();
List<AsjResult> list=new ArrayList<>();
String resultToken = "";
try {
headers.put("Content-Type", "application/json");
resultToken = HttpUtils.doPostJson(QGAsjApiUrl+"/qgAsjRy/getAsjListByGjc", headers, object.toJSONString());
CloseableHttpResponse response = httpClient.execute(httpPost); if (StringUtils.isNotEmpty(resultToken)) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { //解析数据
String jsonResult = EntityUtils.toString(response.getEntity(), "utf-8"); JSONObject obj = JSONObject.parseObject(resultToken);
System.out.println("请求部级接口返回数据======" + jsonResult); int status = obj.getIntValue("status");
if (null != jsonResult && !"".equals(jsonResult) && !"null".equals(jsonResult)) { if(200!=status){
JSONObject jsonObject = JSONObject.parseObject(jsonResult); return list;
if (jsonObject.containsKey("dataResult")) {
tbStAsjQGList = (List) jsonObject.get("dataResult");
}
} }
} String data = obj.getString("data");
JSONObject objdata = JSONObject.parseObject(data);
List<TbXszCbypQgaj> tbXszCbypQgajList = new ArrayList<>(); int total = (int) objdata.get("total");
if (tbStAsjQGList != null && tbStAsjQGList.size() > 0) { if (total > 0) {
for (Object date : tbStAsjQGList) { JSONArray array = objdata.getJSONArray("rows");
TbXszCbypQgaj tbXszCbypQgaj = new TbXszCbypQgaj(); if (array.size() > 0) {
Map<String, String> map = (Map) date; for (Object objectp : array) {
for (String key : map.keySet()) { JSONObject jsonObj = (JSONObject) objectp;
if ("ASJBH".equals(key)) { AsjResult asjxx = JSONObject.toJavaObject(jsonObj,AsjResult.class);
tbXszCbypQgaj.setAsjbh(map.get("ASJBH")); String asjbh = asjxx.getAsjbh();
// 截取案件编号前两位省级 if(asjbh != null){
tbXszCbypQgaj.setXzqhdmSj(map.get("ASJBH").substring(1, 3) + "0000"); if(!"1".equals(qsajPdbz)){//0-不含本省案件
} else if ("AJMC".equals(key)) { if(asjbh.startsWith("A"+ssdw.substring(0,2))){
tbXszCbypQgaj.setAjmc(map.get("AJMC")); continue;
} else if ("AJLBDM".equals(key)) { }
tbXszCbypQgaj.setAjlbdm(map.get("AJLBDM")); }
} else if ("ZCJDDM".equals(key)) { //破案状态处理
tbXszCbypQgaj.setZcjddm(map.get("ZCJDDM")); String zcjddm = asjxx.getZcjddm();
} else if ("ASJFSSJ_ASJFSKSSJ".equals(key)) { if("0600".equals(zcjddm) || "0700".equals(zcjddm) || "0800".equals(zcjddm)){
String asjfssjAsjfskssj = map.get("ASJFSSJ_ASJFSKSSJ"); asjxx.setPazt("1");
// 是否为空 }else {
if (null != asjfssjAsjfskssj && !"".equals(asjfssjAsjfskssj)) { asjxx.setPazt("0");
// 年月日 时分秒中间有多个空格
String[] arr = asjfssjAsjfskssj.split("\\s+");
// 有时分秒
if (arr.length > 1) {
String a = arr[1].substring(0, 8);
String lastTime = arr[0] + " " + a;
tbXszCbypQgaj.setAsjfssjKssj(lastTime);
} }
// 只有年月日 //案发地省份处理
else { String afdqh = asjxx.getAfdXzqhdm();
tbXszCbypQgaj.setAsjfssjKssj(asjfssjAsjfskssj); String afdqhSf="";
String afdqhSfStr="";
if(StringUtils.isNotEmpty(afdqh)){
afdqhSf = afdqh.substring(0,2);
}else {
afdqhSf="00";
afdqhSfStr="空";
} }
asjxx.setAfdXzqhdmSf(afdqhSf);
asjxx.setAfdXzqhdmSfStr(afdqhSfStr);
asjxx.setSource(gjc);
list.add(asjxx);
} }
} else if ("ASJFSDD_XZQHDM".equals(key)) {// 行政区划地址为空时(先截取案件编号除去(A)前六位(区级)查询案发地)
// 不为空
tbXszCbypQgaj.setAsjfsddXzqhdm(map.get("ASJFSDD_XZQHDM"));
} else if ("JYAQ".equals(key)) {
tbXszCbypQgaj.setJyaq(map.get("JYAQ"));
} else if ("LADW_GAJGJGDM".equals(key)) {
tbXszCbypQgaj.setLadwGajgjgdm(map.get("LADW_GAJGJGDM"));
} else if ("LADW_GAJGMC".equals(key)) {
tbXszCbypQgaj.setLadwGajgMc(map.get("LADW_GAJGMC"));
}
}
String asjbh = tbXszCbypQgaj.getAsjbh();
// grade 级别为1的拿外省 2的拿本市外的
if ("1".equals(grade)) {
//去除本省的案件信息
String tempSsdw = ssdw.substring(0, 2);
if (StringUtils.isNotEmpty(asjbh) && !asjbh.substring(1, 3).equals(tempSsdw)) {//外省
tbXszCbypQgajList.add(tbXszCbypQgaj);
}
} else {
//去除本市的案件信息
String tempSsdw = ssdw.substring(0, 4);
if (StringUtils.isNotEmpty(asjbh) && !asjbh.substring(1, 5).equals(tempSsdw)) {//去除本市
tbXszCbypQgajList.add(tbXszCbypQgaj);
} }
} }
} }
} }
return tbXszCbypQgajList; }catch (Exception e){
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
System.out.println(e.getMessage());
} }
return null; return list;
} }
} }
package org.springblade.founder.utils; package org.springblade.founder.utils;
import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.founder.asj.entity.AsjResult;
import org.springblade.founder.asj.entity.TbXszCbypQgaj;
import org.springblade.modules.system.entity.XzxtUser; import org.springblade.modules.system.entity.XzxtUser;
import org.springframework.beans.BeanUtils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
...@@ -25,7 +28,7 @@ public class QgryHjUtils { ...@@ -25,7 +28,7 @@ public class QgryHjUtils {
con.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); con.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
con.setRequestProperty("x-qqfw-senderid","C00-20000627");//请求方编号 con.setRequestProperty("x-qqfw-senderid","C00-20000627");//请求方编号
con.setRequestProperty("x-qqfw-serviceid", "S10-00000298");//服务方编号 con.setRequestProperty("x-qqfw-serviceid", "S10-00000298");//服务方编号
con.setRequestProperty("x-qqfw-timeout", "70");//单位秒,超时后返回task_id 后续获取结果0 :立即返回 -1:系统最大值 con.setRequestProperty("x-qqfw-timeout", "10");//单位秒,超时后返回task_id 后续获取结果0 :立即返回 -1:系统最大值
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
System.out.println(df.format(new Date())); System.out.println(df.format(new Date()));
con.setRequestProperty("x-qqfw-qqsj", df.format(new Date()));//请求时间,格式:yyyyMMddHHmmssSSS con.setRequestProperty("x-qqfw-qqsj", df.format(new Date()));//请求时间,格式:yyyyMMddHHmmssSSS
...@@ -111,7 +114,6 @@ public class QgryHjUtils { ...@@ -111,7 +114,6 @@ public class QgryHjUtils {
// public static void main(String args[]){ // public static void main(String args[]){
// QgryHjUtils.queryHj("210203194703112293",false); // QgryHjUtils.queryHj("210203194703112293",false);
//
// } // }
} }
...@@ -8,7 +8,8 @@ import org.dom4j.Element; ...@@ -8,7 +8,8 @@ import org.dom4j.Element;
import org.springblade.founder.entity.QgckryBean; import org.springblade.founder.entity.QgckryBean;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.List; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/** /**
* @auther: Lilei * @auther: Lilei
...@@ -60,27 +61,37 @@ public class QgryckUtils { ...@@ -60,27 +61,37 @@ public class QgryckUtils {
public QgckryBean getRyhj(String zjhm,boolean ifLogin){ public QgckryBean getRyhj(String zjhm,boolean ifLogin){
QgckryBean ryxx=new QgckryBean(); QgckryBean ryxx=new QgckryBean();
String hj = QgryHjUtils.queryHj(zjhm, ifLogin); String hj = "";
for (int i = 0; i < 3 ;i++) {
if (StringUtils.isEmpty(hj)) {
hj = QgryHjUtils.queryHj(zjhm, ifLogin);
}
}
if (StringUtils.isNotEmpty(hj)) { if (StringUtils.isNotEmpty(hj)) {
JSONObject jsonObject = JSONObject.parseObject(hj); JSONObject jsonObject = JSONObject.parseObject(hj);
JSONObject appBody = jsonObject.getJSONObject("app_body"); JSONObject appBody = jsonObject.getJSONObject("app_body");
JSONArray jsonArray = appBody.getJSONArray("QueryReturn"); JSONArray jsonArray = appBody.getJSONArray("QueryReturn");
JSONArray rycsJson = JSONObject.parseArray(jsonArray.get(1).toString());
JSONArray ryJson = JSONObject.parseArray(jsonArray.get(2).toString()); JSONArray ryJson = JSONObject.parseArray(jsonArray.get(2).toString());
ryxx.setXm(objectToStr(ryJson.get(5))); HashMap<String, String> map = new HashMap<>();
ryxx.setJgssx(objectToStr(ryJson.get(0))); for (int i = 0;i < rycsJson.size(); i++){
ryxx.setWhcd(objectToStr(ryJson.get(18))); map.put(objectToStr(rycsJson.get(i)),objectToStr(ryJson.get(i)));
ryxx.setCym(objectToStr(ryJson.get(16))); }
ryxx.setXp(objectToStr(ryJson.get(17))); ryxx.setXm(map.get("XM"));
ryxx.setHyzk(objectToStr(ryJson.get(13))); ryxx.setJgssx(map.get("JGSSX"));
ryxx.setByqk(objectToStr(ryJson.get(1))); ryxx.setWhcd(map.get("WHCD"));
ryxx.setSfzh(objectToStr(ryJson.get(9))); ryxx.setCym(map.get("CYM"));
ryxx.setMz(objectToStr(ryJson.get(10))); ryxx.setXp(map.get("XP"));
ryxx.setXb(objectToStr(ryJson.get(6))); ryxx.setHyzk(map.get("HYZK"));
ryxx.setHkszd(objectToStr(ryJson.get(12))); ryxx.setByqk(map.get("BYQK"));
ryxx.setCsdxz(objectToStr(ryJson.get(4))); ryxx.setSfzh(map.get("SFZH"));
ryxx.setCsrq(objectToStr(ryJson.get(15))); ryxx.setMz(map.get("MZ"));
ryxx.setZzxz(objectToStr(ryJson.get(14))); ryxx.setXb(map.get("XB"));
ryxx.setSg(objectToStr(ryJson.get(7))); ryxx.setHkszd(map.get("HKSZD"));
ryxx.setCsdxz(map.get("CSDXZ"));
ryxx.setCsrq(map.get("CSRQ"));
ryxx.setZzxz(map.get("ZZXZ"));
ryxx.setSg(map.get("SG"));
} }
return ryxx; return ryxx;
} }
......
...@@ -126,3 +126,6 @@ qgEs: ...@@ -126,3 +126,6 @@ qgEs:
url: http://74.6.54.172:9061/xxcx/ url: http://74.6.54.172:9061/xxcx/
# url: http://localhost:9022/bjhc/ktsj/ # url: http://localhost:9022/bjhc/ktsj/
authorization: Basic 9b6c45cfcf3a4a629e3ed90fa3e5d058 authorization: Basic 9b6c45cfcf3a4a629e3ed90fa3e5d058
#全国ES案事件API查询地址
QGAsjApiUrl: http://65.26.2.101:1004
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