Commit c0b4c534 by yangyang

美亚厨房ip调整(内蒙)

parent 7e7eeb52
package com.founder.commonutils.util;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
......@@ -51,4 +54,35 @@ public class NetworkUtil {
}
return ipAddress;
}
public static String getRealIp(HttpServletRequest request) throws Exception {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("X-Real-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
//有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP
if (ip != null && ip.length() != 0) {
ip = ip.split(",")[0];
}
if ("127.0.0.1".equals(ip) || ip == "127.0.0.1" || "0:0:0:0:0:0:0:1".equals(ip)
|| ip == "0:0:0:0:0:0:0:1") {
ip = InetAddress.getLocalHost().getHostAddress();
}
return ip;
}
}
token_url = https://26.13.101.72:8443/xsp-auth/oauth2/token
token_url = https://26.3.111.234:8443/xsp-auth/oauth2/token
#header
Content-Type=application/json
#body
......
......@@ -10,7 +10,7 @@ import com.founder.commonutils.model.nmDataEntity.ResultEntity.MySjGjxx;
import com.founder.commonutils.model.vo.response.SkTrailVO;
import com.founder.commonutils.util.DateUtil;
import com.founder.commonutils.util.HttpClient;
import com.founder.commonutils.util.TokenUtils;
import com.founder.commonutils.util.RedisTokenUtils;
import com.founder.publicapi.mapper.oracleXzxtMapper.SysDictitemMapper;
import com.founder.publicapi.service.SkPointlocationService;
import org.apache.commons.lang.StringUtils;
......@@ -412,7 +412,7 @@ public class InterfaceAPI {
while (flag) {
try {
// 接口调用
String token = TokenUtils.getYtgsToken();
String token = RedisTokenUtils.getZgToken();
Map herders = new HashMap();
JSONObject jsonObjectParams = new JSONObject();
String[] device_type = {"6","20"};
......
......@@ -7,10 +7,10 @@ import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.model.newPublicEntity.SysUser;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.DataCodeConstant;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.NmDataEnum;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.NmTokenUtils;
import com.founder.commonutils.model.nmDataEntity.ResultEntity.MyXsGxxx;
import com.founder.commonutils.util.JsonUtils;
import com.founder.commonutils.util.NetworkUtil;
import com.founder.commonutils.util.RedisTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
......@@ -35,7 +35,7 @@ import java.util.*;
*/
@Component
public class NmDataUtil {
private String dataUrl="http://26.13.101.72:8999/center_new";// 统一url
private String dataUrl="http://26.3.111.234:8999/center_new";// 统一url
/**
* httpclient连接池对象
......@@ -50,7 +50,7 @@ public class NmDataUtil {
Map paramsMap) {
String url = dataUrl + nmDataEnum.getUrl();
// 请求接口
String resultString = getData(request, url,paramsMap);
String resultString = getData(request, url,paramsMap,1);
JSONObject map = JSON.parseObject(resultString);
Object object = map.get(DataCodeConstant.MY_RETURN_DATA_CODE);
// 返回处理
......@@ -69,7 +69,7 @@ public class NmDataUtil {
}
// 三方接口调用
public String getData(HttpServletRequest request, String url,Map<String,String> paramsMap) {
public String getData(HttpServletRequest request, String url,Map<String,String> paramsMap,int flag) {
System.out.println("中央厨房参数传入:" + url + JSON.toJSONString(paramsMap));
// 入参处理
List<NameValuePair> pairsData = new ArrayList<NameValuePair>();
......@@ -86,7 +86,7 @@ public class NmDataUtil {
CloseableHttpResponse response = null;
String resultString = "";
// token获取
String token = NmTokenUtils.getToken();
String token = RedisTokenUtils.getDsjToken();
CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(cm).build();
try {
......@@ -107,11 +107,8 @@ public class NmDataUtil {
} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
if(flag<30){
return getData(request, url,paramsMap,flag+1);
}
}
return resultString;
......
......@@ -10,7 +10,6 @@ import com.founder.commonutils.model.newPublicEntity.SysUser;
import com.founder.commonutils.model.newPublicEntity.hnkshEntity.*;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.nmDataEntity.NeiMengEntity.*;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.NmTokenUtils;
import com.founder.commonutils.util.*;
import com.founder.publicapi.SkNmInterface.NmDataUtil;
import com.founder.publicapi.mapper.oracleXzxtMapper.ZbFzxyrDataMapper;
......@@ -750,34 +749,34 @@ public class KshSlServiceController {
String identitycard = sysUser.getIdentitycard();// 请求人证件
String ipAddr = NetworkUtil.getIpAddr(request);// 请求人ip
Map<String, String> map = new HashMap<>();
System.out.println("token=========" + NmTokenUtils.getToken());
System.out.println("token=========" + RedisTokenUtils.getDsjToken());
System.out.println("请求人姓名=========" + trueName);
System.out.println("请求人证件=========" + identitycard);
System.out.println("请求人ip=========" + ipAddr);
System.out.println("当前登录用户的证件号=========" + sysUser.getIdentitycard());
System.out.println("当前用户的用户名=========" + sysUser.getTrueName());
map.put("Authorization", NmTokenUtils.getToken());
map.put("Authorization", RedisTokenUtils.getDsjToken());
map.put("user-cert", sysUser.getIdentitycard());//当前登录用户的证件号(比如身份证)
map.put("user-username", sysUser.getTrueName());//当前用户的用户名
return map;
}
public String JPGX = "http://26.13.101.72:8999/center_new/004/001";
public String TZGX = "http://26.13.101.72:8999/center_new/004/002";
public String TAGX = "http://26.13.101.72:8999/center_new/004/004";
public String SHGX = "http://26.13.101.72:8999/center_new/004/005";
public String TLGX = "http://26.13.101.72:8999/center_new/004/003";
public String XSGX = "http://26.13.101.72:8999/center_new/005/001";
public String SMGL = "http://26.13.101.72:8999/center_new/005/002";
public String TLFX = "http://26.13.101.72:8999/center_new/006/008";
public String JDFX = "http://26.13.101.72:8999/center_new/006/002";
public String RZFX = "http://26.13.101.72:8999/center_new/006/003";
public String CRJFX = "http://26.13.101.72:8999/center_new/006/004";
public String CXFX = "http://26.13.101.72:8999/center_new/006/005";
public String TXFX = "http://26.13.101.72:8999/center_new/006/007";
public String AJDA = "http://26.13.101.72:8999/center_new/001/006";//案件档案
public String WPDA = "http://26.13.101.72:8999/center_new/001/003";//物品档案
public String JPGX = "http://26.3.111.234:8999/center_new/004/001";
public String TZGX = "http://26.3.111.234:8999/center_new/004/002";
public String TAGX = "http://26.3.111.234:8999/center_new/004/004";
public String SHGX = "http://26.3.111.234:8999/center_new/004/005";
public String TLGX = "http://26.3.111.234:8999/center_new/004/003";
public String XSGX = "http://26.3.111.234:8999/center_new/005/001";
public String SMGL = "http://26.3.111.234:8999/center_new/005/002";
public String TLFX = "http://26.3.111.234:8999/center_new/006/008";
public String JDFX = "http://26.3.111.234:8999/center_new/006/002";
public String RZFX = "http://26.3.111.234:8999/center_new/006/003";
public String CRJFX = "http://26.3.111.234:8999/center_new/006/004";
public String CXFX = "http://26.3.111.234:8999/center_new/006/005";
public String TXFX = "http://26.3.111.234:8999/center_new/006/007";
public String AJDA = "http://26.3.111.234:8999/center_new/001/006";//案件档案
public String WPDA = "http://26.3.111.234:8999/center_new/001/003";//物品档案
//通过身份证号查询人员亲属关系信息
......@@ -2554,7 +2553,7 @@ public class KshSlServiceController {
}
public String RYDA = "http://26.13.101.72:8999/center_new/001/001";
public String RYDA = "http://26.3.111.234:8999/center_new/001/001";
//根据身份证获取照片
public Map<String, String> getPhoto(String zjhm, HttpServletRequest request) {
......
......@@ -55,7 +55,7 @@ public class SkRxController extends ApiController {
faceRxbdSearchParam.setImage(dataImage);
faceRxbdSearchParam.setThreshold(Integer.valueOf(sktrailParam.getXsd()));
// 接口调用
String token = TokenUtils.getYtgsToken();
String token = RedisTokenUtils.getZgToken();
Map herders = new HashMap();
List<Map<String, Object>> list = new ArrayList<>();
......@@ -100,7 +100,7 @@ public class SkRxController extends ApiController {
// 身份稽查名单库查询
public List<FaceRxbdSearchParam.mdkList> getSfyck()throws Exception{
// 接口调用
String token = TokenUtils.getYtgsToken();
String token = RedisTokenUtils.getZgToken();
Map herders = new HashMap();
List<FaceRxbdSearchParam.mdkList> list = new ArrayList<>();
JSONObject jsonObjectParams = new JSONObject();
......
......@@ -497,7 +497,7 @@ public class SkTrailController extends ApiController implements ExcelControllerI
faceSearchParam.setEnd_time(Long.valueOf(DateUtil.getTimeStamp(sktrailParam.getJssj())));
faceSearchParam.setThreshold(Integer.valueOf(sktrailParam.getXsd()));
// 接口调用
String token = TokenUtils.getYtgsToken();
String token = RedisTokenUtils.getZgToken();
Map herders = new HashMap();
// 设置请求的header参数
herders.put("Authorization", token);
......
......@@ -10,10 +10,7 @@ import com.founder.commonutils.model.newPublicEntity.SkRegionalsResultAll;
import com.founder.commonutils.model.newPublicEntity.SkRegionalsResultFl;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.FaceJghSearchParam;
import com.founder.commonutils.model.vo.param.*;
import com.founder.commonutils.util.DateUtil;
import com.founder.commonutils.util.HttpClient;
import com.founder.commonutils.util.JsonUtils;
import com.founder.commonutils.util.TokenUtils;
import com.founder.commonutils.util.*;
import com.founder.publicapi.mapper.mysqlMapper.SkPointlocationMapper;
import com.founder.publicapi.mapper.mysqlMapper.SkRegionalsResultMapper;
import com.founder.publicapi.mapper.mysqlMapper.SkRegionalsTaskMapper;
......@@ -747,7 +744,7 @@ public class SkRegionalsResultServiceImpl extends ServiceImpl<SkRegionalsResultM
// 分页处理
faceJghSearchParam.setPage(faceJghSearchParamPage);
// 接口调用
String token = TokenUtils.getYtgsToken();
String token = RedisTokenUtils.getZgToken();
Map herders = new HashMap();
// 设置请求的header参数
......
......@@ -35,6 +35,12 @@ spring.datasource.mysql.username=skyp
spring.datasource.mysql.password=skyp
spring.datasource.mysql.type=com.alibaba.druid.pool.DruidDataSource
#redis
spring.redis.host=localhost
spring.redis.port=6378
spring.redis.password=123
spring.redis.database=6
#\u5377\u5B97\u4E0A\u4F20\u7684\u8DEF\u5F84
approvalFilePath = /data/excel/approvalWord/
#\u65B0\u589E\u5377\u5B97\u5927\u6570\u636E\u6A21\u578B\u4E0B\u8F7D\u8DEF\u5F84
......
......@@ -35,6 +35,12 @@ spring.datasource.mysql.username=skyp
spring.datasource.mysql.password=skyp
spring.datasource.mysql.type=com.alibaba.druid.pool.DruidDataSource
#redis
spring.redis.host=10.100.17.124
spring.redis.port=9379
spring.redis.password=bjhlxt@2020
spring.redis.database=6
#\u5377\u5B97\u4E0A\u4F20\u7684\u8DEF\u5F84
approvalFilePath = /data/excel/approvalWord/
#\u65B0\u589E\u5377\u5B97\u5927\u6570\u636E\u6A21\u578B\u4E0B\u8F7D\u8DEF\u5F84
......
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