Browse Source

Merge branch 'dev_0814' of http://121.42.41.42:7070/r/esua-epdc-cloud into dev_0814

dev
qushutong 6 years ago
parent
commit
46bd7d4b42
  1. 51
      esua-epdc/epdc-commons/epdc-commons-api-version-control/pom.xml
  2. 42
      esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiRequestMappingHandlerMapping.java
  3. 22
      esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiVersion.java
  4. 48
      esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiVersionCondition.java
  5. 19
      esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/config/WebMvcRegistrationsConfig.java
  6. 1
      esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/config/DataSourceConfig.java
  7. 4
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java
  8. 2
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java
  9. 1
      esua-epdc/epdc-commons/pom.xml
  10. 8
      esua-epdc/epdc-gateway/pom.xml
  11. 6
      esua-epdc/epdc-gateway/src/main/resources/application.yml
  12. 79
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/pom.xml
  13. 43
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/processon/yishi.bpmn
  14. 4
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/ActivitiApplication.java
  15. 92
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/controller/ActModelController.java
  16. 18
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/controller/ActProcessController.java
  17. 38
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/main/StencilsetRestResource.java
  18. 69
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/model/ModelEditorJsonRestResource.java
  19. 90
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/model/ModelSaveRestResource.java
  20. 161
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/service/ActModelService.java
  21. 83
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/service/ActProcessService.java
  22. 59
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/application.yml
  23. BIN
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/processes/favicon.ico
  24. 0
      esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/registry.conf
  25. 7
      esua-epdc/epdc-module/epdc-api/epdc-api-server/pom.xml
  26. 18
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/rest/v2/DemoV2Controller.java
  27. 2
      esua-epdc/epdc-module/epdc-app/epdc-app-client/pom.xml
  28. 5
      esua-epdc/epdc-module/epdc-demo/epdc-demo-server/pom.xml
  29. 2
      esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/entity/DemoEntity.java
  30. 18
      esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/entity/TransforDemoEntity.java
  31. 26
      esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/transfor/Demo2DemoTransforEntity.java
  32. 38
      esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/test/java/com/elink/esua/epdc/OrikaTest.java
  33. 4
      esua-epdc/epdc-module/epdc-issue/epdc-issue-client/pom.xml
  34. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-client/src/main/java/com/elink/esua/epdc/epdc.gitkeep
  35. 6
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/pom.xml
  36. 4
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/java/com/elink/esua/epdc/IssueApplication.java
  37. 2
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java
  38. 6
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/application.yml
  39. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages.properties
  40. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_en_US.properties
  41. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_zh_CN.properties
  42. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_zh_TW.properties
  43. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation.properties
  44. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_en_US.properties
  45. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_zh_CN.properties
  46. 0
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_zh_TW.properties
  47. 2
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/logback-spring.xml
  48. 21
      esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/registry.conf
  49. 6
      esua-epdc/epdc-module/epdc-issue/pom.xml
  50. 2
      esua-epdc/epdc-module/pom.xml

51
esua-epdc/epdc-commons/epdc-commons-api-version-control/pom.xml

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>epdc-commons</artifactId>
<groupId>com.esua.epdc</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epdc-commons-api-version-control</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
</build>
</project>

42
esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiRequestMappingHandlerMapping.java

@ -0,0 +1,42 @@
package com.elink.esua.epdc.commons.api.version;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.condition.RequestCondition;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.lang.reflect.Method;
/**
* @author rongchao
* @Date 18-11-24
*/
public class ApiRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
@Override
protected RequestCondition<?> getCustomMethodCondition(Method method) {
return createCondition(method.getClass());
}
@Override
protected RequestCondition<?> getCustomTypeCondition(Class<?> handlerType) {
return createCondition(handlerType);
}
private static RequestCondition<ApiVersionCondition> createCondition(Class<?> clazz) {
RequestMapping classRequestMapping = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);
if (classRequestMapping == null) {
return null;
}
StringBuilder mappingUrlBuilder = new StringBuilder();
if (classRequestMapping.value().length > 0) {
mappingUrlBuilder.append(classRequestMapping.value()[0]);
}
String mappingUrl = mappingUrlBuilder.toString();
String mappingUrlVersion = "{version}";
if (!mappingUrl.contains(mappingUrlVersion)) {
return null;
}
ApiVersion apiVersion = AnnotationUtils.findAnnotation(clazz, ApiVersion.class);
return apiVersion == null ? new ApiVersionCondition(1) : new ApiVersionCondition(apiVersion.value());
}
}

22
esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiVersion.java

@ -0,0 +1,22 @@
package com.elink.esua.epdc.commons.api.version;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author rongchao
* @Date 18-11-24
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiVersion {
/**
* 版本号
*
* @return
*/
int value();
}

