分布式事务注释
This commit is contained in:
parent
8b16ce48de
commit
dfc3941cb0
@ -120,21 +120,21 @@
|
||||
</dependency>
|
||||
|
||||
<!--alibaba微服务整合分布式事务seata-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-spring-boot-starter</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.seata</groupId>
|
||||
<artifactId>seata-spring-boot-starter</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.cloud</groupId>-->
|
||||
<!-- <artifactId>spring-cloud-starter-alibaba-seata</artifactId>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>io.seata</groupId>-->
|
||||
<!-- <artifactId>seata-spring-boot-starter</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>io.seata</groupId>-->
|
||||
<!-- <artifactId>seata-spring-boot-starter</artifactId>-->
|
||||
<!-- <version>1.3.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
@ -34,10 +34,10 @@ logging:
|
||||
|
||||
|
||||
#seata配置
|
||||
seata:
|
||||
tx-service-group: ${spring.application.name}-group
|
||||
service:
|
||||
grouplist:
|
||||
xdclass: 134.175.219.253:8091
|
||||
vgroup-mapping:
|
||||
xdclass-coupon-service-group: xdclass
|
||||
#seata:
|
||||
# tx-service-group: ${spring.application.name}-group
|
||||
# service:
|
||||
# grouplist:
|
||||
# xdclass: 134.175.219.253:8091
|
||||
# vgroup-mapping:
|
||||
# xdclass-coupon-service-group: xdclass
|
@ -1,9 +1,6 @@
|
||||
package net.jieyuu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jieyuu.enums.BizCodeEnum;
|
||||
import net.jieyuu.enums.SendCodeEnum;
|
||||
@ -69,7 +66,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
// @GlobalTransactional
|
||||
@Transactional(rollbackFor = RuntimeException.class, propagation = Propagation.REQUIRED)
|
||||
public JsonData register(UserRegisterRequest registerRequest) {
|
||||
|
||||
boolean checkCode = false;
|
||||
@ -140,9 +138,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
request.setName(userDO.getName());
|
||||
request.setUserId(userDO.getId());
|
||||
JsonData jsonData = couponFeignService.addNewUserCoupon(request);
|
||||
if (jsonData.getCode() != 0) {
|
||||
throw new RuntimeException("发放优惠券异常");
|
||||
}
|
||||
// if (jsonData.getCode() != 0) {
|
||||
// throw new RuntimeException("发放优惠券异常");
|
||||
// }
|
||||
log.info("发放新用户注册优惠券: {},结果:{}", request.toString(), jsonData.toString());
|
||||
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ minio:
|
||||
|
||||
|
||||
#seata配置
|
||||
seata:
|
||||
tx-service-group: ${spring.application.name}-group
|
||||
service:
|
||||
grouplist:
|
||||
xdclass: 134.175.219.253:8091
|
||||
vgroup-mapping:
|
||||
xdclass-user-service-group: xdclass
|
||||
#seata:
|
||||
# tx-service-group: ${spring.application.name}-group
|
||||
# service:
|
||||
# grouplist:
|
||||
# xdclass: 134.175.219.253:8091
|
||||
# vgroup-mapping:
|
||||
# xdclass-user-service-group: xdclass
|
Loading…
Reference in New Issue
Block a user