Commit 3f20133d by yangyang

重庆14个市局通用接口、增加ip限制提交

parent 6ecd08c8
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.founder.commonutils.Exception.TokenException;
import com.founder.commonutils.model.newPublicEntity.*;
import com.founder.commonutils.util.JwtUser;
import com.founder.commonutils.util.NetworkUtil;
import com.founder.commonutils.util.ResultUtil;
import com.founder.servicebase.service.SkServiceApplyService;
import com.founder.servicebase.service.SkServiceService;
......@@ -22,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author jlt
......@@ -82,7 +84,7 @@ public class TokenInterceptor implements HandlerInterceptor {
JSONObject object = new JSONObject(sub);
ThirdToken token = new ThirdToken(object);
System.out.println(token);
str = verifyToken(token);
str = verifyToken(request,token);
if (str.equals("")) {
name = token.getServiceName();
return true;
......@@ -163,11 +165,15 @@ public class TokenInterceptor implements HandlerInterceptor {
/**
* 校验第三方token
*/
public String verifyToken(ThirdToken token) {
public String verifyToken(HttpServletRequest request,ThirdToken token) {
String str = "";
// ip验证
if(!token.getIp().contains(NetworkUtil.getIpAddr(request))){
return "ip限制!";
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("applyGs", token.getGsNama());
queryWrapper.eq("applyUrl", token.getIp());
queryWrapper.like("applyUrl", token.getIp());
queryWrapper.eq("status", "1");
List<SkServiceApply> list = skServiceApplyService.list(queryWrapper);
if (list == null || list.size() == 0) {
......@@ -175,6 +181,7 @@ public class TokenInterceptor implements HandlerInterceptor {
} else {
QueryWrapper queryWrapper1 = new QueryWrapper();
queryWrapper1.eq("serviceName", token.getServiceName());
queryWrapper1.eq("serviceUrl", request.getRequestURI());
List<String> serviceIds = getServiceIds(list);
queryWrapper1.in("xxzjbh", serviceIds);
List<SkService> list1 = service.list(queryWrapper1);
......
......@@ -2,9 +2,11 @@ package com.founder.publicapi.controller.cqService;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.model.newPublicEntity.cqEntity.CqExcelImport;
import com.founder.commonutils.model.newPublicEntity.cqEntity.CqExcelImportResult;
import com.founder.commonutils.util.ExportExcelUtil;
import com.founder.commonutils.util.HttpClient;
import com.founder.publicapi.mapper.qgxzMapper.TbStAsjqgMapper;
import com.founder.publicapi.service.CqImportListener;
import com.founder.servicebase.logs.OperLog;
......@@ -12,7 +14,9 @@ import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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 org.springframework.web.multipart.MultipartFile;
......@@ -22,14 +26,16 @@ import java.io.BufferedInputStream;
import java.io.InputStream;
@Api(tags = "渝康码管理(重庆)")
@Api(tags = "市局接口管理(供第三方公司使用)重庆")
@RestController
@RequestMapping("/ykm")
@RequestMapping("/fhdaas")
public class CqController {
@Value("${ykmUrl}")
private String ykmUrl;
@Autowired
TbStAsjqgMapper tbStAsjqgMapper;
@OperLog(message = "模板手机号导入",operation = OperationType.QUERY)
@OperLog(message = "模板手机号导入", operation = OperationType.QUERY)
@PostMapping("import")
@ApiOperation(value = "模板手机号导入", notes = "传入excel")
public void importKsjHd(MultipartFile file, HttpServletResponse response) {
......@@ -49,12 +55,209 @@ public class CqController {
builder.doReadAll();
// 导出
ExportExcelUtil<CqExcelImportResult> exportExcelUtil = new ExportExcelUtil<>();
String[] headersName = {"本机号码","对方号码","证件号码","案件编号"};
String[] headersField = {"source","target","zjhm","asjbh"};
exportExcelUtil.exportExcel("DataStatistics", headersName, headersField, importListener.getListResult(), response,"手机关联案件信息");
String[] headersName = {"本机号码", "对方号码", "证件号码", "案件编号"};
String[] headersField = {"source", "target", "zjhm", "asjbh"};
exportExcelUtil.exportExcel("DataStatistics", headersName, headersField, importListener.getListResult(), response, "手机关联案件信息");
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("上传失败!");
}
}
@OperLog(message = "渝康码", operation = OperationType.QUERY)
@PostMapping("ykmRequest")
@ApiOperation(value = "渝康码", notes = "渝康码")
public JSONObject ykmRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "疫情防控场所码信息", operation = OperationType.QUERY)
@PostMapping("yqfkcsmxxRequest")
@ApiOperation(value = "疫情防控场所码信息", notes = "疫情防控场所码信息")
public JSONObject yqfkcsmxxRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "车辆主题库宽表", operation = OperationType.QUERY)
@PostMapping("clztkkbRequest")
@ApiOperation(value = "车辆主题库宽表", notes = "车辆主题库宽表")
public JSONObject clztkkbRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "重庆市医保办卡信息(STG)", operation = OperationType.QUERY)
@PostMapping("cqsybbkxxRequest")
@ApiOperation(value = "重庆市医保办卡信息(STG)", notes = "重庆市医保办卡信息(STG)")
public JSONObject cqsybbkxxRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "情报_从业人员", operation = OperationType.QUERY)
@PostMapping("qbcyryRequest")
@ApiOperation(value = "情报_从业人员", notes = "情报_从业人员")
public JSONObject qbcyryRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "众盟数据", operation = OperationType.QUERY)
@PostMapping("zmsjRequest")
@ApiOperation(value = "众盟数据", notes = "众盟数据")
public JSONObject zmsjRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "出租车GPS数据", operation = OperationType.QUERY)
@PostMapping("czcgpssjRequest")
@ApiOperation(value = "出租车GPS数据", notes = "出租车GPS数据")
public JSONObject czcgpssjRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "情报信息中心_核酸检测信息", operation = OperationType.QUERY)
@PostMapping("qbxxzxhsjcxxequest")
@ApiOperation(value = "情报信息中心_核酸检测信息", notes = "情报信息中心_核酸检测信息")
public JSONObject qbxxzxhsjcxxequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "两客一危GPS数据清洗", operation = OperationType.QUERY)
@PostMapping("lkywgpssjqxRequest")
@ApiOperation(value = "两客一危GPS数据清洗", notes = "两客一危GPS数据清洗")
public JSONObject lkywgpssjqxRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "船舶GPS位置清洗", operation = OperationType.QUERY)
@PostMapping("cbgpswzqxRequest")
@ApiOperation(value = "船舶GPS位置清洗", notes = "船舶GPS位置清洗")
public JSONObject cbgpswzqxRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "危化品车辆GPS", operation = OperationType.QUERY)
@PostMapping("whpclgpsRequest")
@ApiOperation(value = "危化品车辆GPS", notes = "危化品车辆GPS")
public JSONObject whpclgpsRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "船舶GPS位置", operation = OperationType.QUERY)
@PostMapping("cbgpsRequest")
@ApiOperation(value = "船舶GPS位置", notes = "船舶GPS位置")
public JSONObject cbgpsRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "GPS基础信息", operation = OperationType.QUERY)
@PostMapping("gpsjcxxRequest")
@ApiOperation(value = "GPS基础信息", notes = "GPS基础信息")
public JSONObject gpsjcxxRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
@OperLog(message = "渝康码扫码", operation = OperationType.QUERY)
@PostMapping("ykmsmRequest")
@ApiOperation(value = "渝康码扫码", notes = "渝康码扫码")
public JSONObject ykmsmRequest(@RequestBody JSONObject parasm) {
JSONObject resultCar = null;
try {
HttpClient httpClientCq = new HttpClient();
resultCar = httpClientCq.doPostJson(ykmUrl, parasm.toJSONString());
} catch (Exception e) {
e.printStackTrace();
}
return resultCar;
}
}
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