48
esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/ApiVersionCondition.java

@ -0,0 +1,48 @@
package com.elink.esua.epdc.commons.api.version;
import org.springframework.web.servlet.mvc.condition.RequestCondition;
import javax.servlet.http.HttpServletRequest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author rongchao
* @Date 18-11-24
*/
public class ApiVersionCondition implements RequestCondition<ApiVersionCondition> {
private final static Pattern VERSION_PREFIX_PATTERN = Pattern.compile("/v(\\d+).*");
private int apiVersion;
ApiVersionCondition(int apiVersion) {
this.apiVersion = apiVersion;
}
public int getApiVersion() {
return apiVersion;
}
@Override
public ApiVersionCondition combine(ApiVersionCondition apiVersionCondition) {
return new ApiVersionCondition(apiVersionCondition.getApiVersion());
}
@Override
public ApiVersionCondition getMatchingCondition(HttpServletRequest httpServletRequest) {
Matcher m = VERSION_PREFIX_PATTERN.matcher(httpServletRequest.getRequestURI());
if (m.find()) {
Integer version = Integer.valueOf(m.group(1));
if (version >= this.apiVersion) {
return this;
}
}
return null;
}
@Override
public int compareTo(ApiVersionCondition apiVersionCondition, HttpServletRequest httpServletRequest) {
return apiVersionCondition.getApiVersion() - this.apiVersion;
}
}

19
esua-epdc/epdc-commons/epdc-commons-api-version-control/src/main/java/com/elink/esua/epdc/commons/api/version/config/WebMvcRegistrationsConfig.java

@ -0,0 +1,19 @@
package com.elink.esua.epdc.commons.api.version.config;
import com.elink.esua.epdc.commons.api.version.ApiRequestMappingHandlerMapping;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
/**
* @author rongchao
* @Date 18-11-24
*/
@Configuration
public class WebMvcRegistrationsConfig implements WebMvcRegistrations {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
return new ApiRequestMappingHandlerMapping();
}
}

1
esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/config/DataSourceConfig.java

@ -84,7 +84,6 @@ public class DataSourceConfig implements InitializingBean {
} }
@Bean @Bean
@ConditionalOnMissingBean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
DataSourceProxy dataSourceProxy = new DataSourceProxy(dataSource); DataSourceProxy dataSourceProxy = new DataSourceProxy(dataSource);
MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean(); MybatisSqlSessionFactoryBean factory = new MybatisSqlSessionFactoryBean();

4
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java

@ -96,4 +96,8 @@ public interface Constant {
* 移动端用户标识 * 移动端用户标识
*/ */
String APP_USER_FLAG = "APP_USER"; String APP_USER_FLAG = "APP_USER";
/**
* 版本控制用
*/
String VERSION_CONTROL = "/{version}";
} }

2
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java

