Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-service-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-service-platform
Commits
e85e1d66
Commit
e85e1d66
authored
Mar 24, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改配置文件
parent
58e3a977
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
95 deletions
+0
-95
enterprise-service-manager/src/main/java/com/mortals/xhx/busiz/web/ProxyController.java
.../main/java/com/mortals/xhx/busiz/web/ProxyController.java
+0
-95
No files found.
enterprise-service-manager/src/main/java/com/mortals/xhx/busiz/web/ProxyController.java
View file @
e85e1d66
...
@@ -43,69 +43,6 @@ public class ProxyController {
...
@@ -43,69 +43,6 @@ public class ProxyController {
this
.
webClient
=
webClientBuilder
.
build
();
this
.
webClient
=
webClientBuilder
.
build
();
}
}
/* @PostMapping("/post")
@UnAuth
public Mono<ResponseEntity<String>> proxyPost(
@RequestParam Map<String, String> params, // 透传 URL 参数
@RequestBody(required = false) String body, // 透传 Body
@RequestHeader Map<String, String> headers // 透传 Headers
) {
log.info("proxyPost params: {}, body: {}, headers: {}", params, body, headers);
ApiResp<String> rsp = new ApiResp<>();
String path = params.getOrDefault("path", "");
if (ObjectUtils.isEmpty(path)) {
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
rsp.setMsg("path is empty!");
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
}
String method = params.getOrDefault("method", "post");
params.remove("method");
params.remove("path");
String targetUrl = "http://127.0.0.1:11078/basics_api/" + path;
String targetPath = "/basics_api" + path;
log.info("proxyPost targetUrl: {}", targetUrl);
if ("post".equalsIgnoreCase(method)) {
return webClient.post()
.uri(uriBuilder -> {
uriBuilder
.scheme("http")
.host("127.0.0.1")
.port(11078)
.path(targetPath);
params.forEach((key, value) ->
uriBuilder.queryParam(key, UriUtils.encode(value, StandardCharsets.UTF_8))
);
return uriBuilder.build();
})
*//* .uri(uriBuilder -> {
uriBuilder.scheme("http");
uriBuilder.path(targetUrl);
params.forEach((key, value) ->
uriBuilder.queryParam(key, UriUtils.encode(value, StandardCharsets.UTF_8))
);
log.info("proxyPost uriBuilder: {}", uriBuilder.build());
return uriBuilder.build();
})*//*
.headers(httpHeaders -> headers.forEach(httpHeaders::set))
.bodyValue(body != null ? body : "") // 透传 Body
.retrieve()
.toEntity(String.class);
} else if ("get".equalsIgnoreCase(method)) {
} else {
//不支持
}
return Mono.just(ResponseEntity.ok().body(JSON.toJSONString(rsp)));
}*/
@PostMapping
(
"/post"
)
@PostMapping
(
"/post"
)
@UnAuth
@UnAuth
...
@@ -172,7 +109,6 @@ public class ProxyController {
...
@@ -172,7 +109,6 @@ public class ProxyController {
jsonObject
.
put
(
"icon"
,
base64Str
);
jsonObject
.
put
(
"icon"
,
base64Str
);
}
}
}
}
String
qrCode
=
jsonObject
.
getString
(
"qrCode"
);
String
qrCode
=
jsonObject
.
getString
(
"qrCode"
);
if
(!
ObjectUtils
.
isEmpty
(
qrCode
)
&&
qrCode
.
startsWith
(
"/file"
))
{
if
(!
ObjectUtils
.
isEmpty
(
qrCode
)
&&
qrCode
.
startsWith
(
"/file"
))
{
String
filePath
=
uploadService
.
getFilePath
(
qrCode
);
String
filePath
=
uploadService
.
getFilePath
(
qrCode
);
...
@@ -211,9 +147,6 @@ public class ProxyController {
...
@@ -211,9 +147,6 @@ public class ProxyController {
}
}
return
Rest
.
ok
(
"透传请求成功!"
,
rspJson
.
toJSONString
());
return
Rest
.
ok
(
"透传请求成功!"
,
rspJson
.
toJSONString
());
}
}
//String resp = HttpUtil.get(urlGet);
return
Rest
.
ok
(
"透传请求成功!"
,
resp
);
return
Rest
.
ok
(
"透传请求成功!"
,
resp
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
rsp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
...
@@ -225,38 +158,10 @@ public class ProxyController {
...
@@ -225,38 +158,10 @@ public class ProxyController {
rsp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
rsp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
rsp
.
setMsg
(
"method is not support!"
);
rsp
.
setMsg
(
"method is not support!"
);
return
Rest
.
fail
(
rsp
.
getMsg
());
return
Rest
.
fail
(
rsp
.
getMsg
());
// return ResponseEntity.ok().body(JSON.toJSONString(rsp));
}
}
}
}
/**
* 添加参数
*
* @param bodyParams
* @return
*/
private
String
getBodyParams
(
Map
<
String
,
String
>
bodyParams
)
{
//1.添加请求参数
//遍历map中所有参数到builder
if
(
bodyParams
!=
null
&&
bodyParams
.
size
()
>
0
)
{
StringBuffer
stringBuffer
=
new
StringBuffer
(
"?"
);
for
(
String
key
:
bodyParams
.
keySet
())
{
if
(!
TextUtils
.
isEmpty
(
key
)
&&
!
TextUtils
.
isEmpty
(
bodyParams
.
get
(
key
)))
{
//如果参数不是null并且不是"",就拼接起来
stringBuffer
.
append
(
key
);
stringBuffer
.
append
(
"="
);
stringBuffer
.
append
(
bodyParams
.
get
(
key
));
}
}
return
stringBuffer
.
toString
();
}
else
{
return
""
;
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment