Browse Source

增加seata集成

test
smallchill 5 years ago
parent
commit
3a87e72601
  1. 5
      blade-ops/blade-flow/pom.xml
  2. 4
      blade-ops/blade-flow/src/main/java/org/springblade/flow/FlowApplication.java
  3. 20
      blade-ops/blade-flow/src/main/resources/registry.conf
  4. 5
      blade-service/blade-desk/pom.xml
  5. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java
  6. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java
  7. 20
      blade-service/blade-desk/src/main/resources/registry.conf
  8. 4
      pom.xml

5
blade-ops/blade-flow/pom.xml

@ -31,6 +31,11 @@
<artifactId>blade-starter-swagger</artifactId>
<version>${bladex.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-transaction</artifactId>
<version>${bladex.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-dict-api</artifactId>

4
blade-ops/blade-flow/src/main/java/org/springblade/flow/FlowApplication.java

@ -19,7 +19,7 @@ package org.springblade.flow;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springblade.transaction.annotation.SeataCloudApplication;
/**
* Flowable启动器
@ -27,7 +27,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
* @author Chill
*/
@EnableBladeFeign
@SpringCloudApplication
@SeataCloudApplication
public class FlowApplication {
public static void main(String[] args) {

20
blade-ops/blade-flow/src/main/resources/registry.conf

@ -0,0 +1,20 @@
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"
nacos {
serverAddr = "localhost"
namespace = ""
cluster = "default"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
serverAddr = "localhost"
namespace = ""
}
}

5
blade-service/blade-desk/pom.xml

@ -52,6 +52,11 @@
<artifactId>blade-starter-qiniu</artifactId>
<version>${bladex.tool.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-transaction</artifactId>
<version>${bladex.tool.version}</version>
</dependency>
</dependencies>
<build>

4
blade-service/blade-desk/src/main/java/org/springblade/desk/DeskApplication.java

@ -19,7 +19,7 @@ package org.springblade.desk;
import org.springblade.core.cloud.feign.EnableBladeFeign;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springblade.transaction.annotation.SeataCloudApplication;
/**
* Desk启动器
@ -27,7 +27,7 @@ import org.springframework.cloud.client.SpringCloudApplication;
* @author Chill
*/
@EnableBladeFeign
@SpringCloudApplication
@SeataCloudApplication
public class DeskApplication {
public static void main(String[] args) {

4
blade-service/blade-desk/src/main/java/org/springblade/desk/service/impl/LeaveServiceImpl.java

@ -16,6 +16,7 @@
*/
package org.springblade.desk.service.impl;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -36,8 +37,6 @@ import org.springblade.flow.core.utils.TaskUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* 服务实现类
*
@ -51,6 +50,7 @@ public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave>
private IFlowClient flowClient;
@Override
@GlobalTransactional
@Transactional(rollbackFor = Exception.class)
public boolean startProcess(ProcessLeave leave) {
String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);

20
blade-service/blade-desk/src/main/resources/registry.conf

@ -0,0 +1,20 @@
registry {
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"
nacos {
serverAddr = "localhost"
namespace = ""
cluster = "default"
}
}
config {
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
serverAddr = "localhost"
namespace = ""
}
}

4
pom.xml

@ -31,8 +31,8 @@
<alibaba.cloud.version>2.1.0.RELEASE</alibaba.cloud.version>
<spring.boot.version>2.1.7.RELEASE</spring.boot.version>
<spring.cloud.version>Greenwich.SR2</spring.cloud.version>
<spring.boot.version>2.1.8.RELEASE</spring.boot.version>
<spring.cloud.version>Greenwich.SR3</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version>
<!-- 推荐使用Harbor -->

Loading…
Cancel
Save