@ -54,7 +54,7 @@ public interface ServiceConstant {
/** /**
* 党群议事模块 * 党群议事模块
*/ */
String EPDC_PARTY_SERVER = "epdc-party-server"; String EPDC_ISSUE_SERVER = "epdc-issue-server";
/** /**
* 生活服务模块 * 生活服务模块
*/ */

1
esua-epdc/epdc-commons/pom.xml

@ -17,5 +17,6 @@
<module>epdc-commons-tools</module> <module>epdc-commons-tools</module>
<module>epdc-commons-mybatis</module> <module>epdc-commons-mybatis</module>
<module>epdc-commons-dynamic-datasource</module> <module>epdc-commons-dynamic-datasource</module>
<module>epdc-commons-api-version-control</module>
</modules> </modules>
</project> </project>

8
esua-epdc/epdc-gateway/pom.xml

@ -97,8 +97,8 @@
<gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri> <gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri>
<!-- <gateway.routes.epdc-news-server.uri>http://127.0.0.1:9064</gateway.routes.epdc-news-server.uri>--> <!-- <gateway.routes.epdc-news-server.uri>http://127.0.0.1:9064</gateway.routes.epdc-news-server.uri>-->
<gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri> <gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri>
<gateway.routes.epdc-party-server.uri>lb://epdc-party-server</gateway.routes.epdc-party-server.uri> <gateway.routes.epdc-issue-server.uri>lb://epdc-issue-server</gateway.routes.epdc-issue-server.uri>
<!-- <gateway.routes.epdc-party-server.uri>http://127.0.0.1:9066</gateway.routes.epdc-party-server.uri>--> <!-- <gateway.routes.epdc-issue-server.uri>http://127.0.0.1:9066</gateway.routes.epdc-issue-server.uri>-->
<gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri> <gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri>
<!-- <gateway.routes.epdc-services-server.uri>http://127.0.0.1:9067</gateway.routes.epdc-services-server.uri>--> <!-- <gateway.routes.epdc-services-server.uri>http://127.0.0.1:9067</gateway.routes.epdc-services-server.uri>-->
<gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri> <gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri>
@ -134,7 +134,7 @@
<gateway.routes.epdc-neighbor-server.uri>lb://epdc-neighbor-server</gateway.routes.epdc-neighbor-server.uri> <gateway.routes.epdc-neighbor-server.uri>lb://epdc-neighbor-server</gateway.routes.epdc-neighbor-server.uri>
<gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri> <gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri>
<gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri> <gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri>
<gateway.routes.epdc-party-server.uri>lb://epdc-party-server</gateway.routes.epdc-party-server.uri> <gateway.routes.epdc-issue-server.uri>lb://epdc-issue-server</gateway.routes.epdc-issue-server.uri>
<gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri> <gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri>
<gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri> <gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri>
<gateway.routes.epdc-demo-server.uri>lb://epdc-demo-server</gateway.routes.epdc-demo-server.uri> <gateway.routes.epdc-demo-server.uri>lb://epdc-demo-server</gateway.routes.epdc-demo-server.uri>
@ -169,7 +169,7 @@
<gateway.routes.epdc-neighbor-server.uri>lb://epdc-neighbor-server</gateway.routes.epdc-neighbor-server.uri> <gateway.routes.epdc-neighbor-server.uri>lb://epdc-neighbor-server</gateway.routes.epdc-neighbor-server.uri>
<gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri> <gateway.routes.epdc-news-server.uri>lb://epdc-news-server</gateway.routes.epdc-news-server.uri>
<gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri> <gateway.routes.epdc-oss-server.uri>lb://epdc-oss-server</gateway.routes.epdc-oss-server.uri>
<gateway.routes.epdc-party-server.uri>lb://epdc-party-server</gateway.routes.epdc-party-server.uri> <gateway.routes.epdc-issue-server.uri>lb://epdc-issue-server</gateway.routes.epdc-issue-server.uri>
<gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri> <gateway.routes.epdc-services-server.uri>lb://epdc-services-server</gateway.routes.epdc-services-server.uri>
<gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri> <gateway.routes.epdc-user-server.uri>lb://epdc-user-server</gateway.routes.epdc-user-server.uri>
<gateway.routes.epdc-demo-server.uri>lb://epdc-demo-server</gateway.routes.epdc-demo-server.uri> <gateway.routes.epdc-demo-server.uri>lb://epdc-demo-server</gateway.routes.epdc-demo-server.uri>

6
esua-epdc/epdc-gateway/src/main/resources/application.yml

@ -96,11 +96,11 @@ spring:
filters: filters:
- StripPrefix=0 - StripPrefix=0
#党群议事模块 #党群议事模块
- id: epdc-party-server - id: epdc-issue-server
uri: @gateway.routes.epdc-party-server.uri@ uri: @gateway.routes.epdc-issue-server.uri@
order: 11 order: 11
predicates: predicates:
- Path=/party/** - Path=/issue/**
filters: filters:
- StripPrefix=0 - StripPrefix=0
#生活服务模块 #生活服务模块

79
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/pom.xml

@ -13,7 +13,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<activiti.version>5.22.0</activiti.version> <activiti.version>6.0.0</activiti.version>
</properties> </properties>
<dependencies> <dependencies>
@ -41,8 +41,8 @@
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.codecentric</groupId> <groupId>de.codecentric</groupId>
@ -60,41 +60,48 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-explorer</artifactId>
<version>${activiti.version}</version>
<exclusions>
<exclusion>
<artifactId>vaadin</artifactId>
<groupId>com.vaadin</groupId>
</exclusion>
<exclusion>
<artifactId>dcharts-widget</artifactId>
<groupId>org.vaadin.addons</groupId>
</exclusion>
<exclusion>
<artifactId>activiti-simple-workflow</artifactId>
<groupId>org.activiti</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-diagram-rest</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-modeler</artifactId>
<version>${activiti.version}</version>
</dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>9057</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<server.port>9057</server.port>
<spring.profiles.active>test</spring.profiles.active>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<server.port>9057</server.port>
<spring.profiles.active>prod</spring.profiles.active>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>47.104.224.45:8848</nacos.server-addr>
</properties>
</profile>
</profiles>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>

43
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/processon/yishi.bpmn

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:activiti="http://activiti.org/bpmn"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:tns="http://www.activiti.org/test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
expressionLanguage="http://www.w3.org/1999/XPath"
id="m1566628843418"
name=""
targetNamespace="http://www.activiti.org/test"
typeLanguage="http://www.w3.org/2001/XMLSchema">
<process xmlns="" id="myProcess_1" isClosed="false" isExecutable="true"
processType="None">
<startEvent id="_2" name="开始"/>
<userTask activiti:exclusive="true" id="_3" name="UserTask">
<extensionElements>
<activiti:taskListener event="create"/>
</extensionElements>
</userTask>
</process>
<bpmndi:BPMNDiagram xmlns=""
documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0"
id="Diagram-_1"
name="New Diagram">
<bpmndi:BPMNPlane bpmnElement="myProcess_1">
<bpmndi:BPMNShape bpmnElement="_2" id="Shape-_2">
<omgdc:Bounds height="32.0" width="32.0" x="245.0" y="100.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="32.0" width="32.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" id="Shape-_3">
<omgdc:Bounds height="55.0" width="85.0" x="255.0" y="200.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="55.0" width="85.0" x="0.0" y="0.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

4
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/ActivitiApplication.java

@ -1,8 +1,8 @@
/** /**
* Copyright (c) 2018 人人开源 All rights reserved. * Copyright (c) 2018 人人开源 All rights reserved.
* * <p>
* https://www.renren.io * https://www.renren.io
* * <p>
* 版权所有侵权必究 * 版权所有侵权必究
*/ */

92
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/controller/ActModelController.java

@ -1,92 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.annotation.LogOperation;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.ModelDTO;
import com.elink.esua.epdc.service.ActModelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.repository.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 模型管理
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
@RequestMapping("model")
@Api(tags="模型管理")
public class ActModelController {
@Autowired
private ActModelService actModelService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "key", value = "key", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "name", value = "name", paramType = "query", dataType="String")
})
public Result<PageData<Model>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<Model> page = actModelService.page(params);
return new Result<PageData<Model>>().ok(page);
}
@PostMapping
@ApiOperation("新增模型")
@LogOperation("新增模型")
public Result save(@RequestBody ModelDTO dto) throws Exception{
//效验数据
ValidatorUtils.validateEntity(dto);
actModelService.save(dto.getName(), dto.getKey(), dto.getDescription());
return new Result();
}
@PostMapping("deploy/{id}")
@ApiOperation("部署")
@LogOperation("部署")
public Result deploy(@PathVariable("id") String id) {
actModelService.deploy(id);
return new Result();
}
@GetMapping("export/{id}")
@ApiOperation("导出")
@LogOperation("导出")
public void export(@PathVariable("id") String id, @ApiIgnore HttpServletResponse response) {
actModelService.export(id, response);
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody String[] ids) {
for(String id : ids) {
actModelService.delete(id);
}
return new Result();
}
}

