记得上下班打卡 | 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
51a0654c
Commit
51a0654c
authored
Mar 27, 2026
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收钱吧签名
parent
eb5718c7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
22 deletions
+78
-22
MallProductsQueryData.java
...param/shouqianba/response/data/MallProductsQueryData.java
+1
-1
ShouqianbaProperties.java
...ervice/goblin/config/properties/ShouqianbaProperties.java
+18
-0
GoblinShouQianBaServiceImpl.java
...vice/goblin/service/impl/GoblinShouQianBaServiceImpl.java
+42
-14
GoblinSqbGoodsServiceImpl.java
...ervice/goblin/service/impl/GoblinSqbGoodsServiceImpl.java
+4
-4
GoblinShouQianBaServiceImplTest.java
.../service/goblin/test/GoblinShouQianBaServiceImplTest.java
+13
-3
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/param/shouqianba/response/data/MallProductsQueryData.java
View file @
51a0654c
...
...
@@ -24,7 +24,7 @@ public class MallProductsQueryData {
private
String
title
;
@ApiModelProperty
(
value
=
"商品规格"
)
private
List
<
Sku
>
sku
Model
s
;
private
List
<
Sku
>
sku
Result
s
;
@Data
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/config/properties/ShouqianbaProperties.java
View file @
51a0654c
...
...
@@ -17,6 +17,24 @@ public class ShouqianbaProperties {
private
String
appCode
;
/**
* 商户ID
*/
private
String
merchantId
;
/**
* 商户UserID
*/
private
String
merchantUserId
;
/**
* 角色
*/
private
String
role
;
/**
* 公钥
*/
private
String
publicKey
;
private
String
baseApi
;
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinShouQianBaServiceImpl.java
View file @
51a0654c
package
com
.
liquidnet
.
service
.
goblin
.
service
.
impl
;
import
com.fasterxml.jackson.
core.type.TypeReferenc
e
;
import
com.fasterxml.jackson.
annotation.JsonInclud
e
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.
liquidnet.commons.lang.util.HttpUtil
;
import
com.
fasterxml.jackson.databind.SerializationFeature
;
import
com.liquidnet.commons.lang.util.MD5Utils
;
import
com.liquidnet.service.goblin.config.properties.ShouqianbaProperties
;
import
com.liquidnet.service.goblin.param.shouqianba.callback.CallbackParams
;
...
...
@@ -11,9 +11,14 @@ import com.liquidnet.service.goblin.param.shouqianba.response.*;
import
com.liquidnet.service.goblin.param.shouqianba.response.data.*
;
import
com.liquidnet.service.goblin.service.IGoblinShouQianBaService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.converter.StringHttpMessageConverter
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
java.nio.charset.StandardCharsets
;
import
java.security.KeyFactory
;
...
...
@@ -22,7 +27,6 @@ import java.security.Signature;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.TreeMap
;
/**
* 收钱吧对接实现类
...
...
@@ -44,9 +48,21 @@ public class GoblinShouQianBaServiceImpl implements IGoblinShouQianBaService {
}
}
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
private
static
final
ObjectMapper
objectMapper
;
private
static
final
RestTemplate
restTemplate
;
static
{
// 1. 初始化 RestTemplate 并强制设置 String 转换器为 UTF-8
restTemplate
=
new
RestTemplate
();
restTemplate
.
getMessageConverters
().
set
(
1
,
new
StringHttpMessageConverter
(
StandardCharsets
.
UTF_8
));
// 2. 初始化紧凑型 ObjectMapper (签名专用:无空格、无换行、不含空字段)
objectMapper
=
new
ObjectMapper
();
objectMapper
.
configure
(
SerializationFeature
.
INDENT_OUTPUT
,
false
);
objectMapper
.
setSerializationInclusion
(
JsonInclude
.
Include
.
NON_NULL
);
}
/**
* 创建结算明细
*
...
...
@@ -144,7 +160,7 @@ public class GoblinShouQianBaServiceImpl implements IGoblinShouQianBaService {
*/
@Override
public
List
<
MallListQueryData
>
queryMallList
(
MallListQueryRequest
request
)
{
return
executeShouQianBaRequest
(
"/optimus/open/mall/queryMallList"
,
"查询门店列表"
,
request
,
MallListQueryResponse
.
class
);
return
executeShouQianBaRequest
(
"/optimus/
core/
open/mall/queryMallList"
,
"查询门店列表"
,
request
,
MallListQueryResponse
.
class
);
}
/**
...
...
@@ -155,7 +171,7 @@ public class GoblinShouQianBaServiceImpl implements IGoblinShouQianBaService {
*/
@Override
public
List
<
MallProductsQueryData
>
queryMallProducts
(
MallProductsQueryRequest
request
)
{
return
executeShouQianBaRequest
(
"/optimus/open/mall/queryMallProducts"
,
"查询门店商品"
,
request
,
MallProductsQueryResponse
.
class
);
return
executeShouQianBaRequest
(
"/optimus/
core/
open/mall/queryMallProducts"
,
"查询门店商品"
,
request
,
MallProductsQueryResponse
.
class
);
}
/**
...
...
@@ -168,18 +184,30 @@ public class GoblinShouQianBaServiceImpl implements IGoblinShouQianBaService {
try
{
// body进行序列化成TreeMap以后 最后转成json(为了排序稳定)
TreeMap
<
String
,
Object
>
map
=
objectMapper
.
convertValue
(
request
,
new
TypeReference
<
TreeMap
<
String
,
Object
>>()
{
}
);
String
requestBody
=
objectMapper
.
writeValueAsString
(
map
);
// TreeMap<String, Object> map = objectMapper.convertValue(
// request,
// new TypeReference<TreeMap<String, Object>>() {
// }
// );
String
requestBody
=
objectMapper
.
writeValueAsString
(
request
);
// 去除可能存在的空格和换行符,以保证签名通过
log
.
info
(
"request body: {}"
,
requestBody
);
// 构建请求头(添加签名参数)
final
String
sign
=
getSign
(
requestBody
);
log
.
info
(
"request header: {}"
,
sign
);
MultiValueMap
<
String
,
String
>
headers
=
new
LinkedMultiValueMap
<>();
headers
.
add
(
"Authorization"
,
getSign
(
requestBody
));
headers
.
add
(
"Authorization"
,
sign
);
headers
.
add
(
"Content-Type"
,
"application/json"
);
headers
.
add
(
"X-env-flag"
,
"41508"
);
// 4. 发送请求
// 注意:传入的是 String jsonBody,接收的也是 String.class,确保不被二次处理
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
requestBody
,
headers
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
entity
,
String
.
class
);
String
responseStr
=
HttpUtil
.
postJson
(
url
,
requestBody
,
headers
);
String
responseStr
=
responseEntity
.
getBody
(
);
log
.
info
(
"[收钱吧] {}, 响应体: {}"
,
businessName
,
responseStr
);
// 转换响应报文
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinSqbGoodsServiceImpl.java
View file @
51a0654c
...
...
@@ -123,7 +123,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
List
<
MallProductsQueryData
>
products
=
goblinShouQianBaService
.
queryMallProducts
(
productRequest
);
if
(!
CollectionUtils
.
isEmpty
(
products
))
{
for
(
MallProductsQueryData
product
:
products
)
{
List
<
MallProductsQueryData
.
Sku
>
skus
=
product
.
getSku
Model
s
();
List
<
MallProductsQueryData
.
Sku
>
skus
=
product
.
getSku
Result
s
();
if
(
CollectionUtils
.
isEmpty
(
skus
))
{
result
.
add
(
buildPerfGoodsVo
(
product
,
null
));
}
else
{
...
...
@@ -211,7 +211,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
goblinstoreMgtGoodsService
.
goodsAdd
(
goodsInfoVo
,
goodsSkuInfoVoList
);
// 4. 建立映射
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Model
s
();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Result
s
();
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
String
skuId
=
goodsSkuInfoVoList
.
get
(
0
).
getSkuId
();
goblinSqbGoodsExtMapper
.
insert
(
buildExt
(
goodsInfoVo
.
getSpuId
(),
skuId
,
mallSn
,
sqbProductId
,
sqbProductSn
,
null
,
now
));
...
...
@@ -272,7 +272,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
sqbToSysSkuMap
.
put
(
ext
.
getSqbSkuId
()
!=
null
?
ext
.
getSqbSkuId
()
:
"PLACEHOLDER"
,
ext
.
getSkuId
());
}
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Model
s
();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Result
s
();
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
String
skuId
=
sqbToSysSkuMap
.
get
(
"PLACEHOLDER"
);
if
(
skuId
!=
null
)
processSkuUpdate
(
currentUid
,
storeId
,
skuId
,
productsData
,
null
);
...
...
@@ -366,7 +366,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
param
.
setVirtualFlg
(
"1"
);
List
<
GoblinStoreMgtGoodsAddSkuParam
>
skuParams
=
new
ArrayList
<>();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Model
s
();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSku
Result
s
();
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
skuParams
.
add
(
buildMgtSkuParam
(
productsData
.
getTitle
(),
null
,
productsData
.
getConverImages
()));
}
else
{
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/test/java/com/liquidnet/service/goblin/test/GoblinShouQianBaServiceImplTest.java
View file @
51a0654c
...
...
@@ -31,22 +31,32 @@ public class GoblinShouQianBaServiceImplTest {
CommonRequest
.
Seller
seller
=
new
CommonRequest
.
Seller
();
seller
.
setRole
(
"super_admin"
);
seller
.
setMerchantId
(
"
fd567f94-9a44-4ae5-879f-9acc919d0f89
"
);
seller
.
setMerchantUserId
(
"
42c556cc-1509-4de0-bfc3-dfbcb48eae57
"
);
seller
.
setMerchantId
(
"
1c904b2df056-4afa-a819-0328a4774320
"
);
seller
.
setMerchantUserId
(
"
6ce169d1-1289-4e98-b4a3-ea8b6145046f
"
);
MallListQueryRequest
.
Filter
filter
=
new
MallListQueryRequest
.
Filter
();
filter
.
setSeller
(
seller
);
MallListQueryRequest
.
Cursor
cursor
=
new
MallListQueryRequest
.
Cursor
();
cursor
.
setCount
(
10
);
cursor
.
setCursorField
(
"id"
);
MallListQueryRequest
.
Sort
sort
=
new
MallListQueryRequest
.
Sort
();
sort
.
setSort
(
"DESC"
);
sort
.
setSortField
(
"id"
);
MallListQueryRequest
mallListQueryRequest
=
new
MallListQueryRequest
();
mallListQueryRequest
.
setAppid
(
"2025082700005615"
);
mallListQueryRequest
.
setFilter
(
filter
);
mallListQueryRequest
.
setCursor
(
cursor
);
mallListQueryRequest
.
setSort
(
sort
);
List
<
MallListQueryData
>
mallListQueryData
=
goblinShouQianBaService
.
queryMallList
(
mallListQueryRequest
);
Assert
.
assertNotNull
(
mallListQueryData
);
}
@Test
public
void
queryMallProducts
(){
public
void
queryMallProducts
Test
(){
CommonRequest
.
Seller
seller
=
new
CommonRequest
.
Seller
();
seller
.
setMerchantId
(
"1c904b2d-f056-4afa-a819-0328a4774320"
);
...
...
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