Commit a5778d82 by 吕明尚

验劵失败立即删除数据库数据

parent d888b906
...@@ -224,10 +224,6 @@ public class QPServiceImpl implements QPService { ...@@ -224,10 +224,6 @@ public class QPServiceImpl implements QPService {
*/ */
@Override @Override
public List<TuangouReceiptConsumeResponseEntity> consume(String code, int count, String openShopUuid) { public List<TuangouReceiptConsumeResponseEntity> consume(String code, int count, String openShopUuid) {
boolean exists = redisUtil.exists(ReceiptRdeisEnum.PREPARE.getValue() + code);
if (exists) {
redisUtil.delete(ReceiptRdeisEnum.PREPARE.getValue() + code);
}
String o = redisUtil.get(ReceiptRdeisEnum.MT_SESSION_KEY.getValue()); String o = redisUtil.get(ReceiptRdeisEnum.MT_SESSION_KEY.getValue());
JSONObject sessionKey = new JSONObject(o); JSONObject sessionKey = new JSONObject(o);
String session = (String) sessionKey.get("access_token"); String session = (String) sessionKey.get("access_token");
...@@ -239,8 +235,16 @@ public class QPServiceImpl implements QPService { ...@@ -239,8 +235,16 @@ public class QPServiceImpl implements QPService {
TuangouReceiptConsume tuangouReceiptConsume = new TuangouReceiptConsume(request); TuangouReceiptConsume tuangouReceiptConsume = new TuangouReceiptConsume(request);
TuangouReceiptConsumeResponse invoke = openAPIClient.invoke(tuangouReceiptConsume); TuangouReceiptConsumeResponse invoke = openAPIClient.invoke(tuangouReceiptConsume);
if (invoke.getCode() != 200) { if (invoke.getCode() != 200) {
//删除redis中的值
String value = redisUtil.get(ReceiptRdeisEnum.PREPARE.getValue() + code);
JSONObject jsonObject = new JSONObject(value);
Long consumerCouponId = jsonObject.getLong("consumerCouponId");
//删除数据库中的值
isConsumerCouponService.deleteSConsumerCouponById(consumerCouponId);
redisUtil.delete(ReceiptRdeisEnum.PREPARE.getValue() + code);
throw new RuntimeException(invoke.getMsg()); throw new RuntimeException(invoke.getMsg());
} }
redisUtil.delete(ReceiptRdeisEnum.PREPARE.getValue() + code);
return invoke.getData(); return invoke.getData();
} }
......
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