18
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/controller/ActProcessController.java

@ -88,15 +88,15 @@ public class ActProcessController {
return new Result(); return new Result();
} }
@PostMapping("convertToModel/{id}") // @PostMapping("convertToModel/{id}")
@ApiOperation("将部署的流程转换为模型") // @ApiOperation("将部署的流程转换为模型")
@LogOperation("将部署的流程转换为模型") // @LogOperation("将部署的流程转换为模型")
@ApiImplicitParam(name = "id", value = "流程ID", paramType = "query", dataType="String") // @ApiImplicitParam(name = "id", value = "流程ID", paramType = "query", dataType="String")
public Result convertToModel(@PathVariable("id") String id) throws Exception { // public Result convertToModel(@PathVariable("id") String id) throws Exception {
actProcessService.convertToModel(id); // actProcessService.convertToModel(id);
//
return new Result(); // return new Result();
} // }
@DeleteMapping @DeleteMapping
@ApiOperation("删除流程") @ApiOperation("删除流程")

38
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/main/StencilsetRestResource.java

@ -1,38 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.elink.esua.epdc.editor.main;
import org.activiti.engine.ActivitiException;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.InputStream;
/**
* Stencilset
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
@RequestMapping("service")
public class StencilsetRestResource {
@RequestMapping(value="/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
public @ResponseBody String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) {
throw new ActivitiException("Error while loading stencil set", e);
}
}
}

69
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/model/ModelEditorJsonRestResource.java

@ -1,69 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.elink.esua.epdc.editor.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* Model Editor
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
@RequestMapping("service")
public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
}
modelNode.put(MODEL_ID, model.getId());
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
modelNode.set("model", editorJsonNode);
} catch (Exception e) {
LOGGER.error("Error creating model JSON", e);
throw new ActivitiException("Error creating model JSON", e);
}
}
return modelNode;
}
}

90
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/editor/model/ModelSaveRestResource.java

@ -1,90 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.elink.esua.epdc.editor.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.elink.esua.epdc.commons.tools.xss.XssHttpServletRequestWrapper;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/**
* Model Rest
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
@RequestMapping("service")
public class ModelSaveRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, HttpServletRequest request) {
try {
HttpServletRequest orgRequest = XssHttpServletRequestWrapper.getOrgRequest(request);
String name = orgRequest.getParameter("name");
String description = orgRequest.getParameter("description");
String jsonXml = orgRequest.getParameter("json_xml");
String svgXml = orgRequest.getParameter("svg_xml");
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, name);
modelJson.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelJson.toString());
model.setName(name);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(svgXml.getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
}
}

161
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/service/ActModelService.java

@ -8,31 +8,16 @@
package com.elink.esua.epdc.service; package com.elink.esua.epdc.service;
import com.elink.esua.epdc.exception.ModuleErrorCode;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.exception.ModuleErrorCode; import com.fasterxml.jackson.databind.ObjectMapper;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model; import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ModelQuery; import org.activiti.engine.repository.ModelQuery;
import org.activiti.engine.repository.ProcessDefinition;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -75,78 +60,78 @@ public class ActModelService {
return new PageData<>(list, (int)modelQuery.count()); return new PageData<>(list, (int)modelQuery.count());
} }
public void save(String name, String key, String description) throws UnsupportedEncodingException { // public void save(String name, String key, String description) throws UnsupportedEncodingException {
//新建一个空模型 // //新建一个空模型
Model model = repositoryService.newModel(); // Model model = repositoryService.newModel();
//
//metaInfo信息 // //metaInfo信息
ObjectNode metaInfo = objectMapper.createObjectNode(); // ObjectNode metaInfo = objectMapper.createObjectNode();
metaInfo.put(ModelDataJsonConstants.MODEL_NAME, name); // metaInfo.put(ModelDataJsonConstants.MODEL_NAME, name);
metaInfo.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description); // metaInfo.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
metaInfo.put(ModelDataJsonConstants.MODEL_REVISION, model.getVersion()); // metaInfo.put(ModelDataJsonConstants.MODEL_REVISION, model.getVersion());
//
model.setKey(key); // model.setKey(key);
model.setName(name); // model.setName(name);
model.setMetaInfo(metaInfo.toString()); // model.setMetaInfo(metaInfo.toString());
//
repositoryService.saveModel(model); // repositoryService.saveModel(model);
//
ObjectNode editorNode = objectMapper.createObjectNode(); // ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas"); // editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas"); // editorNode.put("resourceId", "canvas");
ObjectNode stencilset = objectMapper.createObjectNode(); // ObjectNode stencilset = objectMapper.createObjectNode();
stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#"); // stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.set("stencilset", stencilset); // editorNode.set("stencilset", stencilset);
repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8")); // repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8"));
} // }
//
public void deploy(String id) { // public void deploy(String id) {
try { // try {
Model model = repositoryService.getModel(id); // Model model = repositoryService.getModel(id);
BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); // BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId())); // JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); // BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter(); // BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel); // byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
//
String processName = model.getName(); // String processName = model.getName();
if (!StringUtils.endsWith(processName, ".bpmn20.xml")){ // if (!StringUtils.endsWith(processName, ".bpmn20.xml")){
processName += ".bpmn20.xml"; // processName += ".bpmn20.xml";
} // }
//
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes); // ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy(); // Deployment deployment = repositoryService.createDeployment().name(model.getName()).addInputStream(processName, in).deploy();
//
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list(); // List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
if (list.size() == 0){ // if (list.size() == 0){
throw new RenException(ModuleErrorCode.ACT_DEPLOY_ERROR); // throw new RenException(ModuleErrorCode.ACT_DEPLOY_ERROR);
} // }
} catch (Exception e) { // } catch (Exception e) {
throw new RenException(ModuleErrorCode.ACT_MODEL_IMG_ERROR, e); // throw new RenException(ModuleErrorCode.ACT_MODEL_IMG_ERROR, e);
} // }
} // }
//
/** // /**
* 导出模型 // * 导出模型
*/ // */
public void export(String id, HttpServletResponse response) { // public void export(String id, HttpServletResponse response) {
try { // try {
Model model = repositoryService.getModel(id); // Model model = repositoryService.getModel(id);
BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); // BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId())); // JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(model.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); // BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter(); // BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel); // byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
//
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes); // ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
IOUtils.copy(in, response.getOutputStream()); // IOUtils.copy(in, response.getOutputStream());
String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml"; // String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
response.setHeader("Content-Disposition", "attachment; filename=" + filename); // response.setHeader("Content-Disposition", "attachment; filename=" + filename);
response.flushBuffer(); // response.flushBuffer();
} catch (Exception e) { // } catch (Exception e) {
throw new RenException(ModuleErrorCode.ACT_MODEL_EXPORT_ERROR, id); // throw new RenException(ModuleErrorCode.ACT_MODEL_EXPORT_ERROR, id);
} // }
} // }
/** /**
* 删除模型 * 删除模型

83
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/java/com/elink/esua/epdc/service/ActProcessService.java

@ -8,20 +8,12 @@
package com.elink.esua.epdc.service; package com.elink.esua.epdc.service;
import com.elink.esua.epdc.exception.ModuleErrorCode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.exception.RenException; import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.page.PageData;
import org.activiti.bpmn.converter.BpmnXMLConverter; import com.elink.esua.epdc.exception.ModuleErrorCode;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.RepositoryService; import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery; import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
@ -30,13 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -147,40 +134,40 @@ public class ActProcessService {
repositoryService.suspendProcessDefinitionById(id, true, null); repositoryService.suspendProcessDefinitionById(id, true, null);
} }
/** // /**
* 将部署的流程转换为模型 // * 将部署的流程转换为模型
* @param id 流程ID // * @param id 流程ID
*/ // */
public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException { // public Model convertToModel(String id) throws UnsupportedEncodingException, XMLStreamException {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult(); // ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();
InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), // InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
processDefinition.getResourceName()); // processDefinition.getResourceName());
XMLInputFactory xif = XMLInputFactory.newInstance(); // XMLInputFactory xif = XMLInputFactory.newInstance();
InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8"); // InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
XMLStreamReader xtr = xif.createXMLStreamReader(in); // XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr); // BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
//
BpmnJsonConverter converter = new BpmnJsonConverter(); // BpmnJsonConverter converter = new BpmnJsonConverter();
ObjectNode modelNode = converter.convertToJson(bpmnModel); // ObjectNode modelNode = converter.convertToJson(bpmnModel);
Model modelData = repositoryService.newModel(); // Model modelData = repositoryService.newModel();
modelData.setKey(processDefinition.getKey()); // modelData.setKey(processDefinition.getKey());
modelData.setName(processDefinition.getResourceName()); // modelData.setName(processDefinition.getResourceName());
modelData.setCategory(processDefinition.getCategory()); // modelData.setCategory(processDefinition.getCategory());
modelData.setDeploymentId(processDefinition.getDeploymentId()); // modelData.setDeploymentId(processDefinition.getDeploymentId());
modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1))); // modelData.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(modelData.getKey()).count()+1)));
//
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode(); // ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName()); // modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion()); // modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, modelData.getVersion());
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription()); // modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
modelData.setMetaInfo(modelObjectNode.toString()); // modelData.setMetaInfo(modelObjectNode.toString());
//
repositoryService.saveModel(modelData); // repositoryService.saveModel(modelData);
//
repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8")); // repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
//
return modelData; // return modelData;
} // }
/** /**
* 删除部署 * 删除部署

59
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/application.yml

@ -1,5 +1,5 @@
server: server:
port: 8086 port: @server.port@
servlet: servlet:
context-path: /activiti context-path: /activiti
@ -16,29 +16,39 @@ spring:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
activiti: activiti:
check-process-definitions: false check-process-definitions: true
database-schema-update: true
process-definition-location-prefix: classpath:/processes/
redis: redis:
database: 0 database: 2
host: redis host: 47.104.224.45
timeout: 30s timeout: 30s
port: 6379 port: 6379
password: 123456 password: elink@888
datasource: datasource:
druid: druid:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/renren_cloud?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://47.104.224.45:3308/epdc_activiti?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: renren username: root
password: 123456 password: shibei@888
cloud:
nacos:
discovery:
server-addr: @nacos.server-addr@
register-enabled: @nacos.register-enabled@
alibaba:
seata:
tx-service-group: epdc-activiti-server-fescar-service-group
#Oracle #Oracle
# driver-class-name: oracle.jdbc.OracleDriver # driver-class-name: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@localhost:1521:xe # url: jdbc:oracle:thin:@localhost:1521:xe
# username: renren_cloud # username: renren_cloud
# password: 123456 # password: 123456
#SQLServer #SQLServer
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=renren_cloud # url: jdbc:sqlserver://localhost:1433;DatabaseName=renren_cloud
# username: sa # username: sa
# password: 123456 # password: 123456
#postgresql #postgresql
# driver-class-name: org.postgresql.Driver # driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/renren_cloud # url: jdbc:postgresql://localhost:5432/renren_cloud
@ -54,23 +64,10 @@ management:
health: health:
show-details: ALWAYS show-details: ALWAYS
eureka:
instance:
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
metadata-map:
management:
context-path: ${server.servlet.context-path}/actuator
health-check-url-path: ${server.servlet.context-path}/actuator/health
status-page-url-path: ${server.servlet.context-path}/actuator/info
client:
service-url:
defaultZone: http://eureka:8761/eureka/
mybatis-plus: mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: io.renren.entity typeAliasesPackage: com.elink.esua.epdc.entity
global-config: global-config:
#数据库相关配置 #数据库相关配置
db-config: db-config:

BIN
esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/processes/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/registry.conf → esua-epdc/epdc-module/epdc-activiti/epdc-activiti-server/src/main/resources/registry.conf

7
esua-epdc/epdc-module/epdc-api/epdc-api-server/pom.xml

@ -41,13 +41,18 @@
<artifactId>spring-boot-admin-starter-client</artifactId> <artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.boot.admin.version}</version> <version>${spring.boot.admin.version}</version>
</dependency> </dependency>
<!-- nacos start --> <!-- nacos start -->
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<!-- nacos end --> <!-- nacos end -->
<!--版本控制-->
<dependency>
<groupId>com.esua.epdc</groupId>
<artifactId>epdc-commons-api-version-control</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

18
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/rest/v2/DemoV2Controller.java

@ -0,0 +1,18 @@
package com.elink.esua.epdc.rest.v2;
import com.elink.esua.epdc.commons.api.version.ApiVersion;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author yujintao
* @email yujintao@elink-cn.com
* @date 2019/9/2 14:29
*/
@ApiVersion(2)
@RestController("DemoControllerV2")
@RequestMapping("/demo" + Constant.VERSION_CONTROL)
public class DemoV2Controller {
}

