记得上下班打卡 | 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
a34dbb3a
Commit
a34dbb3a
authored
Feb 24, 2022
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~API:商品管理:库存变更逻辑处理;
parent
afeacee9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
GoblinStoreMgtGoodsController.java
...blin/controller/manage/GoblinStoreMgtGoodsController.java
+7
-3
GoblinStoreMgtGoodsServiceImpl.java
...n/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
+9
-10
No files found.
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/controller/manage/GoblinStoreMgtGoodsController.java
View file @
a34dbb3a
...
...
@@ -301,8 +301,8 @@ public class GoblinStoreMgtGoodsController {
Integer
stock
=
mgtGoodsSkuInfoVo
.
getSkuStock
();
// 总库存
Integer
skuStock
=
mgtGoodsSkuInfoVo
.
getSkuStock
();
// SKU总库存
int
rtSku
Stock
=
goblinRedisUtils
.
getSkuStock
(
null
,
paramSkuId
);
// 当前剩余库存
if
(
operStock
<
0
&&
rtSku
Stock
>=
operStockVal
)
{
// SKU实时库存充足时允许扣减
int
surplus
Stock
=
goblinRedisUtils
.
getSkuStock
(
null
,
paramSkuId
);
// 当前剩余库存
if
(
operStock
<
0
&&
surplusStock
>
0
&&
surplus
Stock
>=
operStockVal
)
{
// SKU实时库存充足时允许扣减
if
(
goblinRedisUtils
.
decrSkuStock
(
null
,
paramSkuId
,
operStockVal
)
<
0
)
{
// 过程中库存不足时,回滚库存,编辑无效
goblinRedisUtils
.
incrSkuStock
(
null
,
paramSkuId
,
operStockVal
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149012"
));
...
...
@@ -314,6 +314,8 @@ public class GoblinStoreMgtGoodsController {
goblinRedisUtils
.
incrSkuStock
(
null
,
paramSkuId
,
operStockVal
);
storeMgtGoodsEditSkuParam
.
setSkuStock
(
skuStock
+
operStockVal
);
storeMgtGoodsEditSkuParam
.
setStock
(
stock
+
operStockVal
);
}
else
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"149012"
));
}
}
...
...
@@ -397,7 +399,9 @@ public class GoblinStoreMgtGoodsController {
}
}
if
(
goblinstoreMgtGoodsService
.
goodsEditSku
(
currentUid
,
storeMgtGoodsEditSkuParam
,
goodsInfoVo
,
delSpuSpecMap
,
beUpdateSpuSpecFlg
))
{
return
ResponseDto
.
success
(
goblinRedisUtils
.
getMgtGoodsSkuInfoVo
(
paramSkuId
));
mgtGoodsSkuInfoVo
=
goblinRedisUtils
.
getMgtGoodsSkuInfoVo
(
paramSkuId
);
mgtGoodsSkuInfoVo
.
setSurplusStock
(
goblinRedisUtils
.
getSkuStock
(
null
,
paramSkuId
));
return
ResponseDto
.
success
(
mgtGoodsSkuInfoVo
);
}
else
{
if
(
null
!=
operStock
&&
operStock
!=
0
)
{
// 处理库存:回滚
int
operStockVal
=
Math
.
abs
(
operStock
);
...
...
liquidnet-bus-service/liquidnet-service-goblin/liquidnet-service-goblin-impl/src/main/java/com/liquidnet/service/goblin/service/impl/manage/GoblinStoreMgtGoodsServiceImpl.java
View file @
a34dbb3a
...
...
@@ -441,6 +441,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
GoblinGoodsSkuInfoVo
updateSkuInfoVo
=
storeMgtGoodsEditSkuParam
.
initEditGoodsSkuInfoVo
();
updateSkuInfoVo
.
setUpdatedBy
(
uid
);
updateSkuInfoVo
.
setUpdatedAt
(
now
);
String
skuId
=
updateSkuInfoVo
.
getSkuId
();
if
(
goblinMongoUtils
.
updateGoodsSkuInfoVo
(
updateSkuInfoVo
))
{
LinkedList
<
Object
[]>
updateGoodsSkuForMarketObjs
=
CollectionUtil
.
linkedListObjectArr
();
// 参与活动的同一商品更新处理
...
...
@@ -458,17 +459,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
});
}
String
skuId
=
updateSkuInfoVo
.
getSkuId
();
String
spuId
=
goodsInfoVo
.
getSpuId
();
Integer
operStock
=
storeMgtGoodsEditSkuParam
.
getOperStock
();
if
(
null
!=
operStock
&&
operStock
!=
0
)
{
if
(
operStock
>
0
)
{
goblinRedisUtils
.
incrSkuStock
(
null
,
skuId
,
Math
.
abs
(
operStock
));
}
else
{
goblinRedisUtils
.
decrSkuStock
(
null
,
skuId
,
Math
.
abs
(
operStock
));
}
}
goblinRedisUtils
.
delGoodsSkuInfoVo
(
skuId
);
LinkedList
<
Object
[]>
updateSkuSpecValueObjs
=
CollectionUtil
.
linkedListObjectArr
();
...
...
@@ -565,6 +556,14 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
updateSkuSpecValueObjs
,
initSpuSpecValueObjs
,
delSpuSpecValueObjs
,
updateSpuSpecValueObjs
,
updateGoodsObjs
));
return
true
;
}
Integer
operStock
=
storeMgtGoodsEditSkuParam
.
getOperStock
();
if
(
null
!=
operStock
&&
operStock
!=
0
)
{
if
(
operStock
>
0
)
{
goblinRedisUtils
.
decrSkuStock
(
null
,
skuId
,
Math
.
abs
(
operStock
));
}
else
{
goblinRedisUtils
.
incrSkuStock
(
null
,
skuId
,
Math
.
abs
(
operStock
));
}
}
return
false
;
}
...
...
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