记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
董敬伟
liquidnet-bus-v1
Commits
c05edae9
Commit
c05edae9
authored
Nov 14, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp提交
parent
be95e9a9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
140 deletions
+44
-140
ErpWdtClient.java
...n/java/com/liquidnet/service/erp/config/ErpWdtClient.java
+4
-9
application-dev.yml
liquidnet-bus-config/liquidnet-config/application-dev.yml
+20
-13
application-test.yml
liquidnet-bus-config/liquidnet-config/application-test.yml
+20
-13
ErpUtils.java
...c/main/java/com/liquidnet/service/erp/utils/ErpUtils.java
+0
-105
No files found.
liquidnet-bus-common/liquident-common-erp/src/main/java/com/liquidnet/service/erp/config/ErpWdtClient.java
View file @
c05edae9
...
@@ -16,13 +16,13 @@ import java.util.*;
...
@@ -16,13 +16,13 @@ import java.util.*;
@Slf4j
@Slf4j
public
class
ErpWdtClient
{
public
class
ErpWdtClient
{
@Value
(
"${liquidnet.erp.api.appKey}"
)
@Value
(
"${liquidnet.erp.
wdt.
api.appKey}"
)
private
String
appkey
;
private
String
appkey
;
@Value
(
"${liquidnet.erp.api.sid}"
)
@Value
(
"${liquidnet.erp.
wdt.
api.sid}"
)
private
String
sid
;
private
String
sid
;
@Value
(
"${liquidnet.erp.api.appsecret}"
)
@Value
(
"${liquidnet.erp.
wdt.
api.appsecret}"
)
private
String
appSecret
;
private
String
appSecret
;
@Value
(
"${liquidnet.erp.api.appsecret}"
)
@Value
(
"${liquidnet.erp.
wdt.
api.appsecret}"
)
private
String
baseUrl
;
private
String
baseUrl
;
/**
/**
...
@@ -89,11 +89,6 @@ public class ErpWdtClient {
...
@@ -89,11 +89,6 @@ public class ErpWdtClient {
map
.
put
(
"page_size"
,
"40"
);
map
.
put
(
"page_size"
,
"40"
);
map
.
put
(
"sid"
,
"test2"
);
map
.
put
(
"sid"
,
"test2"
);
map
.
put
(
"timestamp"
,
"1470042310"
);
map
.
put
(
"timestamp"
,
"1470042310"
);
// String a = execute("http://www.baidu.com/",map);
// System.out.println(a);
System
.
out
.
println
(
"ad4e6fe037ea6e3ba4768317be9d1309"
);
}
}
}
}
liquidnet-bus-config/liquidnet-config/application-dev.yml
View file @
c05edae9
...
@@ -240,7 +240,14 @@ liquidnet:
...
@@ -240,7 +240,14 @@ liquidnet:
expressType
:
2
# 默认顺丰特快
expressType
:
2
# 默认顺丰特快
depositumInfo
:
演出纸质票
depositumInfo
:
演出纸质票
erp
:
erp
:
wdt
:
url
:
https://sandbox.wangdian.cn/openapi2/
url
:
https://sandbox.wangdian.cn/openapi2/
stock-query
:
stock_query.php
#(增量查询库存)
trade_push
:
trade_push.php
#(创建原始订单)建议每间隔(5~10)分钟,将商城积累的订单集中推送,每次请求包含订单条数建议不超过50条(1条订单由“trade_list+order_list”构成),如果累积量超过了50条,分多次请求。
logistics_sync_query
:
logistics_sync_query.php
#(查询物流同步) 查询后需要调用 logistics_sync_ack 应答
logistics_sync_ack
:
logistics_sync_ack.php
# (物流同步回写) 查询后需要调用 logistics_sync_ack 应答
api_goods_stock_change_query
:
api_goods_stock_change_query.php
#(查询库存同步)建议间隔时间3~5分钟查询一次,集中获取待同步数据,注意上一次回写完成以后,再从数据池获取待同步的数据。 查询后需要调用 api_goods_stock_change_ack 应答
api_goods_stock_change_ack
:
api_goods_stock_change_ack.php
# (库存同步回写) 查询后需要调用 api_goods_stock_change_ack 应答
api
:
api
:
sid
:
apidevnew2
sid
:
apidevnew2
appKey
:
mdtk2-test
appKey
:
mdtk2-test
...
...
liquidnet-bus-config/liquidnet-config/application-test.yml
View file @
c05edae9
...
@@ -240,7 +240,14 @@ liquidnet:
...
@@ -240,7 +240,14 @@ liquidnet:
expressType
:
2
# 默认顺丰特快
expressType
:
2
# 默认顺丰特快
depositumInfo
:
depositumInfo
:
erp
:
erp
:
wdt
:
url
:
https://sandbox.wangdian.cn/openapi2/
url
:
https://sandbox.wangdian.cn/openapi2/
stock-query
:
stock_query.php
#(增量查询库存)
trade_push
:
trade_push.php
#(创建原始订单)建议每间隔(5~10)分钟,将商城积累的订单集中推送,每次请求包含订单条数建议不超过50条(1条订单由“trade_list+order_list”构成),如果累积量超过了50条,分多次请求。
logistics_sync_query
:
logistics_sync_query.php
#(查询物流同步) 查询后需要调用 logistics_sync_ack 应答
logistics_sync_ack
:
logistics_sync_ack.php
# (物流同步回写) 查询后需要调用 logistics_sync_ack 应答
api_goods_stock_change_query
:
api_goods_stock_change_query.php
#(查询库存同步)建议间隔时间3~5分钟查询一次,集中获取待同步数据,注意上一次回写完成以后,再从数据池获取待同步的数据。 查询后需要调用 api_goods_stock_change_ack 应答
api_goods_stock_change_ack
:
api_goods_stock_change_ack.php
# (库存同步回写) 查询后需要调用 api_goods_stock_change_ack 应答
api
:
api
:
sid
:
apidevnew2
sid
:
apidevnew2
appKey
:
mdtk2-test
appKey
:
mdtk2-test
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/erp/utils/ErpUtils.java
deleted
100644 → 0
View file @
be95e9a9
package
com
.
liquidnet
.
service
.
erp
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.HttpUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.MD5Utils
;
import
com.liquidnet.service.platform.utils.JSONUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.MultiValueMap
;
import
java.util.*
;
@Component
@Slf4j
public
class
ErpUtils
{
@Value
(
"${liquidnet.erp.api.appKey}"
)
private
String
appkey
;
@Value
(
"${liquidnet.erp.api.sid}"
)
private
String
sid
;
@Value
(
"${liquidnet.erp.api.appsecret}"
)
private
String
appSecret
;
@Value
(
"${liquidnet.erp.api.appsecret}"
)
private
String
baseUrl
;
/**
* 获取 erp的sign
*
* @param map 请求参数
* @param appSecret 秘钥
* @return
*/
private
String
getErpSign
(
Map
<
String
,
String
>
map
,
String
appSecret
)
{
String
finalStr
=
""
;
map
=
sortMapByKey
(
map
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
map
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
();
String
key01
=
leftFillChar
(
key
,
"0"
,
2
).
concat
(
"-"
).
concat
(
key
);
String
value01
=
leftFillChar
(
value
,
"0"
,
4
).
concat
(
"-"
).
concat
(
value
);
String
data
=
key01
.
concat
(
":"
).
concat
(
value01
).
concat
(
";"
);
finalStr
=
finalStr
.
concat
(
data
);
}
finalStr
=
finalStr
.
substring
(
0
,
finalStr
.
length
()
-
1
).
concat
(
appSecret
);
return
MD5Utils
.
md5
(
finalStr
);
}
// 根据key 排序 hash
private
HashMap
<
String
,
String
>
sortMapByKey
(
Map
<
String
,
String
>
map
)
{
LinkedHashMap
<
String
,
String
>
finalMap
=
CollectionUtil
.
linkMapStringString
();
List
<
String
>
ll
=
new
ArrayList
<>(
map
.
keySet
());
Collections
.
sort
(
ll
);
for
(
String
str
:
ll
)
{
finalMap
.
put
(
str
,
map
.
get
(
str
));
}
return
finalMap
;
}
// sign补位算法
private
String
leftFillChar
(
String
str
,
String
charStr
,
int
a
)
{
String
length
=
str
.
length
()
+
""
;
for
(
int
i
=
length
.
length
();
i
<
a
;
i
++)
{
length
=
charStr
.
concat
(
length
);
}
return
length
;
}
/**
* 旺店通erp接口访问
* @param url 旺店通 具体url地址[不包含前缀]
* @param param 请求参数
* @return
*/
public
String
execute
(
String
url
,
Map
<
String
,
String
>
param
)
{
MultiValueMap
<
String
,
String
>
header
=
CollectionUtil
.
linkedMultiValueMapStringString
();
header
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueMapStringString
();
param
.
put
(
"appkey"
,
this
.
appkey
);
param
.
put
(
"sid"
,
this
.
sid
);
param
.
put
(
"timestamp"
,
Long
.
toString
(
System
.
currentTimeMillis
()
/
1000
));
param
.
put
(
"sign"
,
getErpSign
(
param
,
appSecret
));
params
.
setAll
(
param
);
return
HttpUtil
.
post
(
baseUrl
.
concat
(
url
),
params
,
header
);
}
public
static
void
main
(
String
[]
args
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"appkey"
,
"test2-xx"
);
map
.
put
(
"page_no"
,
"0"
);
map
.
put
(
"end_time"
,
"2016-08-01 13:00:00"
);
map
.
put
(
"start_time"
,
"2016-08-01 12:00:00"
);
map
.
put
(
"page_size"
,
"40"
);
map
.
put
(
"sid"
,
"test2"
);
map
.
put
(
"timestamp"
,
"1470042310"
);
// String a = execute("http://www.baidu.com/",map);
// System.out.println(a);
System
.
out
.
println
(
"ad4e6fe037ea6e3ba4768317be9d1309"
);
}
}
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