2
esua-epdc/epdc-module/epdc-app/epdc-app-client/pom.xml

@ -35,7 +35,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.esua.epdc</groupId> <groupId>com.esua.epdc</groupId>
<artifactId>epdc-party-client</artifactId> <artifactId>epdc-issue-client</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>

5
esua-epdc/epdc-module/epdc-demo/epdc-demo-server/pom.xml

@ -53,6 +53,11 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId> <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency> </dependency>
<dependency>
<groupId>net.rakugakibox.spring.boot</groupId>
<artifactId>orika-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

2
esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/entity/DemoEntity.java

@ -22,7 +22,7 @@ import java.io.Serializable;
@Data @Data
@TableName("demo") @TableName("demo")
public class DemoEntity implements Serializable { public class DemoEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 8109944892257584088L;
/** /**
* 用户ID * 用户ID

18
esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/entity/TransforDemoEntity.java

@ -0,0 +1,18 @@
package com.elink.esua.epdc.entity;
import lombok.Data;
/**
*
* @author yujintao
* @email yujintao@elink-cn.com
* @date 2019/9/2 13:54
*/
@Data
public class TransforDemoEntity {
private Long demoId;
private String demoName;
private int demoAge;
}

26
esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/main/java/com/elink/esua/epdc/transfor/Demo2DemoTransforEntity.java

@ -0,0 +1,26 @@
package com.elink.esua.epdc.transfor;
import com.elink.esua.epdc.entity.DemoEntity;
import com.elink.esua.epdc.entity.TransforDemoEntity;
import ma.glasnost.orika.MapperFactory;
import net.rakugakibox.spring.boot.orika.OrikaMapperFactoryConfigurer;
import org.springframework.stereotype.Component;
/**
* @author yujintao
* @email yujintao@elink-cn.com
* @date 2019/9/2 11:21
*/
@Component
public class Demo2DemoTransforEntity implements OrikaMapperFactoryConfigurer {
@Override
public void configure(MapperFactory orikaMapperFactory) {
orikaMapperFactory.classMap(DemoEntity.class, TransforDemoEntity.class)
.field("id", "demoId")
.field("name", "demoName")
.field("age", "demoAge")
.byDefault()
.register();
}
}

38
esua-epdc/epdc-module/epdc-demo/epdc-demo-server/src/test/java/com/elink/esua/epdc/OrikaTest.java

@ -0,0 +1,38 @@
package com.elink.esua.epdc;
import com.alibaba.fastjson.JSON;
import com.elink.esua.epdc.entity.DemoEntity;
import com.elink.esua.epdc.entity.TransforDemoEntity;
import ma.glasnost.orika.MapperFacade;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* 实体映射测试类
*
* @author yujintao
* @email yujintao@elink-cn.com
* @date 2019/9/2 13:25
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrikaTest {
@Autowired
private MapperFacade orikaMapper;
@Test
public void Test() {
DemoEntity demoEntity = new DemoEntity();
demoEntity.setId(1000L);
demoEntity.setName("name");
demoEntity.setAge(19);
TransforDemoEntity transforEntity = orikaMapper.map(demoEntity, TransforDemoEntity.class);
System.out.println(JSON.toJSONString(transforEntity));
}
}

4
esua-epdc/epdc-module/epdc-party/epdc-party-client/pom.xml → esua-epdc/epdc-module/epdc-issue/epdc-issue-client/pom.xml

@ -3,13 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>epdc-party</artifactId> <artifactId>epdc-issue</artifactId>
<groupId>com.esua.epdc</groupId> <groupId>com.esua.epdc</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>epdc-party-client</artifactId> <artifactId>epdc-issue-client</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>

0
esua-epdc/epdc-module/epdc-party/epdc-party-client/src/main/java/com/elink/esua/epdc/epdc.gitkeep → esua-epdc/epdc-module/epdc-issue/epdc-issue-client/src/main/java/com/elink/esua/epdc/epdc.gitkeep

6
esua-epdc/epdc-module/epdc-party/epdc-party-server/pom.xml → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/pom.xml

@ -3,19 +3,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>epdc-party</artifactId> <artifactId>epdc-issue</artifactId>
<groupId>com.esua.epdc</groupId> <groupId>com.esua.epdc</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>epdc-party-server</artifactId> <artifactId>epdc-issue-server</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.esua.epdc</groupId> <groupId>com.esua.epdc</groupId>
<artifactId>epdc-party-client</artifactId> <artifactId>epdc-issue-client</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>

4
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/java/com/elink/esua/epdc/PartyApplication.java → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/java/com/elink/esua/epdc/IssueApplication.java

@ -22,10 +22,10 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
public class PartyApplication { public class IssueApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(PartyApplication.class, args); SpringApplication.run(IssueApplication.class, args);
} }
} }

