Commit 70514a0ac2779ca31708fa5d6f3b94665e32489c
1 parent
b024c716
fix:同一个类中:A方法(无事务)调B方法(有事务),事务不生效问题
Showing
1 changed file
with
7 additions
and
1 deletions
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/notify/PayNotifyServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.date.DateUtils; |
| 9 | 9 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 10 | 10 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 11 | +import cn.iocoder.yudao.framework.common.util.spring.SpringAopUtils; | |
| 11 | 12 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 12 | 13 | import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO; |
| 13 | 14 | import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyTaskDO; |
| ... | ... | @@ -24,11 +25,13 @@ import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; |
| 24 | 25 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 25 | 26 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; |
| 26 | 27 | import lombok.extern.slf4j.Slf4j; |
| 28 | +import org.springframework.context.ApplicationContext; | |
| 27 | 29 | import org.springframework.context.annotation.Lazy; |
| 28 | 30 | import org.springframework.scheduling.annotation.Async; |
| 29 | 31 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 30 | 32 | import org.springframework.stereotype.Service; |
| 31 | 33 | import org.springframework.transaction.annotation.Transactional; |
| 34 | +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; | |
| 32 | 35 | |
| 33 | 36 | import javax.annotation.Resource; |
| 34 | 37 | import javax.validation.Valid; |
| ... | ... | @@ -85,6 +88,9 @@ public class PayNotifyServiceImpl implements PayNotifyService { |
| 85 | 88 | @Lazy // 循环依赖(自己依赖自己),避免报错 |
| 86 | 89 | private PayNotifyServiceImpl self; |
| 87 | 90 | |
| 91 | + @Resource | |
| 92 | + private ApplicationContext applicationContext; | |
| 93 | + | |
| 88 | 94 | @Override |
| 89 | 95 | public void createPayNotifyTask(PayNotifyTaskCreateReqDTO reqDTO) { |
| 90 | 96 | PayNotifyTaskDO task = new PayNotifyTaskDO(); |
| ... | ... | @@ -178,7 +184,7 @@ public class PayNotifyServiceImpl implements PayNotifyService { |
| 178 | 184 | } |
| 179 | 185 | |
| 180 | 186 | // 执行通知 |
| 181 | - executeNotify(dbTask); | |
| 187 | + applicationContext.getBean(PayNotifyServiceImpl.class).executeNotify(dbTask); | |
| 182 | 188 | }); |
| 183 | 189 | } |
| 184 | 190 | ... | ... |