|
@@ -546,6 +546,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
|
|
|
List<GoodsOrderDetail> dataList = new ArrayList<>();
|
|
|
for (CreateOrderDetailFrom good : goods) {
|
|
|
String goodsId = good.getGoodsId();
|
|
|
+
|
|
|
+
|
|
|
|
|
|
BigDecimal carbonVal = good.getCarbonVal();
|
|
|
|
|
@@ -575,8 +577,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
- updateGoods(carbonVal, goodsInfoGuid);
|
|
|
-
|
|
|
+ RLock lock = redissonClient.getLock(goodsId);
|
|
|
+ try {
|
|
|
+
|
|
|
+ lock.lock();
|
|
|
+ updateGoods(carbonVal, goodsInfoGuid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ throw new RuntimeException("请重新抢购!");
|
|
|
+ } finally {
|
|
|
+
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
|
|
|
addGoodsOrderDetail(customerId, orderId, dataList, good, goodsInfo, sum);
|
|
|
}
|