2
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java

@ -21,6 +21,6 @@ import org.springframework.stereotype.Service;
public class ModuleConfigImpl implements ModuleConfig { public class ModuleConfigImpl implements ModuleConfig {
@Override @Override
public String getName() { public String getName() {
return "party"; return "issue";
} }
} }

6
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/application.yml → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/application.yml

@ -1,11 +1,11 @@
server: server:
port: @server.port@ port: @server.port@
servlet: servlet:
context-path: /party context-path: /issue
spring: spring:
application: application:
name: epdc-party-server name: epdc-issue-server
# 环境 dev|test|prod # 环境 dev|test|prod
profiles: profiles:
active: @spring.profiles.active@ active: @spring.profiles.active@
@ -28,7 +28,7 @@ spring:
register-enabled: @nacos.register-enabled@ register-enabled: @nacos.register-enabled@
alibaba: alibaba:
seata: seata:
tx-service-group: epdc-party-server-fescar-service-group tx-service-group: epdc-issue-server-fescar-service-group
datasource: datasource:
druid: druid:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/messages.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/messages_en_US.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_en_US.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/messages_zh_CN.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_zh_CN.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/messages_zh_TW.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/messages_zh_TW.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/validation.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/validation_en_US.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_en_US.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/validation_zh_CN.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_zh_CN.properties

