Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-analysis
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.online.exam
pica-cloud-analysis
提交
1c93fdb1
提交
1c93fdb1
编写于
1月 18, 2024
作者:
xinxu.wang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-cat-0110' into 'release'
cat 去除 See merge request
!4
上级
7fb3168c
9a8adb8c
流水线
#54729
已取消 于阶段
变更
2
流水线
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
43 行增加
和
14 行删除
+43
-14
pom.xml
server/pom.xml
+0
-10
HttpClient4Utils.java
...d/online/exam/analysis/server/utils/HttpClient4Utils.java
+43
-4
未找到文件。
server/pom.xml
浏览文件 @
1c93fdb1
...
@@ -143,16 +143,6 @@
...
@@ -143,16 +143,6 @@
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-core
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-client
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
foundation-service
</artifactId>
<artifactId>
foundation-service
</artifactId>
...
...
server/src/main/java/com/pica/cloud/online/exam/analysis/server/utils/HttpClient4Utils.java
浏览文件 @
1c93fdb1
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
utils
;
package
com
.
pica
.
cloud
.
online
.
exam
.
analysis
.
server
.
utils
;
import
org.apache.http.Consts
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.config.RequestConfig
;
...
@@ -15,11 +16,9 @@ import org.slf4j.Logger;
...
@@ -15,11 +16,9 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author wuminghao
* @author wuminghao
...
@@ -69,6 +68,7 @@ public class HttpClient4Utils {
...
@@ -69,6 +68,7 @@ public class HttpClient4Utils {
UrlEncodedFormEntity
postEntity
=
new
UrlEncodedFormEntity
(
formParams
,
encoding
);
UrlEncodedFormEntity
postEntity
=
new
UrlEncodedFormEntity
(
formParams
,
encoding
);
httpPost
.
setEntity
(
postEntity
);
httpPost
.
setEntity
(
postEntity
);
}
}
// httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
CloseableHttpResponse
response
=
null
;
CloseableHttpResponse
response
=
null
;
try
{
try
{
response
=
(
CloseableHttpResponse
)
httpClient
.
execute
(
httpPost
);
response
=
(
CloseableHttpResponse
)
httpClient
.
execute
(
httpPost
);
...
@@ -86,4 +86,43 @@ public class HttpClient4Utils {
...
@@ -86,4 +86,43 @@ public class HttpClient4Utils {
}
}
return
resp
;
return
resp
;
}
}
public
static
void
main
(
String
[]
s
)
{
HttpClient
httpClient
=
HttpClient4Utils
.
createHttpClient
(
200
,
200
,
2000
,
2000
,
2000
);
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
/**
* 1. 设置公共参数
*/
params
.
put
(
"secretId"
,
"f437763dcf0a4096948b0cfbaebd668b"
);
params
.
put
(
"businessId"
,
"7065ac9c9cf4472fbf44fe3f90a03624"
);
params
.
put
(
"version"
,
"v1"
);
params
.
put
(
"timestamp"
,
String
.
valueOf
(
System
.
currentTimeMillis
()));
params
.
put
(
"nonce"
,
String
.
valueOf
(
new
Random
().
nextInt
()));
/**
* 2. 设置私有参数
*/
// params.put("dataId", "ebfcad1c-pica-490c-b4de-e784c2691768");
params
.
put
(
"name"
,
"韦少峰"
);
params
.
put
(
"cardNo"
,
"440624198310214613"
);
/**
* 3. 生成签名信息
*/
try
{
String
signature
=
SignatureUtils
.
genSignature
(
"6cc930e9e481fce8e5d3da30dddf74c4"
,
params
);
params
.
put
(
"signature"
,
signature
);
}
catch
(
UnsupportedEncodingException
e
)
{
logger
.
error
(
"processString"
,
e
);
}
/**
* 4. 发送HTTP请求
*/
System
.
out
.
println
(
sendPost
(
httpClient
,
"https://verify.dun.163.com/v1/idcard/check"
,
params
,
Consts
.
UTF_8
));
}
}
}
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录