记得上下班打卡 | 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
3c765ae4
Commit
3c765ae4
authored
Mar 30, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收钱 goods list
parent
ee537f0b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
6 deletions
+140
-6
IGoblinStoreMgtSqbGoodsService.java
...goblin/service/manage/IGoblinStoreMgtSqbGoodsService.java
+8
-0
GoblinStoreMgtSqbGoodsController.java
...n/controller/manage/GoblinStoreMgtSqbGoodsController.java
+11
-6
GoblinStoreMgtSqbGoodsServiceImpl.java
...ervice/impl/manage/GoblinStoreMgtSqbGoodsServiceImpl.java
+121
-0
No files found.
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/manage/IGoblinStoreMgtSqbGoodsService.java
View file @
3c765ae4
package
com
.
liquidnet
.
service
.
goblin
.
service
.
manage
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSqbPerfGoodsVo
;
...
...
@@ -11,6 +12,13 @@ import java.util.List;
*/
public
interface
IGoblinStoreMgtSqbGoodsService
{
/**
* 根据搜索条件拉取商城商品列表
*
* @return 过滤后的商品列表
*/
ResponseDto
<
List
<
GoblinSqbPerfGoodsVo
>>
getProductList
();
/**
* 商品管理:SPU添加-收钱吧商品
*/
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtSqbGoodsController.java
View file @
3c765ae4
...
...
@@ -25,12 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
...
...
@@ -58,6 +53,16 @@ public class GoblinStoreMgtSqbGoodsController {
@Autowired
private
IGoblinShouQianBaService
goblinShouQianBaService
;
/**
* 查询所有商城及商品列表
* 后端自动拉取所有商城,循环获取每个商城的商品列表,聚合返回前端
*/
@GetMapping
(
"/list"
)
@ApiOperation
(
"查询收钱吧所有商城及商品列表"
)
public
ResponseDto
<
List
<
GoblinSqbPerfGoodsVo
>>
list
()
{
return
goblinstoreMgtSqbGoodsService
.
getProductList
();
}
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
value
=
"SPU添加-收钱吧商品(批量)"
)
@PostMapping
(
"add"
)
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtSqbGoodsServiceImpl.java
View file @
3c765ae4
...
...
@@ -3,15 +3,22 @@ package com.liquidnet.service.goblin.service.impl.manage;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.goblin.config.properties.ShouqianbaProperties
;
import
com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddParam
;
import
com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinSqbGoodsExt
;
import
com.liquidnet.service.goblin.mapper.GoblinSqbGoodsExtMapper
;
import
com.liquidnet.service.goblin.param.shouqianba.request.CommonRequest
;
import
com.liquidnet.service.goblin.param.shouqianba.request.MallListQueryRequest
;
import
com.liquidnet.service.goblin.param.shouqianba.request.MallProductsQueryRequest
;
import
com.liquidnet.service.goblin.param.shouqianba.response.data.MallListQueryData
;
import
com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData
;
import
com.liquidnet.service.goblin.service.IGoblinShouQianBaService
;
import
com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtSqbGoodsService
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinRedisUtils
;
...
...
@@ -43,6 +50,120 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
GoblinMongoUtils
goblinMongoUtils
;
@Autowired
GoblinSqbGoodsExtMapper
goblinSqbGoodsExtMapper
;
@Autowired
private
IGoblinShouQianBaService
goblinShouQianBaService
;
@Autowired
private
ShouqianbaProperties
shouqianbaProperties
;
@Override
public
ResponseDto
<
List
<
GoblinSqbPerfGoodsVo
>>
getProductList
()
{
try
{
List
<
GoblinSqbPerfGoodsVo
>
result
=
new
ArrayList
<>();
List
<
MallListQueryData
>
mallList
=
fetchAllMalls
();
if
(
CollectionUtils
.
isEmpty
(
mallList
))
{
return
ResponseDto
.
success
(
new
ArrayList
<>());
}
// 获取本地已同步的商品 SPU 映射,用于标记同步状态
List
<
String
>
mallSns
=
mallList
.
stream
().
map
(
MallListQueryData:
:
getMallSn
).
distinct
()
.
collect
(
Collectors
.
toList
());
List
<
GoblinSqbGoodsExt
>
syncedGoods
=
goblinSqbGoodsExtMapper
.
selectList
(
new
LambdaQueryWrapper
<
GoblinSqbGoodsExt
>()
.
in
(
GoblinSqbGoodsExt:
:
getMallSn
,
mallSns
)
.
eq
(
GoblinSqbGoodsExt:
:
getDelFlg
,
"0"
));
Set
<
String
>
syncedSqbSpuKeySet
=
syncedGoods
.
stream
()
.
map
(
g
->
g
.
getMallSn
()
+
":"
+
g
.
getSqbSpuId
())
.
collect
(
Collectors
.
toSet
());
for
(
MallListQueryData
mall
:
mallList
)
{
List
<
MallProductsQueryData
>
products
=
fetchAllProducts
(
mall
);
if
(!
CollectionUtils
.
isEmpty
(
products
))
{
for
(
MallProductsQueryData
product
:
products
)
{
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
getGoblinSqbPerfGoodsVo
(
mall
,
product
);
goblinSqbPerfGoodsVo
.
setSynced
(
syncedSqbSpuKeySet
.
contains
(
mall
.
getMallSn
()
+
":"
+
product
.
getSpuId
()));
result
.
add
(
goblinSqbPerfGoodsVo
);
}
}
}
return
ResponseDto
.
success
(
result
);
}
catch
(
Exception
e
)
{
log
.
error
(
"search mall products error"
,
e
);
return
ResponseDto
.
failure
(
"查询收钱吧商品失败: "
+
e
.
getMessage
());
}
}
private
static
GoblinSqbPerfGoodsVo
getGoblinSqbPerfGoodsVo
(
MallListQueryData
mall
,
MallProductsQueryData
product
)
{
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
new
GoblinSqbPerfGoodsVo
();
goblinSqbPerfGoodsVo
.
setMallSn
(
mall
.
getMallSn
());
goblinSqbPerfGoodsVo
.
setMallName
(
mall
.
getMallName
());
goblinSqbPerfGoodsVo
.
setSignature
(
mall
.
getSignature
());
goblinSqbPerfGoodsVo
.
setSpuId
(
product
.
getSpuId
());
goblinSqbPerfGoodsVo
.
setTitle
(
product
.
getTitle
());
goblinSqbPerfGoodsVo
.
setProductIntroduction
(
product
.
getProductIntroduction
());
goblinSqbPerfGoodsVo
.
setConverImages
(
product
.
getConverImages
());
goblinSqbPerfGoodsVo
.
setSkuResults
(
product
.
getSkuResults
());
return
goblinSqbPerfGoodsVo
;
}
/**
* 循环获取所有商城列表(支持游标分页)
*/
private
List
<
MallListQueryData
>
fetchAllMalls
()
{
List
<
MallListQueryData
>
allMalls
=
new
ArrayList
<>();
int
count
=
100
;
String
lastMallSn
=
null
;
while
(
true
)
{
MallListQueryRequest
mallRequest
=
new
MallListQueryRequest
();
mallRequest
.
setAppid
(
shouqianbaProperties
.
getAppId
());
MallListQueryRequest
.
Filter
filter
=
new
MallListQueryRequest
.
Filter
();
filter
.
setSeller
(
buildSeller
());
mallRequest
.
setFilter
(
filter
);
MallListQueryRequest
.
Cursor
cursor
=
new
MallListQueryRequest
.
Cursor
();
cursor
.
setCursorField
(
"id"
);
cursor
.
setCount
(
count
);
// 最大支持1000
cursor
.
setEndCursor
(
lastMallSn
);
mallRequest
.
setCursor
(
cursor
);
MallListQueryRequest
.
Sort
sort
=
new
MallListQueryRequest
.
Sort
();
sort
.
setSortField
(
"id"
);
sort
.
setSort
(
"DESC"
);
mallRequest
.
setSort
(
sort
);
List
<
MallListQueryData
>
batch
=
goblinShouQianBaService
.
queryMallList
(
mallRequest
);
if
(
CollectionUtils
.
isEmpty
(
batch
))
{
break
;
}
allMalls
.
addAll
(
batch
);
lastMallSn
=
batch
.
get
(
batch
.
size
()
-
1
).
getMallSn
();
// 如果拉取数量小于 count,说明是最后一页
if
(
batch
.
size
()
!=
count
)
{
break
;
}
}
return
allMalls
;
}
/**
* 循环获取某个商城下的所有商品列表(支持搜索和游标分页)
*/
private
List
<
MallProductsQueryData
>
fetchAllProducts
(
MallListQueryData
mall
)
{
MallProductsQueryRequest
productRequest
=
new
MallProductsQueryRequest
();
productRequest
.
setAppid
(
shouqianbaProperties
.
getAppId
());
productRequest
.
setSeller
(
buildSeller
());
CommonRequest
.
Mall
mallId
=
new
CommonRequest
.
Mall
();
mallId
.
setMallSn
(
mall
.
getMallSn
());
mallId
.
setSignature
(
mall
.
getSignature
());
productRequest
.
setMallID
(
mallId
);
return
goblinShouQianBaService
.
queryMallProducts
(
productRequest
);
}
private
CommonRequest
.
Seller
buildSeller
()
{
CommonRequest
.
Seller
seller
=
new
CommonRequest
.
Seller
();
seller
.
setMerchantId
(
shouqianbaProperties
.
getMerchantId
());
seller
.
setMerchantUserId
(
shouqianbaProperties
.
getMerchantUserId
());
seller
.
setRole
(
shouqianbaProperties
.
getRole
());
return
seller
;
}
public
void
sqbGoodsAdd
(
GoblinGoodsInfoVo
goodsInfoVo
,
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVoList
)
{
goblinMongoUtils
.
setGoodsInfoVo
(
goodsInfoVo
);
...
...
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