JeecgBoot3.2.0 版本发布 [优化微服务模块]

This commit is contained in:
zhangdaiscott
2022-04-24 15:51:09 +08:00
parent 490f5696cf
commit 5dcb991dde
35 changed files with 103 additions and 41 deletions

View File

@ -10,6 +10,7 @@ import java.math.BigDecimal;
*/
public interface SeataAccountService {
/**
* 扣减金额
* @param userId 用户 ID
* @param amount 扣减金额
*/

View File

@ -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);

View File

@ -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 {
/**

View File

@ -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=================");

View File

@ -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=================");