|
|
|
@@ -15,6 +15,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
@@ -103,7 +104,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public boolean sendCouponToUser(EnumCouponSendSendType type, Object param) { |
|
|
|
|
|
|
|
String tenantId; |
|
|
|
@@ -177,12 +178,17 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
|
continue; |
|
|
|
|
|
|
|
// 发放免费券 |
|
|
|
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, send.getCouponId()); |
|
|
|
if (couponOrder != null) { |
|
|
|
wxCouponActionLogService.addOne(tenantId, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId()); |
|
|
|
bRet = true; |
|
|
|
WxCouponOrder couponOrder = null; |
|
|
|
try { |
|
|
|
couponOrder = wxOrderService.sendFreeCouponToUser(cUserId, send.getCouponId()); |
|
|
|
if (couponOrder != null) { |
|
|
|
wxCouponActionLogService.addOne(tenantId, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId()); |
|
|
|
bRet = true; |
|
|
|
} |
|
|
|
// wxCouponService.reduceInventory(send.getCouponId(), 1); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
} |
|
|
|
wxCouponService.reduceInventory(send.getCouponId(), 1); |
|
|
|
} |
|
|
|
|
|
|
|
return bRet; |
|
|
|
|