部署tomcat转发地址错误

master
anthonywj 2 years ago
parent e6e1907672
commit 607020c40e

@ -76,6 +76,10 @@ public class SyncController {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
uri = uri.replace("orderApi/", "");
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
}
String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip");
if (StrUtil.isNotEmpty(upperServerHost)) {
@ -93,6 +97,10 @@ public class SyncController {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
uri = uri.replace("busOrderApi/", "");
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
}
String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip");
if (StrUtil.isNotEmpty(upperServerHost)) {
@ -136,6 +144,11 @@ public class SyncController {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
uri = uri.replace("syncToSpms/", "");
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
}
String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip");
if (StrUtil.isNotEmpty(upperServerHost)) {
@ -152,6 +165,9 @@ public class SyncController {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
uri = uri.replace("directToSpms/", "");
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
}
String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip");
if (StrUtil.isNotEmpty(upperServerHost)) {
@ -163,13 +179,14 @@ public class SyncController {
private JSONObject redirectNolog(HttpServletRequest request, String uri) {
log.info("uri === " + uri);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<String> httpEntity = uriUtils.buildHeader(request);
ResponseEntity<JSONObject> responseBody = null;
if (request.getMethod().equals("POST")) {
responseBody = restTemplate.postForEntity(uri, httpEntity, JSONObject.class);
} else if (request.getMethod().equals("GET")) {
uri = uri +"?"+ request.getQueryString();
uri = uri + "?" + request.getQueryString();
responseBody = restTemplate.exchange(uri, HttpMethod.GET, httpEntity, JSONObject.class);
}
JSONObject result = responseBody.getBody();

@ -135,7 +135,6 @@ public class SpGetHttp {
//测试连通性
public BaseResponse<String> testUpConnect(String key) {
Map<String, Object> paramMap = new HashMap<>(16);
try {
String response = UHttpClient.mipsGetHead(getSpmsUrl() + "/sps/sync/connect/test", paramMap, getHeaders());
BaseResponse<String> data =

@ -59,26 +59,27 @@ public class IdcController {
@RequestMapping(value = "/spssync/common/uploadJson")
@ResponseBody
public BaseResponse uploadJson(HttpServletRequest request,@RequestBody Map<String, Object> params) {
public BaseResponse uploadJson(HttpServletRequest request, @RequestBody Map<String, Object> params) {
//
return idcService.receiveJson(request, params);
}
@RequestMapping(value = "/spssync/common/uploadFile")
public BaseResponse uploadFile(HttpServletRequest request,
@RequestParam("content") String content,
@RequestParam(value = "files", required = false) MultipartFile[] files) {
@RequestParam("content") String content,
@RequestParam(value = "files", required = false) MultipartFile[] files) {
//
return idcService.receive(request, content, files);
}
@RequestMapping(value = "/spssync/common/once")
@ResponseBody
public BaseResponse once(HttpServletRequest request,@RequestBody Map<String, Object> params) {
public BaseResponse once(HttpServletRequest request, @RequestBody Map<String, Object> params) {
//
boolean isUpload = params.get("isUpload")!=null && params.get("isUpload").equals("1") ? true : false ;
return idcService.onceSync( params.get("tableName").toString(), isUpload);
boolean isUpload = params.get("isUpload") != null && params.get("isUpload").equals("1") ? true : false;
return idcService.onceSync(params.get("tableName").toString(), isUpload);
}
//@Log("数据同步测试")
@RequestMapping(value = "/spssync/common/test")
public BaseResponse test(HttpServletRequest request, @RequestBody Map<String, Object> params) {
@ -121,12 +122,12 @@ public class IdcController {
}
@RequestMapping(value = "/spssync/common/downloadFile")
public void downloadFile(HttpServletResponse response,@RequestParam String fileName) throws UnsupportedEncodingException {
if (fileName != null) {
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("application/force-download");
idcService.downloadFile(fileName, response);
}
public void downloadFile(HttpServletResponse response, @RequestParam String fileName) throws UnsupportedEncodingException {
if (fileName != null) {
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
response.setContentType("application/force-download");
idcService.downloadFile(fileName, response);
}
}
@ -139,6 +140,10 @@ public class IdcController {
String isTopService = systemParamConfigService.selectValueByParamKey("is_top_service");
if (StrUtil.isNotEmpty(isTopService) && isTopService.equals("1")) {
uri = uri.replace("mapi/", "");
if (uri.contains("SP_SYNC_SERVER")) {
uri = uri.replace("SP_SYNC_SERVER/", "");
}
}
String upperServerHost = systemParamConfigService.selectValueByParamKey("upper_server_ip");
if (StrUtil.isNotEmpty(upperServerHost)) {

Loading…
Cancel
Save