mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-04 17:45:34 +08:00
JeecgBoot3.2.0 版本发布 [优化微服务模块]
This commit is contained in:
@ -10,6 +10,7 @@ import java.math.BigDecimal;
|
||||
*/
|
||||
public interface SeataAccountService {
|
||||
/**
|
||||
* 扣减金额
|
||||
* @param userId 用户 ID
|
||||
* @param amount 扣减金额
|
||||
*/
|
||||
|
||||
@ -32,7 +32,7 @@ public class SeataAccountServiceImpl implements SeataAccountService {
|
||||
*/
|
||||
@DS("account")
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class)
|
||||
public void reduceBalance(Long userId, BigDecimal amount) {
|
||||
log.info("=============ACCOUNT START=================");
|
||||
SeataAccount account = accountMapper.selectById(userId);
|
||||
|
||||
@ -6,6 +6,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分布式事务产品feign客户端
|
||||
* @author: zyf
|
||||
* @date: 2022/04/21
|
||||
*/
|
||||
@FeignClient(value ="seata-product")
|
||||
public interface ProductClient {
|
||||
/**
|
||||
|
||||
@ -36,7 +36,7 @@ public class SeataOrderServiceImpl implements SeataOrderService {
|
||||
|
||||
@DS("order")
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@GlobalTransactional
|
||||
public void placeOrder(PlaceOrderRequest request) {
|
||||
log.info("=============ORDER START=================");
|
||||
|
||||
@ -32,7 +32,7 @@ public class SeataProductServiceImpl implements SeataProductService {
|
||||
* 事务传播特性设置为 REQUIRES_NEW 开启新的事务
|
||||
*/
|
||||
@DS("product")
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class)
|
||||
@Override
|
||||
public BigDecimal reduceStock(Long productId, Integer count) {
|
||||
log.info("=============PRODUCT START=================");
|
||||
|
||||
Reference in New Issue
Block a user