|
|
|
@@ -31,6 +31,7 @@ import com.iformall.service.WxCouponChannelService; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.RedisLock; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
@@ -53,6 +54,9 @@ public class WxCouponController extends BaseController { |
|
|
|
@Autowired |
|
|
|
@Qualifier("couponDetailRedisTemplate") |
|
|
|
RedisTemplate<String, WxCouponCVo> cdRedisTemplate; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
RedisLock redisLock; |
|
|
|
|
|
|
|
@ApiOperation("根据id(couponChannel)查询接口") |
|
|
|
@GetMapping("/detail") |
|
|
|
@@ -103,6 +107,13 @@ public class WxCouponController extends BaseController { |
|
|
|
} |
|
|
|
// end of 更新状态 |
|
|
|
updateActivityStatus(wxCouponCVo); |
|
|
|
|
|
|
|
//此处判断是否存在绝对保证库存不超卖的缓存,如果没有,则把当前的库存设置为最大值。如果有,则是后台设置的时候保存的,以那个为准。 |
|
|
|
boolean hascache = redisLock.hasCouponStockCache(wxCouponCVo.getCouponId()); |
|
|
|
if (!hascache) { |
|
|
|
redisLock.setCouponStock(wxCouponCVo.getCouponId(), wxCouponCVo.getRemainInventory()); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(wxCouponCVo); |
|
|
|
} |
|
|
|
|
|
|
|
|