Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
2c40773b
Commit
2c40773b
authored
Apr 22, 2020
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单库存bug
parent
fc7b66fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
15 deletions
+28
-15
ActivityProductBiz.java
...va/com/xxfc/platform/activity/biz/ActivityProductBiz.java
+8
-3
ActivityProductSpecsBiz.java
...m/xxfc/platform/activity/biz/ActivityProductSpecsBiz.java
+9
-4
OrderActivityService.java
...com/xxfc/platform/order/service/OrderActivityService.java
+11
-8
No files found.
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityProductBiz.java
View file @
2c40773b
...
...
@@ -63,9 +63,14 @@ public class ActivityProductBiz extends BaseBiz<ActivityProductMapper, ActivityP
ActivityProduct
oldValue
=
selectById
(
activityProduct
.
getId
());
if
(
oldValue
!=
null
)
{
//增加销量,减少库存
oldValue
.
setSales
(
oldValue
.
getSales
()
+
activityProduct
.
getSales
());
oldValue
.
setStock
(
oldValue
.
getStock
()
-
activityProduct
.
getSales
());
updateSelectiveByIdRe
(
oldValue
);
return
ObjectRestResponse
.
succ
(
oldValue
);
if
(
oldValue
.
getStock
()
>
0
)
{
oldValue
.
setStock
(
oldValue
.
getStock
()
-
activityProduct
.
getSales
());
updateSelectiveByIdRe
(
oldValue
);
return
ObjectRestResponse
.
succ
(
oldValue
);
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"库存不足"
);
}
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"商品不存在!"
);
}
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityProductSpecsBiz.java
View file @
2c40773b
...
...
@@ -57,10 +57,15 @@ public class ActivityProductSpecsBiz extends BaseBiz<ActivityProductSpecsMapper,
}
ActivityProductSpecs
oldValue
=
selectById
(
activityProductSpecs
.
getId
());
if
(
oldValue
!=
null
)
{
//增加销量,减少库存
oldValue
.
setSales
(
oldValue
.
getSales
()
+
activityProductSpecs
.
getSales
());
oldValue
.
setStock
(
oldValue
.
getStock
()
-
activityProductSpecs
.
getSales
());
updateSelectiveByIdRe
(
oldValue
);
return
ObjectRestResponse
.
succ
(
oldValue
);
if
(
oldValue
.
getStock
()
>
0
)
{
oldValue
.
setSales
(
oldValue
.
getSales
()
+
activityProductSpecs
.
getSales
());
oldValue
.
setStock
(
oldValue
.
getStock
()
-
activityProductSpecs
.
getSales
());
updateSelectiveByIdRe
(
oldValue
);
return
ObjectRestResponse
.
succ
(
oldValue
);
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"库存不足"
);
}
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"商品不存在!"
);
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderActivityService.java
View file @
2c40773b
...
...
@@ -68,14 +68,17 @@ public class OrderActivityService extends AbstractOrderHandle<OrderActivityDetai
if
(
activityProductSpecs
!=
null
)
{
bo
.
getOrder
().
setGoodsAmount
(
activityProductSpecs
.
getGoodsPrice
());
//修改规格库存
activityProductSpecs
.
setSales
(
bo
.
getNumber
());
activityFeign
.
update
(
activityProductSpecs
);
//修改商品库存
ActivityProduct
activityProduct
=
new
ActivityProduct
();
activityProduct
.
setId
(
activityProductSpecs
.
getGoodsId
());
activityProduct
.
setSales
(
bo
.
getNumber
());
activityFeign
.
updateProduct
(
activityProduct
);
if
(
activityProductSpecs
.
getStock
()
>
0
)
{
activityProductSpecs
.
setSales
(
bo
.
getNumber
());
activityFeign
.
update
(
activityProductSpecs
);
//修改商品库存
ActivityProduct
activityProduct
=
new
ActivityProduct
();
activityProduct
.
setId
(
activityProductSpecs
.
getGoodsId
());
activityProduct
.
setSales
(
bo
.
getNumber
());
activityFeign
.
updateProduct
(
activityProduct
);
}
}
//发送定时取消订单(30分钟)
...
...
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