Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wios
概览
Overview
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
苗卫卫
wios
Commits
dbb71eb5
提交
dbb71eb5
authored
11月 08, 2023
作者:
chaining
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 迁移物流相关代码
父级
df550e2a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
20 行增加
和
17 行删除
+20
-17
src/main/java/com/starcharge/wios/client/DepponClient.java
+3
-1
src/main/java/com/starcharge/wios/client/DopInterceptor.java
+16
-14
src/main/java/com/starcharge/wios/controller/WallboxApplyController.java
+1
-2
没有找到文件。
src/main/java/com/starcharge/wios/client/DepponClient.java
查看文件 @
dbb71eb5
...
@@ -4,6 +4,8 @@ import com.dtflys.forest.annotation.BaseRequest;
...
@@ -4,6 +4,8 @@ import com.dtflys.forest.annotation.BaseRequest;
import
com.dtflys.forest.annotation.Body
;
import
com.dtflys.forest.annotation.Body
;
import
com.dtflys.forest.annotation.Post
;
import
com.dtflys.forest.annotation.Post
;
import
java.util.Map
;
/**
/**
* <p>
* <p>
* 德邦物流clinet,注意入参使用Map或者对象实体
* 德邦物流clinet,注意入参使用Map或者对象实体
...
@@ -20,6 +22,6 @@ public interface DepponClient {
...
@@ -20,6 +22,6 @@ public interface DepponClient {
* @return 字符串
* @return 字符串
*/
*/
@Post
(
"newTraceQuery.action"
)
@Post
(
"newTraceQuery.action"
)
String
newTraceQuery
(
@Body
(
"params"
)
String
params
);
String
newTraceQuery
(
@Body
(
"params"
)
Map
<
String
,
Object
>
params
);
}
}
src/main/java/com/starcharge/wios/client/DopInterceptor.java
查看文件 @
dbb71eb5
package
com
.
starcharge
.
wios
.
client
;
package
com
.
starcharge
.
wios
.
client
;
import
com.deppon.dop.module.sdk.shared.util.FastJsonUtil
;
import
com.deppon.dop.module.sdk.shared.util.SecurityUtil
;
import
com.deppon.dop.module.sdk.shared.util.SecurityUtil
;
import
com.dtflys.forest.exceptions.ForestRuntimeException
;
import
com.dtflys.forest.exceptions.ForestRuntimeException
;
import
com.dtflys.forest.http.ForestRequest
;
import
com.dtflys.forest.http.ForestRequest
;
...
@@ -18,11 +19,12 @@ import org.apache.commons.codec.digest.DigestUtils;
...
@@ -18,11 +19,12 @@ import org.apache.commons.codec.digest.DigestUtils;
*/
*/
public
class
DopInterceptor
<
T
>
implements
Interceptor
<
T
>
{
public
class
DopInterceptor
<
T
>
implements
Interceptor
<
T
>
{
private
final
String
companyCode
=
"EWBXRCHSZX"
;
private
final
String
companyCode
=
"EWBXRCHSZX"
;
private
final
String
appkey
=
"fe38a755ce4f7629717342e441cdedff"
;
private
final
String
appkey
=
"fe38a755ce4f7629717342e441cdedff"
;
/**
/**
* 该方法在被调用时,检测token是否过期,并在beforeExecute前被调用
* 该方法在被调用时
*
* @Param request Forest请求对象
* @Param request Forest请求对象
* @Param args 方法被调用时传入的参数数组
* @Param args 方法被调用时传入的参数数组
*/
*/
...
@@ -32,16 +34,16 @@ public class DopInterceptor <T> implements Interceptor<T> {
...
@@ -32,16 +34,16 @@ public class DopInterceptor <T> implements Interceptor<T> {
@Override
@Override
public
boolean
beforeExecute
(
ForestRequest
request
)
{
public
boolean
beforeExecute
(
ForestRequest
request
)
{
request
.
addHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=utf-8"
);
request
.
addHeader
(
"Content-Type"
,
"application/x-www-form-urlencoded;charset=utf-8"
);
String
params
=
request
.
getBody
().
get
(
0
).
toString
();
// String params = request.getBody().get(0)+"";
// String timestamp=System.currentTimeMillis()+"";
long
timestamp
=
System
.
currentTimeMillis
();
String
timestamp
=
"1697877426621"
;
String
params
=
FastJsonUtil
.
toJSONString
(
request
.
getBody
().
getNameValueBody
(
"params"
).
getValue
());
//params+appkey+timestamp,,,ZDU0NzYzZWJkODRhZjBlZjcyYjEwZDYxYTNlNzRkNWQ=
String
digest
=
SecurityUtil
.
getStandardDigest
(
params
+
appkey
+
timestamp
);
String
digest
=
SecurityUtil
.
getStandardDigest
(
params
+
appkey
+
timestamp
);
request
.
addBody
(
"companyCode"
,
companyCode
);
request
.
addBody
(
"companyCode"
,
companyCode
);
request
.
addBody
(
"digest"
,
digest
);
request
.
addBody
(
"digest"
,
digest
);
request
.
addBody
(
"timestamp"
,
timestamp
);
request
.
addBody
(
"timestamp"
,
timestamp
);
return
true
;
// 继续执行请求返回true
request
.
addBody
(
"params"
,
params
);
return
true
;
}
}
/**
/**
...
@@ -68,7 +70,7 @@ public class DopInterceptor <T> implements Interceptor<T> {
...
@@ -68,7 +70,7 @@ public class DopInterceptor <T> implements Interceptor<T> {
public
void
afterExecute
(
ForestRequest
req
,
ForestResponse
res
)
{
public
void
afterExecute
(
ForestRequest
req
,
ForestResponse
res
)
{
}
}
private
String
getDigest
(
String
plainText
)
{
private
String
getDigest
(
String
plainText
)
{
return
Base64
.
encodeBase64String
(
DigestUtils
.
md5Hex
(
plainText
).
getBytes
());
return
Base64
.
encodeBase64String
(
DigestUtils
.
md5Hex
(
plainText
).
getBytes
());
}
}
}
}
src/main/java/com/starcharge/wios/controller/WallboxApplyController.java
查看文件 @
dbb71eb5
...
@@ -191,8 +191,7 @@ public class WallboxApplyController {
...
@@ -191,8 +191,7 @@ public class WallboxApplyController {
public
BaseResponse
<
Object
>
getTrace
(
@PathVariable
(
"id"
)
String
id
)
{
public
BaseResponse
<
Object
>
getTrace
(
@PathVariable
(
"id"
)
String
id
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"mailNo"
,
id
);
paramMap
.
put
(
"mailNo"
,
id
);
String
rest
=
depponClient
.
newTraceQuery
(
JSON
.
toJSONString
(
paramMap
));
return
new
BaseResponse
<>(
JSON
.
parseObject
(
depponClient
.
newTraceQuery
(
paramMap
)));
return
new
BaseResponse
<>(
rest
);
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论