Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
szpt
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
以墨为白
szpt
Commits
51ec1c16
Commit
51ec1c16
authored
Jan 15, 2025
by
夏敏伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swagger
parent
4c0d9cf5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
7 deletions
+21
-7
src/main/java/com/zksy/szpt/config/SwaggerConfig.java
src/main/java/com/zksy/szpt/config/SwaggerConfig.java
+2
-0
src/test/java/com/zksy/szpt/TestAppStore.java
src/test/java/com/zksy/szpt/TestAppStore.java
+15
-7
src/test/java/com/zksy/szpt/TestHttpUtil.java
src/test/java/com/zksy/szpt/TestHttpUtil.java
+4
-0
No files found.
src/main/java/com/zksy/szpt/config/SwaggerConfig.java
View file @
51ec1c16
...
@@ -34,10 +34,12 @@ public class SwaggerConfig {
...
@@ -34,10 +34,12 @@ public class SwaggerConfig {
Parameter
param2
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
NONCE
).
description
(
"nonce"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param2
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
NONCE
).
description
(
"nonce"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param3
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
TIMESTAMP
).
description
(
"timestamp"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param3
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
TIMESTAMP
).
description
(
"timestamp"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param4
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
SIGNATURE
).
description
(
"signature"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param4
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
SIGNATURE
).
description
(
"signature"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
Parameter
param5
=
new
ParameterBuilder
().
name
(
SignatureUtil
.
DEPT_CODE
).
description
(
"deptCode"
).
modelRef
(
new
ModelRef
(
"string"
)).
parameterType
(
"header"
).
required
(
false
).
build
();
pars
.
add
(
param1
);
pars
.
add
(
param1
);
pars
.
add
(
param2
);
pars
.
add
(
param2
);
pars
.
add
(
param3
);
pars
.
add
(
param3
);
pars
.
add
(
param4
);
pars
.
add
(
param4
);
pars
.
add
(
param5
);
ApiInfo
apiInfo
=
new
ApiInfoBuilder
()
ApiInfo
apiInfo
=
new
ApiInfoBuilder
()
.
title
(
"模块服务接口文档"
)
.
title
(
"模块服务接口文档"
)
.
description
(
"服务接口文档,遵循RESTful API设计规范"
)
.
description
(
"服务接口文档,遵循RESTful API设计规范"
)
...
...
src/test/java/com/zksy/szpt/TestAppStore.java
View file @
51ec1c16
...
@@ -15,14 +15,22 @@ public class TestAppStore {
...
@@ -15,14 +15,22 @@ public class TestAppStore {
@Test
@Test
@DisplayName
(
"新增AppId"
)
@DisplayName
(
"新增AppId"
)
public
void
addAppId
()
{
public
void
addAppId
()
{
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
// for (int i = 0; i < 10000; i++) {
// AppStoreDTO appStoreDTO = new AppStoreDTO();
// appStoreDTO.setAppKey("scale");
// appStoreDTO.setAppSecret(DigestUtil.md5Hex("scale"));
// appStoreDTO.setDeptCode("330102");
//
// TestHttpUtil.signatureAndRequest("/rest/appStore/insertAppStore", appStoreDTO, AppStoreDTO.class);
// }
AppStoreDTO
appStoreDTO
=
new
AppStoreDTO
();
AppStoreDTO
appStoreDTO
=
new
AppStoreDTO
();
appStoreDTO
.
setAppKey
(
"scale"
);
appStoreDTO
.
setAppKey
(
"scale"
);
appStoreDTO
.
setAppSecret
(
DigestUtil
.
md5Hex
(
"scale"
));
appStoreDTO
.
setAppSecret
(
DigestUtil
.
md5Hex
(
"scale"
));
appStoreDTO
.
setDeptCode
(
"330102"
);
appStoreDTO
.
setDeptCode
(
"330103"
);
TestHttpUtil
.
signatureAndRequest
(
"/rest/appStore/insertAppStore"
,
appStoreDTO
,
AppStoreDTO
.
class
);
TestHttpUtil
.
signatureAndRequest
(
"/rest/appStore/insertAppStore"
,
appStoreDTO
,
AppStoreDTO
.
class
);
}
// TestHttpUtil.signatureAndRequest("/rest/appStore/insertAppStore", appStoreDTO, AppStoreDTO.class);
// TestHttpUtil.signatureAndRequest("/rest/appStore/insertAppStore", appStoreDTO, AppStoreDTO.class);
// TestHttpUtil.signatureAndRequest("/rest/appStore/insertAppStore", appStoreDTO);
// TestHttpUtil.signatureAndRequest("/rest/appStore/insertAppStore", appStoreDTO);
...
...
src/test/java/com/zksy/szpt/TestHttpUtil.java
View file @
51ec1c16
...
@@ -32,11 +32,15 @@ public class TestHttpUtil {
...
@@ -32,11 +32,15 @@ public class TestHttpUtil {
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
Assertions
.
fail
(
"json序列化失败"
);
Assertions
.
fail
(
"json序列化失败"
);
}
}
log
.
info
(
"原始body:{}"
,
json
);
//请求体加密
//请求体加密
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
appSecret
);
json
=
EncryptUtil
.
getInstance
().
AESEncode
(
json
,
appSecret
);
log
.
info
(
"加密后body:{}"
,
json
);
//签名appId+nonce+timestampStr+aes(body)+deptCode
//签名appId+nonce+timestampStr+aes(body)+deptCode
String
data
=
String
.
format
(
"%s%s%s%s%S"
,
appId
,
nonce
,
timestampStr
,
json
,
deptCode
);
String
data
=
String
.
format
(
"%s%s%s%s%S"
,
appId
,
nonce
,
timestampStr
,
json
,
deptCode
);
log
.
info
(
"待签名:{}"
,
data
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
String
generatedSignature
=
DigestUtil
.
md5Hex
(
data
);
log
.
info
(
"已签名:{}"
,
generatedSignature
);
//请求
//请求
WebClient
webClient
=
WebClient
.
builder
()
WebClient
webClient
=
WebClient
.
builder
()
.
baseUrl
(
"http://localhost:8086"
)
.
baseUrl
(
"http://localhost:8086"
)
...
...
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