Commit f111a215 by 徐康

Merge branch 'bugfix/20201118_xukang_下单加锁防止重复下单' into qa

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	order-application-service/pom.xml
parents c0dd3a91 f3ace699
......@@ -144,3 +144,4 @@
| 2.0.16.RELEASE | 麦咖啡问题修复 | 徐康 | 2020-11-09 |
| 2.1.2.RELEASE | 活动扣减库存 | 缪晖 | 2020-11-11 |
| 2.1.3-RELEASE | 退款增加自动退款配置的null判断 | 刘鹏飞 | 2020-11-12 |
| 2.1.4-RELEASE | 退款增加自动退款配置的null判断 | 刘鹏飞 | 2020-11-12 |
\ No newline at end of file
......@@ -187,7 +187,21 @@ public class OrderAdapterServiceImpl implements OrderAdapterService {
if(ObjectUtils.notEqual(baseResponse.getCode(),ResponseResult.SUCCESS.getCode())){
return baseResponse;
}
return mcCafeOrderService.createMCCafeOrder(createOrderVo);
// 添加分布式锁,如果没有取得锁直接返回失败;整个方法执行完毕后会删掉该锁
// 锁定秒数从apollo获取,如果apollo没有设置,默认5秒
String createOrderKey = CREATE_ORDER_KEY + assortmentCustomerInfoVo.getMemberId();
try {
Long expire = Long.valueOf(createOrderKeyExpire);
if(!LockUtils.lock(redisCache.getRedisTemplate(),createOrderKey,expire)){
return ResponseUtil.error(ResponseResult.ORDER_NOT_CREATE_ERROR);
}
return mcCafeOrderService.createMCCafeOrder(createOrderVo);
} catch (Exception e) {
throw e;
} finally {
//LockUtils.unlock(redisCache.getRedisTemplate(),createOrderKey);
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment