部署tomcat转发地址错误

master
anthonywj 2 years ago
parent e6e1907672
commit 607020c40e

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

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

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

Loading…
Cancel
Save