记得上下班打卡 | 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
3b0d7439
Commit
3b0d7439
authored
Mar 30, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收钱 商品同步
parent
30cbfdda
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
249 additions
and
148 deletions
+249
-148
sqb_goods_integration.sql
docu/sqb_goods_integration.sql
+7
-2
GoblinSqbPerfGoodsVo.java
...liquidnet/service/goblin/dto/vo/GoblinSqbPerfGoodsVo.java
+6
-0
IGoblinSqbGoodsService.java
...uidnet/service/goblin/service/IGoblinSqbGoodsService.java
+2
-2
GoblinSqbGoodsExt.java
...om/liquidnet/service/goblin/entity/GoblinSqbGoodsExt.java
+16
-5
GoblinSqbGoodsController.java
...t/service/goblin/controller/GoblinSqbGoodsController.java
+3
-3
GoblinSqbGoodsServiceImpl.java
...ervice/goblin/service/impl/GoblinSqbGoodsServiceImpl.java
+209
-132
ObjectUtil.java
...in/java/com/liquidnet/service/goblin/util/ObjectUtil.java
+6
-4
No files found.
docu/sqb_goods_integration.sql
View file @
3b0d7439
...
@@ -17,8 +17,8 @@ CREATE TABLE `goblin_sqb_goods_ext` (
...
@@ -17,8 +17,8 @@ CREATE TABLE `goblin_sqb_goods_ext` (
`spu_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'关联 goblin_goods.spu_id'
,
`spu_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'关联 goblin_goods.spu_id'
,
`sku_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'关联 goblin_goods_sku.sku_id'
,
`sku_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'关联 goblin_goods_sku.sku_id'
,
`mall_sn`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'所属收钱吧商城编号'
,
`mall_sn`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'所属收钱吧商城编号'
,
`s
qb_product_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'收钱吧商品ID
'
,
`s
ignature`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'商城密钥
'
,
`sqb_
product_sn`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'收钱吧商品编号
'
,
`sqb_
spu_id`
VARCHAR
(
64
)
NOT
NULL
COMMENT
'收钱吧SPU ID
'
,
`sqb_sku_id`
VARCHAR
(
64
)
COMMENT
'收钱吧SKU ID'
,
`sqb_sku_id`
VARCHAR
(
64
)
COMMENT
'收钱吧SKU ID'
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`created_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
,
`updated_at`
timestamp
NULL
DEFAULT
NULL
,
...
@@ -77,3 +77,8 @@ CREATE TABLE `goblin_sqb_performance_config` (
...
@@ -77,3 +77,8 @@ CREATE TABLE `goblin_sqb_performance_config` (
PRIMARY
KEY
(
`mid`
),
PRIMARY
KEY
(
`mid`
),
UNIQUE
KEY
`uk_perf_id`
(
`performances_id`
)
UNIQUE
KEY
`uk_perf_id`
(
`performances_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'收钱吧演出级全局配置'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'收钱吧演出级全局配置'
;
-- 2026-03-30 增加逻辑删除及审计建议字段
ALTER
TABLE
`goblin_sqb_goods_ext`
ADD
COLUMN
`updated_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'更新人'
AFTER
`updated_at`
;
ALTER
TABLE
`goblin_sqb_goods_ext`
ADD
COLUMN
`del_flg`
char
(
1
)
DEFAULT
'0'
COMMENT
'删除标记[0-未删除|1-删除]'
AFTER
`updated_by`
;
ALTER
TABLE
`goblin_sqb_goods_ext`
ADD
COLUMN
`deleted_by`
varchar
(
64
)
DEFAULT
NULL
COMMENT
'删除人'
AFTER
`del_flg`
;
ALTER
TABLE
`goblin_sqb_goods_ext`
ADD
COLUMN
`deleted_at`
timestamp
NULL
DEFAULT
NULL
COMMENT
'删除时间'
AFTER
`deleted_by`
;
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/dto/vo/GoblinSqbPerfGoodsVo.java
View file @
3b0d7439
...
@@ -18,6 +18,9 @@ public class GoblinSqbPerfGoodsVo implements Serializable {
...
@@ -18,6 +18,9 @@ public class GoblinSqbPerfGoodsVo implements Serializable {
@ApiModelProperty
(
"商城名称"
)
@ApiModelProperty
(
"商城名称"
)
private
String
mallName
;
private
String
mallName
;
@ApiModelProperty
(
"商城签名"
)
private
String
signature
;
@ApiModelProperty
(
value
=
"商品spuId"
)
@ApiModelProperty
(
value
=
"商品spuId"
)
private
String
spuId
;
private
String
spuId
;
...
@@ -33,6 +36,9 @@ public class GoblinSqbPerfGoodsVo implements Serializable {
...
@@ -33,6 +36,9 @@ public class GoblinSqbPerfGoodsVo implements Serializable {
@ApiModelProperty
(
value
=
"商品规格"
)
@ApiModelProperty
(
value
=
"商品规格"
)
private
List
<
MallProductsQueryData
.
Sku
>
skuResults
;
private
List
<
MallProductsQueryData
.
Sku
>
skuResults
;
@ApiModelProperty
(
"是否已同步"
)
private
Boolean
synced
;
@Data
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
...
...
liquidnet-bus-api/liquidnet-service-goblin-api/src/main/java/com/liquidnet/service/goblin/service/IGoblinSqbGoodsService.java
View file @
3b0d7439
...
@@ -25,7 +25,7 @@ public interface IGoblinSqbGoodsService {
...
@@ -25,7 +25,7 @@ public interface IGoblinSqbGoodsService {
* @param items 待新增商品列表
* @param items 待新增商品列表
* @return 结果
* @return 结果
*/
*/
ResponseDto
<
String
>
addGoods
(
String
storeId
,
List
<
GoblinSqb
GoodsSyncParam
>
items
);
ResponseDto
<
String
>
addGoods
(
String
storeId
,
List
<
GoblinSqb
PerfGoodsVo
>
items
);
/**
/**
* 批量更新商品到 goblin 系统(仅更新已存在)
* 批量更新商品到 goblin 系统(仅更新已存在)
...
@@ -34,7 +34,7 @@ public interface IGoblinSqbGoodsService {
...
@@ -34,7 +34,7 @@ public interface IGoblinSqbGoodsService {
* @param items 待更新商品列表
* @param items 待更新商品列表
* @return 结果
* @return 结果
*/
*/
ResponseDto
<
String
>
updateGoods
(
String
storeId
,
List
<
GoblinSqb
GoodsSyncParam
>
items
);
ResponseDto
<
String
>
updateGoods
(
String
storeId
,
List
<
GoblinSqb
PerfGoodsVo
>
items
);
/**
/**
* 查询演出关联商品列表(先查 Redis 缓存,未命中则查 MySQL 并写入缓存)
* 查询演出关联商品列表(先查 Redis 缓存,未命中则查 MySQL 并写入缓存)
...
...
liquidnet-bus-do/liquidnet-service-goblin-do/src/main/java/com/liquidnet/service/goblin/entity/GoblinSqbGoodsExt.java
View file @
3b0d7439
...
@@ -43,22 +43,33 @@ public class GoblinSqbGoodsExt implements Serializable {
...
@@ -43,22 +43,33 @@ public class GoblinSqbGoodsExt implements Serializable {
private
String
mallSn
;
private
String
mallSn
;
/**
/**
*
收钱吧商品ID
*
商城签名
*/
*/
private
String
s
qbProductId
;
private
String
s
ignature
;
/**
/**
* 收钱吧商品
编号
* 收钱吧商品
ID
*/
*/
private
String
sqb
ProductSn
;
private
String
sqb
SpuId
;
/**
/**
* 收钱吧
SKU ID
* 收钱吧
规格ID (skuId)
*/
*/
private
String
sqbSkuId
;
private
String
sqbSkuId
;
private
LocalDateTime
createdAt
;
private
LocalDateTime
createdAt
;
private
String
updatedBy
;
private
LocalDateTime
updatedAt
;
private
LocalDateTime
updatedAt
;
/**
* 删除标记[0-未删除|1-删除]
*/
private
String
delFlg
;
private
String
deletedBy
;
private
LocalDateTime
deletedAt
;
}
}
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/GoblinSqbGoodsController.java
View file @
3b0d7439
...
@@ -21,7 +21,7 @@ import java.util.List;
...
@@ -21,7 +21,7 @@ import java.util.List;
@Slf4j
@Slf4j
@Api
(
tags
=
"收钱吧商品同步"
)
@Api
(
tags
=
"收钱吧商品同步"
)
@RestController
@RestController
@RequestMapping
(
"/
goblin/
sqb/goods"
)
@RequestMapping
(
"/sqb/goods"
)
public
class
GoblinSqbGoodsController
{
public
class
GoblinSqbGoodsController
{
@Autowired
@Autowired
...
@@ -46,7 +46,7 @@ public class GoblinSqbGoodsController {
...
@@ -46,7 +46,7 @@ public class GoblinSqbGoodsController {
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
@ApiOperation
(
"批量新增收钱吧商品"
)
@ApiOperation
(
"批量新增收钱吧商品"
)
public
ResponseDto
<
String
>
addGoods
(
@RequestParam
(
"storeId"
)
String
storeId
,
public
ResponseDto
<
String
>
addGoods
(
@RequestParam
(
"storeId"
)
String
storeId
,
@RequestBody
@Validated
List
<
GoblinSqb
GoodsSyncParam
>
items
)
{
@RequestBody
@Validated
List
<
GoblinSqb
PerfGoodsVo
>
items
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
log
.
warn
(
"[收钱吧商品同步] 批量新增: 无权操作该店铺, uid={}, storeId={}"
,
currentUid
,
storeId
);
log
.
warn
(
"[收钱吧商品同步] 批量新增: 无权操作该店铺, uid={}, storeId={}"
,
currentUid
,
storeId
);
...
@@ -61,7 +61,7 @@ public class GoblinSqbGoodsController {
...
@@ -61,7 +61,7 @@ public class GoblinSqbGoodsController {
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
@ApiOperation
(
"批量更新收钱吧商品"
)
@ApiOperation
(
"批量更新收钱吧商品"
)
public
ResponseDto
<
String
>
updateGoods
(
@RequestParam
(
"storeId"
)
String
storeId
,
public
ResponseDto
<
String
>
updateGoods
(
@RequestParam
(
"storeId"
)
String
storeId
,
@RequestBody
@Validated
List
<
GoblinSqb
GoodsSyncParam
>
items
)
{
@RequestBody
@Validated
List
<
GoblinSqb
PerfGoodsVo
>
items
)
{
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
if
(!
goblinRedisUtils
.
hasStoreId
(
currentUid
,
storeId
))
{
log
.
warn
(
"[收钱吧商品同步] 批量更新: 无权操作该店铺, uid={}, storeId={}"
,
currentUid
,
storeId
);
log
.
warn
(
"[收钱吧商品同步] 批量更新: 无权操作该店铺, uid={}, storeId={}"
,
currentUid
,
storeId
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/GoblinSqbGoodsServiceImpl.java
View file @
3b0d7439
...
@@ -2,6 +2,9 @@ package com.liquidnet.service.goblin.service.impl;
...
@@ -2,6 +2,9 @@ package com.liquidnet.service.goblin.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsAddParam
;
import
com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsEditSkuParam
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSqbPerfGoodsVo
;
import
com.liquidnet.service.goblin.dto.vo.GoblinSqbPerfGoodsVo
;
...
@@ -21,7 +24,6 @@ import com.liquidnet.service.goblin.param.shouqianba.request.MallListQueryReques
...
@@ -21,7 +24,6 @@ import com.liquidnet.service.goblin.param.shouqianba.request.MallListQueryReques
import
com.liquidnet.service.goblin.param.shouqianba.request.MallProductsQueryRequest
;
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.MallListQueryData
;
import
com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData
;
import
com.liquidnet.service.goblin.param.shouqianba.response.data.MallProductsQueryData
;
import
com.liquidnet.service.goblin.param.shouqianba.request.GoblinSqbGoodsSyncParam
;
import
com.liquidnet.service.goblin.service.IGoblinShouQianBaService
;
import
com.liquidnet.service.goblin.service.IGoblinShouQianBaService
;
import
com.liquidnet.service.goblin.service.IGoblinSqbGoodsService
;
import
com.liquidnet.service.goblin.service.IGoblinSqbGoodsService
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
import
com.liquidnet.service.goblin.util.GoblinMongoUtils
;
...
@@ -86,26 +88,6 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -86,26 +88,6 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
@Autowired
@Autowired
private
IGoblinstoreMgtGoodsService
goblinstoreMgtGoodsService
;
private
IGoblinstoreMgtGoodsService
goblinstoreMgtGoodsService
;
private
MallProductsQueryData
querySqbProduct
(
String
mallSn
,
String
mallSignature
,
String
sqbProductId
)
{
if
(
StringUtils
.
isEmpty
(
mallSn
))
return
null
;
MallProductsQueryRequest
request
=
new
MallProductsQueryRequest
();
request
.
setAppid
(
shouqianbaProperties
.
getAppId
());
request
.
setSeller
(
buildSeller
());
CommonRequest
.
Mall
mallId
=
new
CommonRequest
.
Mall
();
mallId
.
setMallSn
(
mallSn
);
mallId
.
setSignature
(
mallSignature
);
request
.
setMallID
(
mallId
);
List
<
MallProductsQueryData
>
dataList
=
goblinShouQianBaService
.
queryMallProducts
(
request
);
if
(!
CollectionUtils
.
isEmpty
(
dataList
))
{
for
(
MallProductsQueryData
data
:
dataList
)
{
if
(
sqbProductId
.
equals
(
data
.
getSpuId
()))
return
data
;
}
}
return
null
;
}
@Override
@Override
public
ResponseDto
<
List
<
GoblinSqbPerfGoodsVo
>>
getProductList
()
{
public
ResponseDto
<
List
<
GoblinSqbPerfGoodsVo
>>
getProductList
()
{
try
{
try
{
...
@@ -115,11 +97,24 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -115,11 +97,24 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
return
ResponseDto
.
success
(
new
ArrayList
<>());
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
)
{
for
(
MallListQueryData
mall
:
mallList
)
{
List
<
MallProductsQueryData
>
products
=
fetchAllProducts
(
mall
);
List
<
MallProductsQueryData
>
products
=
fetchAllProducts
(
mall
);
if
(!
CollectionUtils
.
isEmpty
(
products
))
{
if
(!
CollectionUtils
.
isEmpty
(
products
))
{
for
(
MallProductsQueryData
product
:
products
)
{
for
(
MallProductsQueryData
product
:
products
)
{
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
getGoblinSqbPerfGoodsVo
(
mall
,
product
);
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
getGoblinSqbPerfGoodsVo
(
mall
,
product
);
goblinSqbPerfGoodsVo
.
setSynced
(
syncedSqbSpuKeySet
.
contains
(
mall
.
getMallSn
()
+
":"
+
product
.
getSpuId
()));
result
.
add
(
goblinSqbPerfGoodsVo
);
result
.
add
(
goblinSqbPerfGoodsVo
);
}
}
}
}
...
@@ -136,6 +131,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -136,6 +131,7 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
new
GoblinSqbPerfGoodsVo
();
GoblinSqbPerfGoodsVo
goblinSqbPerfGoodsVo
=
new
GoblinSqbPerfGoodsVo
();
goblinSqbPerfGoodsVo
.
setMallSn
(
mall
.
getMallSn
());
goblinSqbPerfGoodsVo
.
setMallSn
(
mall
.
getMallSn
());
goblinSqbPerfGoodsVo
.
setMallName
(
mall
.
getMallName
());
goblinSqbPerfGoodsVo
.
setMallName
(
mall
.
getMallName
());
goblinSqbPerfGoodsVo
.
setSignature
(
mall
.
getSignature
());
goblinSqbPerfGoodsVo
.
setSpuId
(
product
.
getSpuId
());
goblinSqbPerfGoodsVo
.
setSpuId
(
product
.
getSpuId
());
goblinSqbPerfGoodsVo
.
setTitle
(
product
.
getTitle
());
goblinSqbPerfGoodsVo
.
setTitle
(
product
.
getTitle
());
goblinSqbPerfGoodsVo
.
setProductIntroduction
(
product
.
getProductIntroduction
());
goblinSqbPerfGoodsVo
.
setProductIntroduction
(
product
.
getProductIntroduction
());
...
@@ -200,35 +196,31 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -200,35 +196,31 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseDto
<
String
>
addGoods
(
String
storeId
,
List
<
GoblinSqb
GoodsSyncParam
>
items
)
{
public
ResponseDto
<
String
>
addGoods
(
String
storeId
,
List
<
GoblinSqb
PerfGoodsVo
>
items
)
{
if
(
CollectionUtils
.
isEmpty
(
items
))
if
(
CollectionUtils
.
isEmpty
(
items
))
return
ResponseDto
.
failure
(
"新增商品列表不能为空"
);
return
ResponseDto
.
failure
(
"新增商品列表不能为空"
);
int
newCount
=
0
,
existCount
=
0
,
failCount
=
0
;
int
newCount
=
0
,
existCount
=
0
,
failCount
=
0
;
String
currentUid
=
"system"
;
String
currentUid
=
"system"
;
for
(
GoblinSqb
GoodsSyncParam
item
:
items
)
{
for
(
GoblinSqb
PerfGoodsVo
item
:
items
)
{
String
sqb
ProductId
=
item
.
getSqbProductId
(),
sqbProductSn
=
item
.
getSqbProductSn
(),
String
sqb
Spuid
=
item
.
getSpuId
(),
mallSn
=
item
.
getMallSn
(),
mallSignature
=
item
.
get
Mall
Signature
();
mallSn
=
item
.
getMallSn
(),
mallSignature
=
item
.
getSignature
();
if
(
StringUtils
.
isEmpty
(
sqb
ProductI
d
))
{
if
(
StringUtils
.
isEmpty
(
sqb
Spui
d
))
{
failCount
++;
failCount
++;
continue
;
continue
;
}
}
try
{
try
{
LambdaQueryWrapper
<
GoblinSqbGoodsExt
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
GoblinSqbGoodsExt
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
GoblinSqbGoodsExt:
:
getSqbProductId
,
sqbProductId
);
queryWrapper
.
eq
(
GoblinSqbGoodsExt:
:
getSqbSpuId
,
sqbSpuid
)
.
eq
(
GoblinSqbGoodsExt:
:
getMallSn
,
mallSn
)
.
eq
(
GoblinSqbGoodsExt:
:
getDelFlg
,
"0"
);
if
(
goblinSqbGoodsExtMapper
.
selectCount
(
queryWrapper
)
>
0
)
{
if
(
goblinSqbGoodsExtMapper
.
selectCount
(
queryWrapper
)
>
0
)
{
existCount
++;
existCount
++;
continue
;
continue
;
}
}
MallProductsQueryData
productsData
=
querySqbProduct
(
mallSn
,
mallSignature
,
sqbProductId
);
if
(
null
==
productsData
)
{
failCount
++;
continue
;
}
// 1. 组装 AddParam
// 1. 组装 AddParam
GoblinStoreMgtGoodsAddParam
addParam
=
buildMgtGoodsAddParam
(
storeId
,
productsData
);
GoblinStoreMgtGoodsAddParam
addParam
=
buildMgtGoodsAddParam
(
storeId
,
item
);
// 2. 初始化 VOs
// 2. 初始化 VOs
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
...
@@ -240,34 +232,31 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -240,34 +232,31 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
ArrayList
<
GoblinGoodsSpecVo
>
goodsSpecVoList
=
ObjectUtil
.
getGoblinGoodsSpecVoArrayList
();
ArrayList
<
GoblinGoodsSpecVo
>
goodsSpecVoList
=
ObjectUtil
.
getGoblinGoodsSpecVoArrayList
();
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVoList
=
ObjectUtil
.
getGoblinGoodsSkuInfoVoArrayList
();
List
<
GoblinGoodsSkuInfoVo
>
goodsSkuInfoVoList
=
ObjectUtil
.
getGoblinGoodsSkuInfoVoArrayList
();
List
<
GoblinSqbGoodsExt
>
goblinSqbGoodsExtsList
=
ObjectUtil
.
getGoblinSqbGoodsExtArrayList
();
addParam
.
initGoodsSkuInfoVo
(
goodsInfoVo
,
goodsSkuInfoVoList
,
goodsSpecVoList
);
addParam
.
initGoodsSkuInfoVo
(
goodsInfoVo
,
goodsSkuInfoVoList
,
goodsSpecVoList
);
// 3. 建立并保存映射关系
for
(
GoblinGoodsSkuInfoVo
skuVo
:
goodsSkuInfoVoList
)
{
for
(
GoblinGoodsSkuInfoVo
skuVo
:
goodsSkuInfoVoList
)
{
skuVo
.
setSkuType
(
33
);
skuVo
.
setSkuType
(
33
);
skuVo
.
setVirtualFlg
(
"1"
);
skuVo
.
setVirtualFlg
(
"1"
);
skuVo
.
setCreatedBy
(
currentUid
);
skuVo
.
setCreatedBy
(
currentUid
);
skuVo
.
setCreatedAt
(
now
);
skuVo
.
setCreatedAt
(
now
);
// 使用 skuNo 暂存的 sqbSkuId 建立映射
String
sqbSkuId
=
skuVo
.
getSkuNo
();
goblinSqbGoodsExtsList
.
add
(
buildExt
(
goodsInfoVo
.
getSpuId
(),
skuVo
.
getSkuId
(),
mallSn
,
mallSignature
,
sqbSpuid
,
sqbSkuId
,
now
));
}
}
//
3. 调用管理端 Service 加商
//
4. 调用管理端 Service 加
goblinstoreMgtGoodsService
.
goodsAdd
(
goodsInfoVo
,
goodsSkuInfoVoList
);
goblinstoreMgtGoodsService
.
goodsAdd
(
goodsInfoVo
,
goodsSkuInfoVoList
);
// 4. 建立映射
// 5. 建立映射
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSkuResults
();
for
(
GoblinSqbGoodsExt
goblinSqbGoodsExt
:
goblinSqbGoodsExtsList
)
{
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
goblinSqbGoodsExtMapper
.
insert
(
goblinSqbGoodsExt
);
String
skuId
=
goodsSkuInfoVoList
.
get
(
0
).
getSkuId
();
goblinSqbGoodsExtMapper
.
insert
(
buildExt
(
goodsInfoVo
.
getSpuId
(),
skuId
,
mallSn
,
sqbProductId
,
sqbProductSn
,
null
,
now
));
}
else
{
for
(
int
i
=
0
;
i
<
sqbSkus
.
size
();
i
++)
{
String
skuId
=
goodsSkuInfoVoList
.
get
(
i
).
getSkuId
();
goblinSqbGoodsExtMapper
.
insert
(
buildExt
(
goodsInfoVo
.
getSpuId
(),
skuId
,
mallSn
,
sqbProductId
,
sqbProductSn
,
sqbSkus
.
get
(
i
).
getSkuId
(),
now
));
}
}
}
newCount
++;
newCount
++;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[收钱吧新增商品同步] 异常, sqbProductId={}"
,
sqb
ProductI
d
,
e
);
log
.
error
(
"[收钱吧新增商品同步] 异常, sqbProductId={}"
,
sqb
Spui
d
,
e
);
failCount
++;
failCount
++;
}
}
}
}
...
@@ -276,18 +265,19 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -276,18 +265,19 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseDto
<
String
>
updateGoods
(
String
storeId
,
List
<
GoblinSqb
GoodsSyncParam
>
items
)
{
public
ResponseDto
<
String
>
updateGoods
(
String
storeId
,
List
<
GoblinSqb
PerfGoodsVo
>
items
)
{
if
(
CollectionUtils
.
isEmpty
(
items
))
if
(
CollectionUtils
.
isEmpty
(
items
))
return
ResponseDto
.
failure
(
"更新商品列表不能为空"
);
return
ResponseDto
.
failure
(
"更新商品列表不能为空"
);
int
updateCount
=
0
,
notFoundCount
=
0
,
failCount
=
0
;
int
updateCount
=
0
,
notFoundCount
=
0
,
failCount
=
0
;
String
currentUid
=
"system"
;
String
currentUid
=
"system"
;
for
(
GoblinSqbGoodsSyncParam
item
:
items
)
{
for
(
GoblinSqbPerfGoodsVo
item
:
items
)
{
String
sqbProductId
=
item
.
getSqbProductId
(),
mallSn
=
item
.
getMallSn
(),
String
sqbSpuId
=
item
.
getSpuId
(),
mallSn
=
item
.
getMallSn
();
mallSignature
=
item
.
getMallSignature
();
try
{
try
{
LambdaQueryWrapper
<
GoblinSqbGoodsExt
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
GoblinSqbGoodsExt
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
GoblinSqbGoodsExt:
:
getSqbProductId
,
sqbProductId
);
queryWrapper
.
eq
(
GoblinSqbGoodsExt:
:
getSqbSpuId
,
sqbSpuId
)
.
eq
(
GoblinSqbGoodsExt:
:
getMallSn
,
mallSn
)
.
eq
(
GoblinSqbGoodsExt:
:
getDelFlg
,
"0"
);
List
<
GoblinSqbGoodsExt
>
existingExts
=
goblinSqbGoodsExtMapper
.
selectList
(
queryWrapper
);
List
<
GoblinSqbGoodsExt
>
existingExts
=
goblinSqbGoodsExtMapper
.
selectList
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
existingExts
))
{
if
(
CollectionUtils
.
isEmpty
(
existingExts
))
{
notFoundCount
++;
notFoundCount
++;
...
@@ -301,14 +291,15 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -301,14 +291,15 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
continue
;
continue
;
}
}
MallProductsQueryData
productsData
=
querySqbProduct
(
mallSn
,
mallSignature
,
sqbProductId
);
if
(
null
==
productsData
)
{
failCount
++;
continue
;
}
// 2. 编辑 SPU
// 2. 编辑 SPU
GoblinStoreMgtGoodsAddParam
addParam
=
buildMgtGoodsAddParam
(
storeId
,
productsData
);
// 注意:这里需要根据 MallProductsQueryData 构建参数,建议增加一个重载方法或做转换
GoblinSqbPerfGoodsVo
perfGoodsVo
=
new
GoblinSqbPerfGoodsVo
();
perfGoodsVo
.
setTitle
(
item
.
getTitle
());
perfGoodsVo
.
setProductIntroduction
(
item
.
getProductIntroduction
());
perfGoodsVo
.
setConverImages
(
item
.
getConverImages
());
perfGoodsVo
.
setSkuResults
(
item
.
getSkuResults
());
GoblinStoreMgtGoodsAddParam
addParam
=
buildMgtGoodsAddParam
(
storeId
,
perfGoodsVo
);
addParam
.
setSpuId
(
spuId
);
addParam
.
setSpuId
(
spuId
);
goblinstoreMgtGoodsService
.
goodsEditSpu
(
currentUid
,
addParam
,
mgtGoodsInfoVo
);
goblinstoreMgtGoodsService
.
goodsEditSpu
(
currentUid
,
addParam
,
mgtGoodsInfoVo
);
...
@@ -318,28 +309,72 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -318,28 +309,72 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
sqbToSysSkuMap
.
put
(
ext
.
getSqbSkuId
()
!=
null
?
ext
.
getSqbSkuId
()
:
"PLACEHOLDER"
,
ext
.
getSkuId
());
sqbToSysSkuMap
.
put
(
ext
.
getSqbSkuId
()
!=
null
?
ext
.
getSqbSkuId
()
:
"PLACEHOLDER"
,
ext
.
getSkuId
());
}
}
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSkuResults
();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
item
.
getSkuResults
();
Set
<
String
>
processedSqbSkuIds
=
new
HashSet
<>();
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
String
skuId
=
sqbToSysSkuMap
.
get
(
"PLACEHOLDER"
);
String
skuId
=
sqbToSysSkuMap
.
get
(
"PLACEHOLDER"
);
if
(
skuId
!=
null
)
if
(
skuId
!=
null
)
{
processSkuUpdate
(
currentUid
,
storeId
,
skuId
,
productsData
,
null
);
processSkuUpdate
(
currentUid
,
storeId
,
skuId
,
item
,
null
);
processedSqbSkuIds
.
add
(
"PLACEHOLDER"
);
}
}
else
{
}
else
{
for
(
MallProductsQueryData
.
Sku
sqbSku
:
sqbSkus
)
{
for
(
MallProductsQueryData
.
Sku
sqbSku
:
sqbSkus
)
{
String
skuId
=
sqbToSysSkuMap
.
get
(
sqbSku
.
getSkuId
());
String
skuId
=
sqbToSysSkuMap
.
get
(
sqbSku
.
getSkuId
());
if
(
skuId
!=
null
)
if
(
skuId
!=
null
)
{
processSkuUpdate
(
currentUid
,
storeId
,
skuId
,
productsData
,
sqbSku
);
// 已存在,执行更新
processSkuUpdate
(
currentUid
,
storeId
,
skuId
,
item
,
sqbSku
);
processedSqbSkuIds
.
add
(
sqbSku
.
getSkuId
());
}
else
{
// 新增 SKU
List
<
String
>
oldSkuIdList
=
new
ArrayList
<>(
mgtGoodsInfoVo
.
getSkuIdList
());
processSkuAddition
(
currentUid
,
storeId
,
mgtGoodsInfoVo
,
item
,
sqbSku
);
List
<
String
>
newSkuIdList
=
mgtGoodsInfoVo
.
getSkuIdList
();
// 找出新增的 skuId
String
newSkuId
=
newSkuIdList
.
stream
()
.
filter
(
id
->
!
oldSkuIdList
.
contains
(
id
))
.
findFirst
().
orElse
(
null
);
if
(
newSkuId
!=
null
)
{
GoblinSqbGoodsExt
newExt
=
new
GoblinSqbGoodsExt
();
newExt
.
setMallSn
(
mallSn
);
newExt
.
setSqbSpuId
(
sqbSpuId
);
newExt
.
setSqbSkuId
(
sqbSku
.
getSkuId
());
newExt
.
setSpuId
(
spuId
);
newExt
.
setSkuId
(
newSkuId
);
newExt
.
setDelFlg
(
"0"
);
newExt
.
setCreatedAt
(
LocalDateTime
.
now
());
goblinSqbGoodsExtMapper
.
insert
(
newExt
);
processedSqbSkuIds
.
add
(
sqbSku
.
getSkuId
());
}
}
}
}
// 4. 处理被删除的 SKU
LocalDateTime
now
=
LocalDateTime
.
now
();
for
(
GoblinSqbGoodsExt
ext
:
existingExts
)
{
String
sqbSkuId
=
ext
.
getSqbSkuId
()
!=
null
?
ext
.
getSqbSkuId
()
:
"PLACEHOLDER"
;
if
(!
processedSqbSkuIds
.
contains
(
sqbSkuId
))
{
processSkuDeletion
(
currentUid
,
ext
,
mgtGoodsInfoVo
);
// 假删除
ext
.
setDelFlg
(
"1"
);
ext
.
setDeletedBy
(
currentUid
);
ext
.
setDeletedAt
(
now
);
ext
.
setUpdatedAt
(
now
);
goblinSqbGoodsExtMapper
.
updateById
(
ext
);
}
}
}
}
updateCount
++;
updateCount
++;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[收钱吧更新商品同步] 异常, sqb
ProductId={}"
,
sqbProductId
,
e
);
log
.
error
(
"[收钱吧更新商品同步] 异常, sqb
SpuId={}"
,
item
.
getSpuId
()
,
e
);
failCount
++;
failCount
++;
}
}
}
}
return
ResponseDto
.
success
(
String
.
format
(
"更新完成:更新 %d, 未找到 %d, 失败 %d"
,
updateCount
,
notFoundCount
,
failCount
));
return
ResponseDto
.
success
(
String
.
format
(
"更新完成:更新 %d, 未找到 %d, 失败 %d"
,
updateCount
,
notFoundCount
,
failCount
));
}
}
private
void
processSkuUpdate
(
String
currentUid
,
String
storeId
,
String
skuId
,
MallProductsQueryData
productsData
,
private
void
processSkuUpdate
(
String
currentUid
,
String
storeId
,
String
skuId
,
GoblinSqbPerfGoodsVo
productsData
,
MallProductsQueryData
.
Sku
sqbSku
)
{
MallProductsQueryData
.
Sku
sqbSku
)
{
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
GoblinGoodsSkuInfoVo
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
skuId
);
if
(
null
==
mgtGoodsSkuInfoVo
)
if
(
null
==
mgtGoodsSkuInfoVo
)
...
@@ -374,80 +409,121 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -374,80 +409,121 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
editSkuParam
.
setSkuValidity
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
mgtGoodsSkuInfoVo
.
getSkuValidity
()));
editSkuParam
.
setSkuValidity
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
mgtGoodsSkuInfoVo
.
getSkuValidity
()));
// 库存增量逻辑
// 库存增量逻辑
int
newSqbTotal
=
(
sqbSku
!=
null
&&
sqbSku
.
getQuantity
()
!=
null
)
?
sqbSku
.
getQuantity
().
intValue
()
:
0
;
/*
int
oldTotal
=
mgtGoodsSkuInfoVo
.
getStock
()
!=
null
?
mgtGoodsSkuInfoVo
.
getStock
()
:
0
;
* int newSqbTotal = (sqbSku != null && sqbSku.getQuantity() != null) ?
int
operStock
=
newSqbTotal
-
oldTotal
;
* sqbSku.getQuantity().intValue() : 0;
* int oldTotal = mgtGoodsSkuInfoVo.getStock() != null ?
if
(
operStock
!=
0
)
{
* mgtGoodsSkuInfoVo.getStock() : 0;
int
operStockVal
=
Math
.
abs
(
operStock
);
* int operStock = newSqbTotal - oldTotal;
int
currentRedisSurplus
=
goblinRedisUtils
.
getSkuStock
(
null
,
skuId
);
*
if
(
operStock
<
0
)
{
* if (operStock != 0) {
if
(
currentRedisSurplus
>=
operStockVal
)
{
* int operStockVal = Math.abs(operStock);
if
(
goblinRedisUtils
.
decrSkuStock
(
null
,
skuId
,
operStockVal
)
>=
0
)
{
* int currentRedisSurplus = goblinRedisUtils.getSkuStock(null, skuId);
editSkuParam
.
setStock
(
oldTotal
-
operStockVal
);
* if (operStock < 0) {
editSkuParam
.
setSkuStock
(
mgtGoodsSkuInfoVo
.
getSkuStock
()
-
operStockVal
);
* if (currentRedisSurplus >= operStockVal) {
}
* if (goblinRedisUtils.decrSkuStock(null, skuId, operStockVal) >= 0) {
}
else
{
* editSkuParam.setStock(oldTotal - operStockVal);
goblinRedisUtils
.
setSkuStock
(
null
,
skuId
,
newSqbTotal
);
* editSkuParam.setSkuStock(mgtGoodsSkuInfoVo.getSkuStock() - operStockVal);
editSkuParam
.
setStock
(
newSqbTotal
);
* }
editSkuParam
.
setSkuStock
(
newSqbTotal
);
* } else {
}
* goblinRedisUtils.setSkuStock(null, skuId, newSqbTotal);
}
else
{
* editSkuParam.setStock(newSqbTotal);
goblinRedisUtils
.
incrSkuStock
(
null
,
skuId
,
operStockVal
);
* editSkuParam.setSkuStock(newSqbTotal);
editSkuParam
.
setStock
(
oldTotal
+
operStockVal
);
* }
editSkuParam
.
setSkuStock
(
mgtGoodsSkuInfoVo
.
getSkuStock
()
+
operStockVal
);
* } else {
}
* goblinRedisUtils.incrSkuStock(null, skuId, operStockVal);
}
else
{
* editSkuParam.setStock(oldTotal + operStockVal);
editSkuParam
.
setStock
(
oldTotal
);
* editSkuParam.setSkuStock(mgtGoodsSkuInfoVo.getSkuStock() + operStockVal);
editSkuParam
.
setSkuStock
(
mgtGoodsSkuInfoVo
.
getSkuStock
());
* }
}
* } else {
* editSkuParam.setStock(oldTotal);
* editSkuParam.setSkuStock(mgtGoodsSkuInfoVo.getSkuStock());
* }
*/
goblinstoreMgtGoodsService
.
goodsEditSku
(
currentUid
,
editSkuParam
,
mgtGoodsSkuInfoVo
,
mgtGoodsInfoVo
,
Collections
.
emptyMap
(),
Collections
.
emptyMap
());
}
goblinstoreMgtGoodsService
.
goodsEditSku
(
currentUid
,
editSkuParam
,
mgtGoodsSkuInfoVo
,
mgtGoodsInfoVo
,
null
,
private
void
processSkuAddition
(
String
currentUid
,
String
storeId
,
GoblinGoodsInfoVo
mgtGoodsInfoVo
,
null
);
GoblinSqbPerfGoodsVo
item
,
MallProductsQueryData
.
Sku
sqbSku
)
{
GoblinStoreMgtGoodsEditSkuParam
addSkuParam
=
new
GoblinStoreMgtGoodsEditSkuParam
();
addSkuParam
.
setStoreId
(
storeId
);
addSkuParam
.
setSpuId
(
mgtGoodsInfoVo
.
getSpuId
());
addSkuParam
.
setSkuPic
(
CollectionUtils
.
isEmpty
(
item
.
getConverImages
())
?
""
:
item
.
getConverImages
().
get
(
0
));
// 规格处理:收钱吧如果没有详细规格,使用默认规格
List
<
GoblinGoodsSpecDto
>
specList
=
new
ArrayList
<>();
GoblinGoodsSpecDto
defaultSpec
=
new
GoblinGoodsSpecDto
();
defaultSpec
.
setSpecName
(
"默认"
);
defaultSpec
.
setSpecVname
(
StringUtils
.
isNotBlank
(
sqbSku
.
getSkuName
())
?
sqbSku
.
getSkuName
()
:
"默认"
);
specList
.
add
(
defaultSpec
);
addSkuParam
.
setSkuSpecList
(
specList
);
BigDecimal
price
=
BigDecimal
.
valueOf
(
sqbSku
.
getPrice
()).
divide
(
BigDecimal
.
valueOf
(
100
));
addSkuParam
.
setPrice
(
price
);
addSkuParam
.
setSellPrice
(
price
);
addSkuParam
.
setPriceMember
(
price
);
addSkuParam
.
setStock
(
sqbSku
.
getQuantity
()
!=
null
?
sqbSku
.
getQuantity
().
intValue
()
:
0
);
addSkuParam
.
setSkuStock
(
addSkuParam
.
getStock
());
addSkuParam
.
setSkuAppear
(
"0"
);
addSkuParam
.
setBuyFactor
(
"0"
);
addSkuParam
.
setSkuValidity
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
().
plusYears
(
10
)));
goblinstoreMgtGoodsService
.
goodsEditSkuAdd
(
currentUid
,
addSkuParam
,
mgtGoodsInfoVo
);
}
}
private
GoblinStoreMgtGoodsAddParam
buildMgtGoodsAddParam
(
String
storeId
,
MallProductsQueryData
productsData
)
{
private
void
processSkuDeletion
(
String
currentUid
,
GoblinSqbGoodsExt
ext
,
GoblinGoodsInfoVo
mgtGoodsInfoVo
)
{
GoblinGoodsSkuInfoVo
delSkuInfoVo
=
goblinRedisUtils
.
getGoodsSkuInfoVo
(
ext
.
getSkuId
());
if
(
delSkuInfoVo
!=
null
)
{
goblinstoreMgtGoodsService
.
goodsEditSkuDel
(
currentUid
,
delSkuInfoVo
,
mgtGoodsInfoVo
);
}
}
private
GoblinStoreMgtGoodsAddParam
buildMgtGoodsAddParam
(
String
storeId
,
GoblinSqbPerfGoodsVo
productsData
)
{
GoblinStoreMgtGoodsAddParam
param
=
new
GoblinStoreMgtGoodsAddParam
();
GoblinStoreMgtGoodsAddParam
param
=
new
GoblinStoreMgtGoodsAddParam
();
param
.
setStoreId
(
storeId
);
param
.
setStoreId
(
storeId
);
param
.
setName
(
productsData
.
getTitle
());
param
.
setName
(
productsData
.
getTitle
());
param
.
setIntro
(
productsData
.
getProductIntroduction
());
//
param.setIntro(productsData.getProductIntroduction());
param
.
setImageList
(
new
ArrayList
<>(
productsData
.
getConverImages
()
));
param
.
setImageList
(
productsData
.
getConverImages
(
));
param
.
setDetails
(
productsData
.
getProductIntroduction
());
param
.
setDetails
(
productsData
.
getProductIntroduction
());
param
.
setSpecMode
(
"1"
);
param
.
setSpecMode
(
"1"
);
param
.
setShelvesHandle
(
"1"
);
param
.
setShelvesHandle
(
"1"
);
param
.
setVirtualFlg
(
"1"
);
param
.
setVirtualFlg
(
"1"
);
// 设置默认分类
param
.
setCateFid
(
"22199125131096"
);
param
.
setCateSid
(
"22199125143778"
);
param
.
setCateTid
(
"22199125200983"
);
List
<
GoblinStoreMgtGoodsAddSkuParam
>
skuParams
=
new
ArrayList
<>();
List
<
GoblinStoreMgtGoodsAddSkuParam
>
skuParams
=
new
ArrayList
<>();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSkuResults
();
List
<
MallProductsQueryData
.
Sku
>
sqbSkus
=
productsData
.
getSkuResults
();
if
(
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
if
(!
CollectionUtils
.
isEmpty
(
sqbSkus
))
{
skuParams
.
add
(
buildMgtSkuParam
(
productsData
.
getTitle
(),
null
,
productsData
.
getConverImages
()));
}
else
{
for
(
MallProductsQueryData
.
Sku
sqbSku
:
sqbSkus
)
{
for
(
MallProductsQueryData
.
Sku
sqbSku
:
sqbSkus
)
{
skuParams
.
add
(
buildMgtSkuParam
(
null
,
sqbSku
,
productsData
.
getConverImages
()));
skuParams
.
add
(
buildMgtSkuParam
(
sqbSku
,
productsData
.
getConverImages
()));
}
}
}
}
param
.
setSkuParamList
(
skuParams
);
param
.
setSkuParamList
(
skuParams
);
return
param
;
return
param
;
}
}
private
GoblinStoreMgtGoodsAddSkuParam
buildMgtSkuParam
(
String
defaultName
,
MallProductsQueryData
.
Sku
sqbSku
,
private
GoblinStoreMgtGoodsAddSkuParam
buildMgtSkuParam
(
MallProductsQueryData
.
Sku
sqbSku
,
List
<
String
>
images
)
{
List
<
String
>
images
)
{
GoblinStoreMgtGoodsAddSkuParam
sku
=
new
GoblinStoreMgtGoodsAddSkuParam
();
GoblinStoreMgtGoodsAddSkuParam
sku
=
new
GoblinStoreMgtGoodsAddSkuParam
();
sku
.
setSkuPic
(!
CollectionUtils
.
isEmpty
(
images
)
?
images
.
get
(
0
)
:
""
);
sku
.
setSkuPic
(!
CollectionUtils
.
isEmpty
(
images
)
?
images
.
get
(
0
)
:
""
);
sku
.
setSkuSpecList
(
new
ArrayList
<>());
List
<
GoblinGoodsSpecDto
>
specList
=
new
ArrayList
<>();
if
(
sqbSku
!=
null
)
{
GoblinGoodsSpecDto
defaultSpec
=
new
GoblinGoodsSpecDto
();
BigDecimal
price
=
BigDecimal
.
valueOf
(
sqbSku
.
getPrice
()).
divide
(
BigDecimal
.
valueOf
(
100
));
defaultSpec
.
setSpecName
(
"默认"
);
sku
.
setPrice
(
price
);
defaultSpec
.
setSpecVname
(
StringUtils
.
isNotBlank
(
sqbSku
.
getSkuName
())
?
sqbSku
.
getSkuName
()
:
"默认"
);
sku
.
setSellPrice
(
price
);
specList
.
add
(
defaultSpec
);
sku
.
setStock
(
sqbSku
.
getQuantity
()
!=
null
?
sqbSku
.
getQuantity
().
intValue
()
:
0
);
sku
.
setSkuSpecList
(
specList
);
}
else
{
BigDecimal
price
=
BigDecimal
.
valueOf
(
sqbSku
.
getPrice
()).
divide
(
BigDecimal
.
valueOf
(
100
));
sku
.
setPrice
(
BigDecimal
.
ZERO
);
sku
.
setPrice
(
price
);
sku
.
setSellPrice
(
BigDecimal
.
ZERO
);
sku
.
setSellPrice
(
price
);
sku
.
setStock
(
0
);
sku
.
setStock
(
sqbSku
.
getQuantity
()
!=
null
?
sqbSku
.
getQuantity
().
intValue
()
:
999
);
}
sku
.
setSkuValidity
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
().
plusYears
(
1
)));
sku
.
setSkuValidity
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
().
plusYears
(
1
)));
sku
.
setSkuAppear
(
"0"
);
sku
.
setSkuAppear
(
"0"
);
sku
.
setBuyFactor
(
"0"
);
sku
.
setBuyFactor
(
"0"
);
sku
.
setSkuNo
(
sqbSku
.
getSkuId
());
return
sku
;
return
sku
;
}
}
...
@@ -495,19 +571,19 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -495,19 +571,19 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
List
<
GoblinSqbPerfGoodsVo
>
result
=
new
ArrayList
<>();
List
<
GoblinSqbPerfGoodsVo
>
result
=
new
ArrayList
<>();
for
(
GoblinSqbPerformanceGoods
rel
:
relations
)
{
for
(
GoblinSqbPerformanceGoods
rel
:
relations
)
{
GoblinSqbPerfGoodsVo
vo
=
new
GoblinSqbPerfGoodsVo
();
GoblinSqbPerfGoodsVo
vo
=
new
GoblinSqbPerfGoodsVo
();
//
vo.setSkuId(rel.getSkuId());
//
vo.setSkuId(rel.getSkuId());
//
vo.setSpuId(rel.getSpuId());
//
vo.setSpuId(rel.getSpuId());
//
vo.setSort(rel.getSort());
//
vo.setSort(rel.getSort());
//
GoblinGoodsSku sku = skuMap.get(rel.getSkuId());
//
GoblinGoodsSku sku = skuMap.get(rel.getSkuId());
//
if (sku != null) {
//
if (sku != null) {
//
vo.setSkuName(sku.getName());
//
vo.setSkuName(sku.getName());
//
vo.setPrice(sku.getPrice() != null ? sku.getPrice().longValue() : null);
//
vo.setPrice(sku.getPrice() != null ? sku.getPrice().longValue() : null);
//
}
//
}
//
GoblinGoods spu = spuMap.get(rel.getSpuId());
//
GoblinGoods spu = spuMap.get(rel.getSpuId());
//
if (spu != null) {
//
if (spu != null) {
//
vo.setSpuName(spu.getName());
//
vo.setSpuName(spu.getName());
//
vo.setCoverPic(spu.getCoverPic());
//
vo.setCoverPic(spu.getCoverPic());
//
}
//
}
result
.
add
(
vo
);
result
.
add
(
vo
);
}
}
goblinSqbRedisUtils
.
setPerfGoods
(
performancesId
,
result
);
goblinSqbRedisUtils
.
setPerfGoods
(
performancesId
,
result
);
...
@@ -545,15 +621,16 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
...
@@ -545,15 +621,16 @@ public class GoblinSqbGoodsServiceImpl implements IGoblinSqbGoodsService {
return
seller
;
return
seller
;
}
}
private
GoblinSqbGoodsExt
buildExt
(
String
spuId
,
String
skuId
,
String
mallSn
,
String
sqbProduct
Id
,
private
GoblinSqbGoodsExt
buildExt
(
String
spuId
,
String
skuId
,
String
mallSn
,
String
mallSignature
,
String
sqbSpu
Id
,
String
sqb
ProductSn
,
String
sqb
SkuId
,
LocalDateTime
now
)
{
String
sqbSkuId
,
LocalDateTime
now
)
{
GoblinSqbGoodsExt
ext
=
new
GoblinSqbGoodsExt
();
GoblinSqbGoodsExt
ext
=
new
GoblinSqbGoodsExt
();
ext
.
setSpuId
(
spuId
);
ext
.
setSpuId
(
spuId
);
ext
.
setSkuId
(
skuId
);
ext
.
setSkuId
(
skuId
);
ext
.
setMallSn
(
mallSn
);
ext
.
setMallSn
(
mallSn
);
ext
.
setS
qbProductId
(
sqbProductId
);
ext
.
setS
ignature
(
mallSignature
);
ext
.
setSqb
ProductSn
(
sqbProductSn
);
ext
.
setSqb
SpuId
(
sqbSpuId
);
ext
.
setSqbSkuId
(
sqbSkuId
);
ext
.
setSqbSkuId
(
sqbSkuId
);
ext
.
setDelFlg
(
"0"
);
ext
.
setCreatedAt
(
now
);
ext
.
setCreatedAt
(
now
);
ext
.
setUpdatedAt
(
now
);
ext
.
setUpdatedAt
(
now
);
return
ext
;
return
ext
;
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/util/ObjectUtil.java
View file @
3b0d7439
...
@@ -10,10 +10,7 @@ import com.liquidnet.service.goblin.dto.GoblinStoreMgtCouponListVoExcel;
...
@@ -10,10 +10,7 @@ import com.liquidnet.service.goblin.dto.GoblinStoreMgtCouponListVoExcel;
import
com.liquidnet.service.goblin.dto.GoblinStoreMgtGoodsListVoExcel
;
import
com.liquidnet.service.goblin.dto.GoblinStoreMgtGoodsListVoExcel
;
import
com.liquidnet.service.goblin.dto.manage.vo.*
;
import
com.liquidnet.service.goblin.dto.manage.vo.*
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.dto.vo.*
;
import
com.liquidnet.service.goblin.entity.GoblinFrontBanner
;
import
com.liquidnet.service.goblin.entity.*
;
import
com.liquidnet.service.goblin.entity.GoblinOrderAttr
;
import
com.liquidnet.service.goblin.entity.GoblinOrderSku
;
import
com.liquidnet.service.goblin.entity.GoblinStoreOrder
;
import
com.liquidnet.service.goblin.param.BackCouponParam
;
import
com.liquidnet.service.goblin.param.BackCouponParam
;
import
com.liquidnet.service.goblin.param.GoblinOrderSqlParam
;
import
com.liquidnet.service.goblin.param.GoblinOrderSqlParam
;
import
com.mongodb.BasicDBObject
;
import
com.mongodb.BasicDBObject
;
...
@@ -43,6 +40,7 @@ public class ObjectUtil {
...
@@ -43,6 +40,7 @@ public class ObjectUtil {
private
static
final
ArrayList
<
GoblinStoreConfigVo
>
goblinStoreConfigVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinStoreConfigVo
>
goblinStoreConfigVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinStoreNoticeVo
>
goblinStoreNoticeVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinStoreNoticeVo
>
goblinStoreNoticeVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinGoodsSkuInfoVo
>
goblinGoodsSkuInfoVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinGoodsSkuInfoVo
>
goblinGoodsSkuInfoVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinSqbGoodsExt
>
goblinSqbGoodsExtArrayList
=
new
ArrayList
<>();
private
static
final
HashMap
<
String
,
GoblinGoodsSkuInfoVo
>
goblinGoodsSkuInfoVoHashMap
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
GoblinGoodsSkuInfoVo
>
goblinGoodsSkuInfoVoHashMap
=
new
HashMap
<>();
private
static
final
ArrayList
<
GoblinGoodsSpecVo
>
goblinGoodsSpecVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinGoodsSpecVo
>
goblinGoodsSpecVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinGoodsSpecValueVo
>
goblinGoodsSpecValueVoArrayList
=
new
ArrayList
<>();
private
static
final
ArrayList
<
GoblinGoodsSpecValueVo
>
goblinGoodsSpecValueVoArrayList
=
new
ArrayList
<>();
...
@@ -337,6 +335,10 @@ public class ObjectUtil {
...
@@ -337,6 +335,10 @@ public class ObjectUtil {
return
(
ArrayList
<
GoblinGoodsSkuInfoVo
>)
goblinGoodsSkuInfoVoArrayList
.
clone
();
return
(
ArrayList
<
GoblinGoodsSkuInfoVo
>)
goblinGoodsSkuInfoVoArrayList
.
clone
();
}
}
public
static
ArrayList
<
GoblinSqbGoodsExt
>
getGoblinSqbGoodsExtArrayList
()
{
return
(
ArrayList
<
GoblinSqbGoodsExt
>)
goblinSqbGoodsExtArrayList
.
clone
();
}
public
static
Map
<
String
,
GoblinGoodsSkuInfoVo
>
getGoblinGoodsSkuInfoVoMap
()
{
public
static
Map
<
String
,
GoblinGoodsSkuInfoVo
>
getGoblinGoodsSkuInfoVoMap
()
{
return
(
HashMap
<
String
,
GoblinGoodsSkuInfoVo
>)
goblinGoodsSkuInfoVoHashMap
.
clone
();
return
(
HashMap
<
String
,
GoblinGoodsSkuInfoVo
>)
goblinGoodsSkuInfoVoHashMap
.
clone
();
}
}
...
...
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