Commit dada4faa by liulianglang

现场信息对外提供

parent a12e064f
package com.founder.controller;
import com.founder.checkAuthorization.annotation.CheckAuthorization;
import com.founder.checkAuthorization.config.AuthorizationInterceptor;
import com.founder.common.IpADressLock;
import com.founder.common.LogsUtil;
import com.founder.dao.AuthorizationMapper;
import com.founder.model.AsjRyRelateVo;
import com.founder.model.R;
import com.founder.model.TbSpParam;
import com.founder.model.XyrParam;
import com.founder.service.AjFwService;
import com.founder.service.SysGnsyrzOpenApiService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@RestController
@RequestMapping(value="/aj/esQuery",produces = "application/json; charset=utf-8")
@Slf4j
@CheckAuthorization
public class AjFwController {
@Autowired
private AuthorizationMapper authorizationMapper;
@Autowired
private IpADressLock ipADressLock;
@Autowired
private AjFwService ajFwService;
@Autowired
private SysGnsyrzOpenApiService sysGnsyrzOpenApiService;
/**
* 案件信息查询
* @param
* @return
*/
@PostMapping("/esasj")
public R esQuery(HttpServletRequest request, @RequestBody AsjRyRelateVo asjRyRelateVo){
Map<String, String> map = getFwidAndXtmc(request);
try {
Map<String, Object> mapResult = ajFwService.esQuery(request, asjRyRelateVo);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","案件信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"0", map.get("FWID"));
return R.ok().data(mapResult).message("案件信息查询成功");
}catch (Exception e){
log.error("错误日志", e);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","案件信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"1", map.get("FWID"));
return R.error("案件信息查询失败,请联系管理员!");
}
}
/**
* 嫌疑人信息查询
* @param
* @return
*/
@PostMapping("/esxyr")
public R esxyr(HttpServletRequest request, @RequestBody AsjRyRelateVo asjRyRelateVo){
Map<String, String> map = getFwidAndXtmc(request);
try {
Map<String, Object> mapResult = ajFwService.esxyr(request, asjRyRelateVo);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","嫌疑人信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"0", map.get("FWID"));
return R.ok().data(mapResult).message("嫌疑人信息查询成功");
}catch (Exception e){
log.error("错误日志", e);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","嫌疑人信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"1", map.get("FWID"));
return R.error("嫌疑人信息查询失败,请联系管理员!");
}
}
/**
* 受害人信息查询
* @param
* @return
*/
@PostMapping("/esshr")
public R esshr(HttpServletRequest request, @RequestBody AsjRyRelateVo asjRyRelateVo){
Map<String, String> map = getFwidAndXtmc(request);
try {
Map<String, Object> mapResult = ajFwService.esshr(request, asjRyRelateVo);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","受害人信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"0", map.get("FWID"));
return R.ok().data(mapResult).message("受害人信息查询成功");
}catch (Exception e){
log.error("错误日志", e);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","受害人信息查询", LogsUtil.getNotEmptyFiled(asjRyRelateVo).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"1", map.get("FWID"));
return R.error("受害人信息查询失败,请联系管理员!");
}
}
/**
* 现场视频信息查询
* @param
* @return
*/
@PostMapping("/xcsp")
public R xcsp(HttpServletRequest request, @RequestBody TbSpParam tbSpParam){
Map<String, String> map = getFwidAndXtmc(request);
try {
Map<String, Object> mapResult = ajFwService.xcsp(request, tbSpParam);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","现场视频信息查询", LogsUtil.getNotEmptyFiled(tbSpParam).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"0", map.get("FWID"));
return R.ok().data(mapResult).message("现场视频信息查询成功");
}catch (Exception e){
log.error("错误日志", e);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","现场视频信息查询", LogsUtil.getNotEmptyFiled(tbSpParam).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"1", map.get("FWID"));
return R.error("现场视频信息查询失败,请联系管理员!");
}
}
/**
* 现场照片信息查询
* @param
* @return
*/
@PostMapping("/xczp")
public R xczp(HttpServletRequest request, @RequestBody TbSpParam tbSpParam){
Map<String, String> map = getFwidAndXtmc(request);
try {
Map<String, Object> mapResult = ajFwService.xczp(request, tbSpParam);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","现场照片信息查询", LogsUtil.getNotEmptyFiled(tbSpParam).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"0", map.get("FWID"));
return R.ok().data(mapResult).message("现场照片信息查询成功");
}catch (Exception e){
log.error("错误日志", e);
sysGnsyrzOpenApiService.insertGNSYRZOPENAPI("01","现场照片信息查询", LogsUtil.getNotEmptyFiled(tbSpParam).toString(),
"","","430000000000",map.get("XTMC"),"", ipADressLock.getAddressIp(request),"1", map.get("FWID"));
return R.error("现场照片信息查询失败,请联系管理员!");
}
}
private Map<String, String> getFwidAndXtmc(HttpServletRequest request) {
String appId = request.getHeader(AuthorizationInterceptor.appId);
String appSecret = request.getHeader(AuthorizationInterceptor.appSecret);
return authorizationMapper.getFwidAndXtmc(appId, appSecret);
}
}
package com.founder.dao;
import com.founder.model.TbSpParam;
import com.founder.model.TbSpVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface AjFwMapper {
List<TbSpVo> queryXkSpList(TbSpParam tbSpVo);
int queryXkSpListCount(TbSpParam tbSpVo);
List<TbSpVo> queryXkSpZpList(TbSpParam tbSpVo);
int queryXkSpZpListCount(TbSpParam tbSpVo);
}
package com.founder.model;
import lombok.Data;
import lombok.ToString;
@Data
public class AsjRyRelateVo {
/**
* 案事件编号
*/
private String asjbh;
/**
* 接警编号
*/
private String jjbh;
private String asjfsddDzmc;
private String asjfssjAsjfskssjStart;
private String asjfssjAsjfskssjEnd;
private String zhfzxyrXm;
private String zhfzxyrXzzDzmc;
;
private String zhfzxyrCyzjZjhm;
private String xyrAsjbh;
private String zhfzxyrLxdh;
private String bhrXm;
private String bhrCyzjZjhm;
private String bhrXzzDzmc;
private String shrAsjbh;
private String bhrLxdh;
}
package com.founder.model;
import lombok.Data;
@Data
public class TbSpParam {
private String asjbh;
private String jjbh;
private String ajmc;
private String ajlbdm;
private String asjfsddDzmc;
private String xckybh;
private String fakssj;
private String fajssj;
private int page;
private int limit;
}
package com.founder.model;
import lombok.Data;
@Data
public class TbSpVo {
//现场勘验编号
private String xckybh;
//案事件编号
private String asjbh;
private String createtime;
private String imgUrl;
private String imgName;
}
package com.founder.service;
import com.founder.model.AsjRyRelateVo;
import com.founder.model.TbSpParam;
import com.founder.model.XyrParam;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
public interface AjFwService {
Map<String, Object> esQuery(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception;
Map<String, Object> esxyr(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception;
Map<String, Object> esshr(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception;
Map<String, Object> xcsp(HttpServletRequest request, TbSpParam tbSpParam) throws Exception;
Map<String, Object> xczp(HttpServletRequest request, TbSpParam tbSpParam) throws Exception;
}
package com.founder.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.founder.dao.AjFwMapper;
import com.founder.model.AsjRyRelateVo;
import com.founder.model.TbSpParam;
import com.founder.model.TbSpVo;
import com.founder.service.AjFwService;
import com.founder.util.HttpClient;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AjFwServiceImpl implements AjFwService {
@Autowired
private AjFwMapper ajFwMapper;
@Override
public Map<String, Object> esQuery(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception {
Map<String, Object> resultMap = new HashMap<>(); //返回值
Map<String, String> header = initHttpXmlHeads();
String resultToken = "";
resultToken = HttpClient.doPostJson("http://10.142.16.91:7777/esQuery/EsAsj", header, JSON.toJSONString(asjRyRelateVo));
System.out.println(resultToken);
if (StringUtils.isNotEmpty(resultToken)) {
//解析数据
JSONObject obj = JSONObject.parseObject(resultToken.replaceAll("null", "\"\""));
String data = obj.getString("data");
String code = obj.getString("code");
if("20000".equals(code)){
Map mapTypes = JSON.parseObject(data);
System.out.println("这个是用JSON类的parseObject来解析JSON字符串!!!");
return mapTypes;
}else {
throw new Exception("查询接口异常");
}
}
return null;
}
@Override
public Map<String, Object> esxyr(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception {
Map<String, Object> resultMap = new HashMap<>(); //返回值
Map<String, String> header = initHttpXmlHeads();
String resultToken = "";
resultToken = HttpClient.doPostJson("http://10.142.16.91:7777/esQuery/EsXyr", header, JSON.toJSONString(asjRyRelateVo));
System.out.println(resultToken);
if (StringUtils.isNotEmpty(resultToken)) {
//解析数据
JSONObject obj = JSONObject.parseObject(resultToken.replaceAll("null", "\"\""));
String data = obj.getString("data");
String code = obj.getString("code");
if("20000".equals(code)){
Map mapTypes = JSON.parseObject(data);
System.out.println("这个是用JSON类的parseObject来解析JSON字符串!!!");
return mapTypes;
}else {
throw new Exception("查询接口异常");
}
}
return null;
}
@Override
public Map<String, Object> esshr(HttpServletRequest request, AsjRyRelateVo asjRyRelateVo) throws Exception {
Map<String, Object> resultMap = new HashMap<>(); //返回值
Map<String, String> header = initHttpXmlHeads();
String resultToken = "";
resultToken = HttpClient.doPostJson("http://10.142.16.91:7777/esQuery/EsShr", header, JSON.toJSONString(asjRyRelateVo));
System.out.println(resultToken);
if (StringUtils.isNotEmpty(resultToken)) {
//解析数据
JSONObject obj = JSONObject.parseObject(resultToken.replaceAll("null", "\"\""));
String data = obj.getString("data");
String code = obj.getString("code");
if("20000".equals(code)){
Map mapTypes = JSON.parseObject(data);
System.out.println("这个是用JSON类的parseObject来解析JSON字符串!!!");
return mapTypes;
}else {
throw new Exception("查询接口异常");
}
}
return null;
}
@Override
public Map<String, Object> xcsp(HttpServletRequest request, TbSpParam tbSpParam) throws Exception {
Map<String, Object> rtMap = new HashMap<>();
List<TbSpVo> listResult=new ArrayList<>();
rtMap.put("rows",new ArrayList<>());
rtMap.put("total",0);
long total=0;
tbSpParam.setPage(0);
tbSpParam.setLimit(500);
listResult= ajFwMapper.queryXkSpList(tbSpParam);
total= ajFwMapper.queryXkSpListCount(tbSpParam);
rtMap.put("total",total);
rtMap.put("rows",listResult);
return rtMap;
}
@Override
public Map<String, Object> xczp(HttpServletRequest request, TbSpParam tbSpParam) throws Exception {
Map<String, Object> rtMap = new HashMap<>();
List<TbSpVo> listResult=new ArrayList<>();
rtMap.put("rows",new ArrayList<>());
rtMap.put("total",0);
long total=0;
tbSpParam.setPage(0);
tbSpParam.setLimit(500);
listResult= ajFwMapper.queryXkSpZpList(tbSpParam);
total= ajFwMapper.queryXkSpZpListCount(tbSpParam);
rtMap.put("total",total);
rtMap.put("rows",listResult);
return rtMap;
}
private HashMap<String, String> initHttpXmlHeads() {
HashMap<String, String> headParams = new HashMap<String, String>();
headParams.put("Content-Type", "application/json;charset=UTF-8");
// headParams.put("founder.appId",)
return headParams;
}
}
<?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.dao.AjFwMapper">
<select id="queryXkSpZpList" resultType="com.founder.model.TbSpVo">
SELECT pictrue.case_code asjbh,pictrue.createtime createtime,pictrue.xckybh ,
'2' type,
pictrue.imgurl imgUrl,pictrue.file_name imgName
from
st_app_lawcase_objext_result pictrue
left join tb_st_asj asj on asj.asjbh=pictrue.case_code
<where>
<if test="asjbh != null and asjbh != ''">
and pictrue.case_code = #{asjbh}
</if>
<if test="jjbh != null and jjbh != ''">
and asj.jjbh = #{jjbh}
</if>
<if test="ajmc != null and ajmc != ''">
and asj.ajmc like concat(concat('%', #{jjbh}),'%')
</if>
<if test="ajlbdm != null and ajlbdm != ''">
and asj.ajlbdm =#{ajlbdm}
</if>
<if test="asjfsddDzmc != null and asjfsddDzmc != ''">
and asj.asjfsdd_dzmc like concat(concat('%', #{asjfsddDzmc}),'%')
</if>
<if test="xckybh != null and xckybh != ''">
and pictrue.xckybh = #{xckybh}
</if>
<if test="fakssj != null and fakssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[>=]]> DATE_FORMAT(#{fakssj}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="fajssj != null and fajssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[<=]]> DATE_FORMAT(#{fajssj}, '%Y-%m-%d %H:%i:%S')
</if>
</where>
order by pictrue.createtime desc limit #{page,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
</select>
<select id="queryXkSpZpListCount" resultType="java.lang.Integer">
SELECT count(1)
from
st_app_lawcase_objext_result pictrue
left join tb_st_asj asj on asj.asjbh=pictrue.case_code
<where>
<if test="asjbh != null and asjbh != ''">
and pictrue.case_code = #{asjbh}
</if>
<if test="jjbh != null and jjbh != ''">
and asj.jjbh = #{jjbh}
</if>
<if test="ajmc != null and ajmc != ''">
and asj.ajmc like concat(concat('%', #{jjbh}),'%')
</if>
<if test="ajlbdm != null and ajlbdm != ''">
and asj.ajlbdm =#{ajlbdm}
</if>
<if test="asjfsddDzmc != null and asjfsddDzmc != ''">
and asj.asjfsdd_dzmc like concat(concat('%', #{asjfsddDzmc}),'%')
</if>
<if test="xckybh != null and xckybh != ''">
and pictrue.xckybh = #{xckybh}
</if>
<if test="fakssj != null and fakssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[>=]]> DATE_FORMAT(#{fakssj}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="fajssj != null and fajssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[<=]]> DATE_FORMAT(#{fajssj}, '%Y-%m-%d %H:%i:%S')
</if>
</where>
</select>
<select id="queryXkSpList" resultType="com.founder.model.TbSpVo">
SELECT media.case_code asjbh, media.create_time createtime,media.xckybh ,
media.file_pathafterupload imgUrl,media.file_name imgName
from
st_app_camera_media media
left join tb_st_asj asj on asj.asjbh=media.case_code
<where>
<if test="asjbh != null and asjbh != ''">
and media.case_code = #{asjbh}
</if>
<if test="jjbh != null and jjbh != ''">
and asj.jjbh = #{jjbh}
</if>
<if test="ajmc != null and ajmc != ''">
and asj.ajmc like concat(concat('%', #{jjbh}),'%')
</if>
<if test="ajlbdm != null and ajlbdm != ''">
and asj.ajlbdm =#{ajlbdm}
</if>
<if test="asjfsddDzmc != null and asjfsddDzmc != ''">
and asj.asjfsdd_dzmc like concat(concat('%', #{asjfsddDzmc}),'%')
</if>
<if test="xckybh != null and xckybh != ''">
and media.xckybh = #{xckybh}
</if>
<if test="fakssj != null and fakssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[>=]]> DATE_FORMAT(#{fakssj}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="fajssj != null and fajssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[<=]]> DATE_FORMAT(#{fajssj}, '%Y-%m-%d %H:%i:%S')
</if>
</where>
order by media.create_time desc limit #{page,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
</select>
<select id="queryXkSpListCount" resultType="java.lang.Integer">
SELECT count(1)
from
st_app_camera_media media
left join tb_st_asj asj on asj.asjbh=media.case_code
<where>
<if test="asjbh != null and asjbh != ''">
and media.case_code = #{asjbh}
</if>
<if test="jjbh != null and jjbh != ''">
and asj.jjbh = #{jjbh}
</if>
<if test="ajmc != null and ajmc != ''">
and asj.ajmc like concat(concat('%', #{jjbh}),'%')
</if>
<if test="ajlbdm != null and ajlbdm != ''">
and asj.ajlbdm =#{ajlbdm}
</if>
<if test="asjfsddDzmc != null and asjfsddDzmc != ''">
and asj.asjfsdd_dzmc like concat(concat('%', #{asjfsddDzmc}),'%')
</if>
<if test="xckybh != null and xckybh != ''">
and media.xckybh = #{xckybh}
</if>
<if test="fakssj != null and fakssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[>=]]> DATE_FORMAT(#{fakssj}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="fajssj != null and fajssj != ''">
and asj.asjfssj_asjfskssj <![CDATA[<=]]> DATE_FORMAT(#{fajssj}, '%Y-%m-%d %H:%i:%S')
</if>
</where>
</select>
</mapper>
\ No newline at end of file
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