0
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/i18n/validation_zh_TW.properties → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/i18n/validation_zh_TW.properties

2
esua-epdc/epdc-module/epdc-party/epdc-party-server/src/main/resources/logback-spring.xml → esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/logback-spring.xml

@ -2,7 +2,7 @@
<configuration> <configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/> <include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="log.path" value="logs/party"/> <property name="log.path" value="logs/issue"/>
<!-- 彩色日志格式 --> <!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" <property name="CONSOLE_LOG_PATTERN"

21
esua-epdc/epdc-module/epdc-issue/epdc-issue-server/src/main/resources/registry.conf

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

6
esua-epdc/epdc-module/epdc-party/pom.xml → esua-epdc/epdc-module/epdc-issue/pom.xml

@ -9,11 +9,11 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>epdc-party</artifactId> <artifactId>epdc-issue</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>epdc-party-client</module> <module>epdc-issue-client</module>
<module>epdc-party-server</module> <module>epdc-issue-server</module>
</modules> </modules>

2
esua-epdc/epdc-module/pom.xml

@ -21,7 +21,7 @@
<module>epdc-api</module> <module>epdc-api</module>
<module>epdc-heart</module> <module>epdc-heart</module>
<module>epdc-news</module> <module>epdc-news</module>
<module>epdc-party</module> <module>epdc-issue</module>
<module>epdc-neighbor</module> <module>epdc-neighbor</module>
<module>epdc-services</module> <module>epdc-services</module>
<module>epdc-app</module> <module>epdc-app</module>

Loading…
Cancel
Save