update
This commit is contained in:
12
ebpm-process-rest/Dockerfile
Normal file
12
ebpm-process-rest/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM openjdk:8u212-jre-alpine
|
||||
ENV SPRING_PROFILES_ACTIVE=dev
|
||||
ENV TIME_ZONE=Asia/Shanghai
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories
|
||||
RUN apk add --update font-adobe-100dpi ttf-dejavu fontconfig
|
||||
RUN apk update && apk add --no-cache tzdata curl\
|
||||
&& echo "${TIME_ZONE}" > /etc/timezone \
|
||||
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
|
||||
COPY ./target/ebpm-process-rest-1.0.0-SNAPSHOT.jar /
|
||||
WORKDIR /
|
||||
EXPOSE 8081
|
||||
CMD ["java","-jar","ebpm-process-rest-1.0.0-SNAPSHOT.jar"]
|
||||
6
ebpm-process-rest/Dockerfile_prod
Normal file
6
ebpm-process-rest/Dockerfile_prod
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM cr.registry.res.zgs.yun/dzy/openjdk:8u212-jre-alpine
|
||||
|
||||
COPY ./target/ebpm-process-rest-1.0.0-SNAPSHOT.jar /
|
||||
WORKDIR /
|
||||
EXPOSE 8081
|
||||
CMD ["java","-jar","ebpm-process-rest-1.0.0-SNAPSHOT.jar"]
|
||||
12
ebpm-process-rest/Dockerfile_test
Normal file
12
ebpm-process-rest/Dockerfile_test
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM openjdk:8u212-jre-alpine
|
||||
ENV SPRING_PROFILES_ACTIVE=dev
|
||||
ENV TIME_ZONE=Asia/Shanghai
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories
|
||||
RUN apk add --update font-adobe-100dpi ttf-dejavu fontconfig
|
||||
RUN apk update && apk add --no-cache tzdata curl\
|
||||
&& echo "${TIME_ZONE}" > /etc/timezone \
|
||||
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime
|
||||
COPY ./target/ebpm-process-rest-1.0.0-SNAPSHOT.jar /
|
||||
WORKDIR /
|
||||
EXPOSE 8081
|
||||
CMD ["java","-jar","ebpm-process-rest-1.0.0-SNAPSHOT.jar"]
|
||||
187
ebpm-process-rest/pom.xml
Normal file
187
ebpm-process-rest/pom.xml
Normal file
@@ -0,0 +1,187 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>bpmc</artifactId>
|
||||
<groupId>com.rzdata</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ebpm-process-rest</artifactId>
|
||||
<name>bpmc-rest</name>
|
||||
<url></url>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<pagehelper.version>5.1.2</pagehelper.version>
|
||||
<mybatis-spring.version>2.0.4</mybatis-spring.version>
|
||||
<mybatis.version>3.5.6</mybatis.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rzdata</groupId>
|
||||
<artifactId>ebpm-process-code</artifactId>
|
||||
<version>${bpmc.code}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-framework start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- spring-framework end -->
|
||||
<!-- commons管理 start -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>${xstream.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- commons管理 end -->
|
||||
<!-- guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
<!-- mybatis -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>${mybatis.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>${mybatis-spring.version}</version>
|
||||
</dependency>
|
||||
<!-- swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
||||
<version>2.2.8.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>../ebpm-process-code/lib</directory>
|
||||
<targetPath>BOOT-INF/lib/</targetPath>
|
||||
<includes>
|
||||
<include>**/*.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.blueland.ebpm.BpmcRestApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.blueland.ebpm;
|
||||
|
||||
import com.blueland.bpm.common.util.ApplicationContextHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
/**
|
||||
* @description 启动类
|
||||
* @author hanj
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = { "com.blueland.*", "org.activiti.*" })
|
||||
@ServletComponentScan(basePackages = { "com.blueland.*"})
|
||||
@EnableTransactionManagement
|
||||
@EnableAspectJAutoProxy
|
||||
public class BpmcRestApplication {
|
||||
|
||||
/**
|
||||
* @description 容器状态监听
|
||||
* @author hanj
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
protected ServletContextListener listener() {
|
||||
return new ServletContextListener() {
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
log.info("ServletContext initialized");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
log.info("ServletContext destroyed");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化ApplicationContextHolder
|
||||
* @author hanj
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
protected ApplicationContextHolder applicationContextHolder() {
|
||||
return new ApplicationContextHolder();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化并启动Spring容器
|
||||
* @author hanj
|
||||
* @param args
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BpmcRestApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ActivityDefinitionBean {
|
||||
@JsonProperty
|
||||
private String procDefId;
|
||||
private String procDefName;
|
||||
private String actDefId;
|
||||
private String actDefName;
|
||||
private String actDefType;
|
||||
private String actDefChildType;
|
||||
private String actDefDealType;
|
||||
private String pageUrl;
|
||||
//private String cportalProtocol;
|
||||
private String mportalUrl;
|
||||
//private String mportalProtocol;
|
||||
private String otherSysDealStatus;
|
||||
private boolean isMulti;
|
||||
private boolean isNotSelectReceiver;
|
||||
private String jumpType;
|
||||
private String ideaDisplayArea;
|
||||
private String showIdea;
|
||||
private Integer actLimitTime;
|
||||
//private boolean isAsync;
|
||||
//private boolean subProcAct;
|
||||
private String description;
|
||||
private Integer actDefOrder;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ActivityInstanceBean {
|
||||
private String actInstId;
|
||||
private String procInstId;
|
||||
private String procInstTitle;
|
||||
private String procDefId;
|
||||
private String procDefName;
|
||||
private String actDefId;
|
||||
private String actDefName;
|
||||
private String prevActInstId;
|
||||
private String prevActDefId;
|
||||
private String prevActDefName;
|
||||
private String sendUserId;
|
||||
private String sendUserName;
|
||||
private String sendUserOrgId;
|
||||
private String sendUserOrgName;
|
||||
//private String receiver;
|
||||
private String receiverUserId;
|
||||
private String receiverUserName;
|
||||
private String receiverUserOrgId;
|
||||
private String receiverUserOrgName;
|
||||
private String actInstState;
|
||||
private Date createTime;
|
||||
private Date finishTime;
|
||||
private String dueDate;
|
||||
private String tenantId;
|
||||
private String owner;
|
||||
//private String URL;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ActivityOpBean {
|
||||
|
||||
private String opId;
|
||||
private String opName;
|
||||
private String opType;
|
||||
private String opTypeVal;
|
||||
//private String opClassPath;
|
||||
private String opRemark;
|
||||
private Integer opSort;
|
||||
private String opDefaultBind;
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.model.ActivityOperatePower;
|
||||
import com.blueland.bpm.engine.config.model.DataObject;
|
||||
import com.blueland.bpm.engine.config.model.DataObjectRelation;
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.model.SysGlType;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessLogModel;
|
||||
import com.blueland.bpm.idea.model.CommonIdeaEntity;
|
||||
|
||||
/**
|
||||
* 转换引擎内部的数据结构为对外提供的格式,严格跟接口文档一致
|
||||
* @author janus
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class BeansBuilder {
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
|
||||
private static Map<String, ApplicationEntity> applications = new HashMap<String, ApplicationEntity>();
|
||||
|
||||
public String getApplicationUrl(String app_id) {
|
||||
ApplicationEntity app = applications.get(app_id);
|
||||
if(app != null)
|
||||
return app.getAppAccessUrl();
|
||||
|
||||
app = applicationManager.getById(app_id);
|
||||
if(app!=null) {
|
||||
applications.put(app_id, app);
|
||||
return app.getAppAccessUrl();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public ProcessDefinitionBean build(ProcessDefinitionModel model) {
|
||||
ProcessDefinitionBean bean = new ProcessDefinitionBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
ProcessInfoConfig config = model.getProcessInfoConfig();
|
||||
bean.setDescription(config.getRemark());
|
||||
bean.setCreateTime(config.getCreateTime());
|
||||
bean.setLastUpdateTime(config.getLastUpdateTime());
|
||||
bean.setPageUrl(config.getProcessPageUrl());
|
||||
//bean.setMportalProtocol(config.getMprotocol());
|
||||
bean.setMportalUrl(config.getMurl());
|
||||
bean.setOtherSysDealStatus(config.getOtherSysDealStatus());
|
||||
//bean.setCportalProtocol(config.getCprotocol());
|
||||
bean.setHandlerClassPath(config.getProcessHandlerClassPath());
|
||||
bean.setTypeId(config.getProcessTypeId());
|
||||
bean.setTypeName(config.getProcessTypeName());
|
||||
bean.setOrder(config.getProcessStartOrder());
|
||||
bean.setShow(config.getProcessStartIsshow().equals("Y"));
|
||||
bean.setRelease(config.getProcessMgrState().equals("RELEASE"));
|
||||
bean.setArisCode(config.getArisCode());
|
||||
return bean;
|
||||
}
|
||||
|
||||
public ActivityDefinitionBean build(ActivityDefinitionModel model) {
|
||||
ActivityDefinitionBean bean = new ActivityDefinitionBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
bean.setActDefType(model.getActType());
|
||||
ActivityInfoConfig config = model.getActivityInfoConfig();
|
||||
bean.setActDefDealType(config.getActivityDefDealType());
|
||||
bean.setActDefChildType(config.getActivityDefChildType());
|
||||
bean.setPageUrl(config.getActivityPageInfo());
|
||||
//bean.setMportalProtocol(config.getMprotocol());
|
||||
bean.setMportalUrl(config.getMurl());
|
||||
bean.setOtherSysDealStatus(config.getOtherSysDealStatus());
|
||||
//bean.setCportalProtocol(config.getCprotocol());
|
||||
bean.setJumpType(config.getJumpType());
|
||||
bean.setIdeaDisplayArea(config.getIdeaDisplayArea());
|
||||
bean.setShowIdea(config.getIsShowIdea());
|
||||
bean.setActLimitTime(config.getActivityLimitTime());
|
||||
bean.setDescription(config.getRemark());
|
||||
bean.setActDefOrder(config.getActivityOrder());
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<ActivityDefinitionBean> buildActDefList(List<ActivityDefinitionModel> list){
|
||||
List<ActivityDefinitionBean> result = new ArrayList<ActivityDefinitionBean>();
|
||||
for (int i=0; i<list.size(); i++) {
|
||||
ActivityDefinitionBean bean = build(list.get(i));
|
||||
result.add(bean);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProcessDefinitionBean> buildProcDefList(List<ProcessDefinitionModel> list){
|
||||
List<ProcessDefinitionBean> result = new ArrayList<ProcessDefinitionBean>();
|
||||
for (int i=0; i<list.size(); i++) {
|
||||
ProcessDefinitionBean bean = build(list.get(i));
|
||||
result.add(bean);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProcessInstanceBean> buildProcInstList(List<ProcessInstanceModel> list){
|
||||
List<ProcessInstanceBean> result = new ArrayList<ProcessInstanceBean>();
|
||||
for(int i=0;i<list.size();i++) {
|
||||
ProcessInstanceBean bean = build(list.get(i));
|
||||
result.add(bean);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ProcessDefinitionBean> build(Map<String,List<ProcessDefinitionModel>> maps){
|
||||
List<ProcessDefinitionBean> result = new ArrayList<ProcessDefinitionBean>();
|
||||
for(Map.Entry<String, List<ProcessDefinitionModel>> entry : maps.entrySet()) {
|
||||
List<ProcessDefinitionBean> dest = buildProcDefList(entry.getValue());
|
||||
result.addAll(dest);
|
||||
}
|
||||
Collections.sort(result, new Comparator<ProcessDefinitionBean>(){
|
||||
public int compare(ProcessDefinitionBean arg0, ProcessDefinitionBean arg1) {
|
||||
if(arg0.getOrder() == null)
|
||||
return 1;
|
||||
if(arg1.getOrder() == null)
|
||||
return -1;
|
||||
return arg0.getOrder().compareTo(arg1.getOrder());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public ActivityInstanceBean build(ActivityInstanceModel model) {
|
||||
ActivityInstanceBean bean = new ActivityInstanceBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
bean.setProcInstTitle(model.getProcTitle());
|
||||
bean.setActInstState(model.getActState());
|
||||
bean.setSendUserOrgId(model.getSenderOrgId());
|
||||
bean.setSendUserOrgName(model.getSenderOrgName());
|
||||
bean.setReceiverUserOrgId(model.getReceiverOrgId());
|
||||
bean.setReceiverUserOrgName(model.getReceiverOrgName());
|
||||
// String URL = this.getApplicationUrl(model.getTenantId());
|
||||
// if(URL.indexOf('?') != -1)
|
||||
// URL += "&procDefId=" + bean.getProcDefId();
|
||||
// else
|
||||
// URL += "?procDefId=" + bean.getProcDefId();
|
||||
// URL += "&procInstId=" + bean.getProcInstId() + "&actDefId=" + bean.getActDefId() + "&actInstId=" + bean.getActInstId();
|
||||
return bean;
|
||||
}
|
||||
|
||||
public Page<ActivityInstanceBean> buildActInstPage(Page<ActivityInstanceModel> page){
|
||||
Page<ActivityInstanceBean> result = new Page<ActivityInstanceBean>(page.getThisPageNumber(),page.getPageSize(),page.getTotalCount());
|
||||
BeanUtils.copyProperties(page, result, "result");
|
||||
List<ActivityInstanceBean> beans = new ArrayList<ActivityInstanceBean>();
|
||||
for(int i=0;i<page.getResult().size();i++) {
|
||||
beans.add(build(page.getResult().get(i)));
|
||||
}
|
||||
result.setResult(beans);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ActivityInstanceBean> buildActInstList(List<ActivityInstanceModel> list){
|
||||
List<ActivityInstanceBean> result = new ArrayList<ActivityInstanceBean>();
|
||||
for(ActivityInstanceModel model : list) {
|
||||
result.add(this.build(model));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ProcessInstanceBean build(ProcessInstanceModel model) {
|
||||
ProcessInstanceBean bean = new ProcessInstanceBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
bean.setProcInstTitle(model.getProcTitle());
|
||||
// if(model.getCurrentActivity() != null) {//结束流程为空
|
||||
// bean.setCurActDefId(model.getCurrentActivity().getActDefId());
|
||||
// bean.setCurActDefName(model.getCurrentActivity().getActDefName());
|
||||
// }
|
||||
bean.setStartUserOrgId(model.getStarterOrgId());
|
||||
bean.setStartUserOrgName(model.getStarterOrgName());
|
||||
bean.setProcInstState(model.getProcState());
|
||||
List<ActivityInstanceBean> actInstBeans=new ArrayList<ActivityInstanceBean>();
|
||||
if(model.getNextActivity()!=null&&!model.getNextActivity().isEmpty()){
|
||||
List<ActivityInstanceModel> actInsts=model.getNextActivity();
|
||||
for (ActivityInstanceModel actInst : actInsts) {
|
||||
actInstBeans.add(this.build(actInst));
|
||||
}
|
||||
bean.setNextActInsts(actInstBeans);
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
public ProcessInstanceBean build(HistoricProcessInstanceEntity entity) {
|
||||
ProcessInstanceBean bean = new ProcessInstanceBean();
|
||||
bean.setProcDefId(entity.getProcessDefinitionId());
|
||||
bean.setProcDefName(entity.getProcessDefinitionName());
|
||||
bean.setProcInstTitle(entity.getProcTitle());
|
||||
bean.setBusinessKey(entity.getBusinessKey());
|
||||
bean.setCreateTime(entity.getStartTime());
|
||||
bean.setStartUserId(entity.getStartUserId());
|
||||
bean.setProcInstId(entity.getId());
|
||||
bean.setProcInstState(String.valueOf(entity.getProcState()));
|
||||
bean.setTenantId(entity.getTenantId());
|
||||
bean.setFinishTime(entity.getEndTime());
|
||||
bean.setTopProcInstId(entity.getTopProcessInstanceId());
|
||||
bean.setParentProcInstId(entity.getSuperProcessInstanceId());
|
||||
return bean;
|
||||
}
|
||||
|
||||
public Page<ProcessInstanceBean> buildInstProcPage(Page<ProcessInstanceModel> page){
|
||||
Page<ProcessInstanceBean> result = new Page<ProcessInstanceBean>(page.getThisPageNumber(),page.getPageSize(),page.getTotalCount());
|
||||
BeanUtils.copyProperties(page, result, "result");
|
||||
List<ProcessInstanceBean> beans = new ArrayList<ProcessInstanceBean>();
|
||||
for(int i=0;i<page.getResult().size();i++) {
|
||||
beans.add(build(page.getResult().get(i)));
|
||||
}
|
||||
result.setResult(beans);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ExtAttributBean build(DataObject model) {
|
||||
ExtAttributBean bean = new ExtAttributBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<ExtAttributBean> build(List<DataObjectRelation> list){
|
||||
List<ExtAttributBean> result = new ArrayList<ExtAttributBean>();
|
||||
for(DataObjectRelation dor : list) {
|
||||
ExtAttributBean bean=build(dor.getDataObject());
|
||||
bean.setActDefId(dor.getActivityDefId());
|
||||
bean.setProcDefId(dor.getProcessDefId());
|
||||
result.add(build(dor.getDataObject()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ProcessLogBean build(ProcessLogModel model) {
|
||||
ProcessLogBean bean = new ProcessLogBean();
|
||||
if(model.getComment() != null) {
|
||||
bean.setCommentFullMessage(model.getComment().getMessage());
|
||||
bean.setCommentDisplayArea(model.getComment().getDisplayArea());
|
||||
}
|
||||
bean.setStartTime(model.getHistoricTaskInstance().getStartTime());
|
||||
bean.setEndTime(model.getHistoricTaskInstance().getEndTime());
|
||||
bean.setSendUserId(model.getSendUserId());
|
||||
bean.setSendUserName(model.getSendUserName());
|
||||
bean.setSendOrgId(model.getSendOrgId());
|
||||
bean.setSendOrgName(model.getSendOrgName());
|
||||
bean.setSendCompanyName(model.getSendCompanyName());
|
||||
bean.setSendCompanyId(model.getSendCompanyId());
|
||||
bean.setReceiveUserId(model.getReiceiveUserId());
|
||||
bean.setReceiveUserName(model.getReiceiveUserName());
|
||||
bean.setReceiveOrgId(model.getReceiveOrgId());
|
||||
bean.setReceiveOrgName(model.getReceiveOrgName());
|
||||
bean.setPrevActDefId(model.getHistoricTaskInstance().getPreTaskDefKey());
|
||||
bean.setPrevActDefName(model.getHistoricTaskInstance().getPreTaskDefName());
|
||||
bean.setPrevActInstId(model.getHistoricTaskInstance().getPreTaskId());
|
||||
bean.setCurActDefId(model.getHistoricTaskInstance().getTaskDefinitionKey());
|
||||
bean.setCurActDefName(model.getHistoricTaskInstance().getName());
|
||||
bean.setCurActInstId(model.getHistoricTaskInstance().getId());
|
||||
bean.setProcInstId(model.getHistoricTaskInstance().getProcessInstanceId());
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<ProcessLogBean> buildProcessLogList(List<ProcessLogModel> list){
|
||||
List<ProcessLogBean> result = new ArrayList<ProcessLogBean>();
|
||||
for(ProcessLogModel model : list) {
|
||||
result.add(build(model));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ActivityOpBean build(ActivityOperatePower model) {
|
||||
ActivityOpBean bean = new ActivityOpBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<ActivityOpBean> buildActOpList(List<ActivityOperatePower> list){
|
||||
List<ActivityOpBean> result = new ArrayList<ActivityOpBean>();
|
||||
for(ActivityOperatePower power : list) {
|
||||
result.add(build(power));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ProcessInputModel convert2InputModel(ProcessInputBean bean) {
|
||||
ProcessInputModel model = new ProcessInputModel();
|
||||
model.setWf_procDefId(bean.getProcDefId());
|
||||
model.setWf_procTitle(bean.getTitle());
|
||||
model.setWf_businessKey(bean.getBusinessKey());
|
||||
model.setWf_sender(bean.getUserId());
|
||||
model.setWf_businessDataObject(bean.getDataObject());
|
||||
//model.setWf_dataObject(bean.getDataObject());
|
||||
model.setFields(bean.getFields());
|
||||
return model;
|
||||
}
|
||||
|
||||
public SysGlTypeBean build(SysGlType model) {
|
||||
SysGlTypeBean bean = new SysGlTypeBean();
|
||||
bean.setTenantId(model.getAppKey());
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<SysGlTypeBean> buildTypeList(List<SysGlType> list){
|
||||
List<SysGlTypeBean> result = new ArrayList<SysGlTypeBean>();
|
||||
for(SysGlType type : list) {
|
||||
result.add(build(type));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public CommonIdeaBean build(CommonIdeaEntity model) {
|
||||
CommonIdeaBean bean = new CommonIdeaBean();
|
||||
BeanUtils.copyProperties(model, bean);
|
||||
return bean;
|
||||
}
|
||||
|
||||
public List<CommonIdeaBean> buildCommIdeaList(List<CommonIdeaEntity> list){
|
||||
List<CommonIdeaBean> result = new ArrayList<CommonIdeaBean>();
|
||||
for(CommonIdeaEntity idea : list) {
|
||||
result.add(build(idea));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommonIdeaBean {
|
||||
|
||||
private String id;
|
||||
private Integer sort;
|
||||
private String userCode;
|
||||
private String IdeaText;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExtAttributBean {
|
||||
|
||||
private String objId;
|
||||
private String objKey;
|
||||
private String objName;
|
||||
private String objValue;
|
||||
private String objType;
|
||||
private String procDefId;
|
||||
private String actDefId;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FlowExcuteResp {
|
||||
|
||||
public String executeStatus;
|
||||
public String errorMsg;
|
||||
public ProcessInputBean procInst;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProcessDefinitionBean {
|
||||
|
||||
private String procDefId;
|
||||
private String procDefKey;
|
||||
private String procDefName;
|
||||
private Integer version;
|
||||
private String description;
|
||||
private boolean isRelease;
|
||||
private boolean isShow;
|
||||
private Date createTime;
|
||||
private Date lastUpdateTime;
|
||||
private String tenantId;
|
||||
private String pageUrl;
|
||||
//private String cportalProtocol;
|
||||
private String mportalUrl;
|
||||
//private String mportalProtocol;
|
||||
private String otherSysDealStatus;
|
||||
private String handlerClassPath;
|
||||
private String typeId;
|
||||
private String typeName;
|
||||
private Integer order;
|
||||
private String arisCode;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.BusinessDataObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProcessInputBean {
|
||||
|
||||
private String procDefId;
|
||||
private String title;
|
||||
private String userId;
|
||||
private String businessKey;
|
||||
private String dataType;
|
||||
private BusinessDataObject dataObject;
|
||||
private Map<String,Object> fields;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
|
||||
@Data
|
||||
public class ProcessInstanceBean {
|
||||
|
||||
private String procInstId;
|
||||
private String procInstTitle;
|
||||
private String businessKey;
|
||||
private String parentProcInstId;
|
||||
private String topProcInstId;
|
||||
private String procDefId;
|
||||
private String procDefName;
|
||||
//private String curActDefId;
|
||||
//private String curActDefName;
|
||||
private String startUserId;
|
||||
private String startUserName;
|
||||
//private String startUserCompanyId;
|
||||
private String startUserOrgId;
|
||||
private String startUserOrgName;
|
||||
private String procInstState;
|
||||
private Date createTime;
|
||||
private Date finishTime;
|
||||
private String tenantId;
|
||||
private List<String> subProcInstIds;
|
||||
private List<ActivityInstanceBean> nextActInsts;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProcessLogBean {
|
||||
|
||||
private String commentFullMessage;
|
||||
private String commentDisplayArea;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private String sendUserId;
|
||||
private String sendUserName;
|
||||
private String sendOrgId;
|
||||
private String sendOrgName;
|
||||
private String sendCompanyId;
|
||||
private String sendCompanyName;
|
||||
private String receiveUserId;
|
||||
private String receiveUserName;
|
||||
private String receiveOrgId;
|
||||
private String receiveOrgName;
|
||||
private String prevActDefName;
|
||||
private String curActDefName;
|
||||
private String prevActDefId;
|
||||
private String curActDefId;
|
||||
private String prevActInstId;
|
||||
private String curActInstId;
|
||||
private String procInstId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.blueland.ebpm.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysGlTypeBean {
|
||||
|
||||
private String typeId;
|
||||
private String typeName;
|
||||
private String typeParentId;
|
||||
private String typeParentName;
|
||||
private Integer typeSort;
|
||||
private String tenantId;
|
||||
private String typeRemark;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @description 数据源配置
|
||||
* @author lw
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "spring.datasource")
|
||||
public class DefaultDatasource {
|
||||
|
||||
/**
|
||||
* @description 定义数据源
|
||||
* @author lw
|
||||
* @param env 环境变量
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean(name = "datasource")
|
||||
public DataSource datasource(Environment env) throws NumberFormatException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("spring.datasource.url=" + env.getProperty("spring.datasource.url"));
|
||||
}
|
||||
HikariConfig hikariConfig = new HikariConfig();
|
||||
hikariConfig.setDriverClassName(env.getProperty("spring.datasource.driver-class-name"));
|
||||
hikariConfig.setJdbcUrl(env.getProperty("spring.datasource.url"));
|
||||
hikariConfig.setConnectionTestQuery(env.getProperty("spring.datasource.hikari.connection-test-query"));
|
||||
hikariConfig.setPoolName("springHikariCP");
|
||||
hikariConfig.setUsername(env.getProperty("spring.datasource.username"));
|
||||
hikariConfig.setPassword(env.getProperty("spring.datasource.password"));
|
||||
String connectionTimeout = env.getProperty("spring.datasource.hikari.connection-timeout");
|
||||
if (connectionTimeout != null) {
|
||||
hikariConfig.setConnectionTimeout(Long.parseLong(connectionTimeout));
|
||||
}
|
||||
String idleTimeout = env.getProperty("spring.datasource.hikari.idle-timeout");
|
||||
if (idleTimeout != null) {
|
||||
hikariConfig.setIdleTimeout(Long.parseLong(idleTimeout));
|
||||
}
|
||||
String validationTimeout = env.getProperty("spring.datasource.hikari.validation-timeout");
|
||||
if (validationTimeout != null) {
|
||||
hikariConfig.setValidationTimeout(Long.parseLong(validationTimeout));
|
||||
}
|
||||
String maxLifetime = env.getProperty("spring.datasource.hikari.max-lifetime");
|
||||
if (maxLifetime != null) {
|
||||
hikariConfig.setMaxLifetime(Long.parseLong(maxLifetime));
|
||||
}
|
||||
String maximumPoolSize = env.getProperty("spring.datasource.hikari.maximum-pool-size");
|
||||
if (maximumPoolSize != null) {
|
||||
hikariConfig.setMaximumPoolSize(Integer.parseInt(maximumPoolSize));
|
||||
}
|
||||
|
||||
return new HikariDataSource(hikariConfig);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import com.blueland.ebpm.filter.RepeatableFilter;
|
||||
import com.blueland.ebpm.filter.XssFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Filter配置
|
||||
*
|
||||
* @author Rzdata
|
||||
*/
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean xssFilterRegistration() {
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
||||
registration.setFilter(new XssFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setName("xssFilter");
|
||||
registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
|
||||
Map<String, String> initParameters = new HashMap<String, String>();
|
||||
initParameters.put("excludes", "/*");
|
||||
registration.setInitParameters(initParameters);
|
||||
return registration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean someFilterRegistration() {
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
registration.setFilter(new RepeatableFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setName("repeatableFilter");
|
||||
registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
|
||||
return registration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* @description API接口文件配置类
|
||||
* @author hanj
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class Knife4jConfiguration {
|
||||
|
||||
/**
|
||||
* @description 初始化OpenApi配置
|
||||
* @author hanj
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public Docket openApi3() {
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
.title("BPMC")
|
||||
.description("API TO ACCESS BPMC")
|
||||
.version("1.0.0")
|
||||
.build())
|
||||
.select()
|
||||
//这里指定Controller扫描包路径
|
||||
.apis(RequestHandlerSelectors.basePackage("com.blueland.ebpm.api"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.transaction.annotation.TransactionManagementConfigurer;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* MyBatis基础配置
|
||||
*
|
||||
* @author liuzh
|
||||
* @since 2015-12-19 10:11
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@ConfigurationProperties(prefix = "mybatis-plus")
|
||||
public class MyBatisConfig implements TransactionManagementConfigurer {
|
||||
@Autowired
|
||||
DataSource dataSource;
|
||||
private String typeAliasesPackage;
|
||||
private String mapperLocations;
|
||||
|
||||
|
||||
@Bean(name = "sqlSessionFactory")
|
||||
public SqlSessionFactory sqlSessionFactoryBean() {
|
||||
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setTypeAliasesPackage(typeAliasesPackage);
|
||||
bean.setTypeAliasesSuperType(BaseEntity.class);
|
||||
bean.setConfigLocation(new ClassPathResource("configuration.xml"));
|
||||
|
||||
// 添加XML目录
|
||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
try {
|
||||
bean.setMapperLocations(resolver
|
||||
.getResources("classpath*:/com/**/model/**/*Mapper.xml"));
|
||||
return bean.getObject();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SqlSessionTemplate sqlSessionTemplate(
|
||||
SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
public String getTypeAliasesPackage() {
|
||||
return typeAliasesPackage;
|
||||
}
|
||||
|
||||
public void setTypeAliasesPackage(String typeAliasesPackage) {
|
||||
this.typeAliasesPackage = typeAliasesPackage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import org.mybatis.spring.mapper.MapperScannerConfigurer;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* MyBatis扫描接口
|
||||
*
|
||||
* @author liuzh
|
||||
* @since 2015-12-19 14:46
|
||||
*/
|
||||
@Configuration
|
||||
// TODO 注意,由于MapperScannerConfigurer执行的比较早,所以必须有下面的注解
|
||||
//@AutoConfigureAfter(MyBatisConfig.class)
|
||||
@ConfigurationProperties(prefix = "mybatis-plus")
|
||||
public class MyBatisMapperScannerConfig {
|
||||
private String basePackage;
|
||||
|
||||
@Bean
|
||||
public MapperScannerConfigurer mapperScannerConfigurer() {
|
||||
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
|
||||
mapperScannerConfigurer
|
||||
.setSqlSessionFactoryBeanName("sqlSessionFactory");
|
||||
mapperScannerConfigurer.setBasePackage("com.**.dao,com.**.**.dao");
|
||||
|
||||
//mapperScannerConfigurer.setAnnotationClass(MyBatisDao.class);
|
||||
return mapperScannerConfigurer;
|
||||
}
|
||||
|
||||
public String getBasePackage() {
|
||||
return basePackage;
|
||||
}
|
||||
|
||||
public void setBasePackage(String basePackage) {
|
||||
this.basePackage = basePackage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Session工厂的配置文件
|
||||
*
|
||||
*@author fishkk
|
||||
*@version 1.0.0
|
||||
*@since
|
||||
*
|
||||
* 修改人信息
|
||||
*@author
|
||||
*@version
|
||||
*@since
|
||||
*
|
||||
*/
|
||||
public class SessionFactoryConfiguration {
|
||||
/**
|
||||
* 自动装在数据库资源bean
|
||||
*/
|
||||
// @Resource
|
||||
private DataSource dataSource;
|
||||
|
||||
// @Bean(name = "sqlSessionFactory")
|
||||
public SqlSessionFactoryBean createSqlSessionFactory() throws IOException {
|
||||
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
|
||||
//Mybatis的参数配置
|
||||
sqlSessionFactoryBean.setConfigLocation(new ClassPathResource("configuration.xml"));
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
//启用Mybatis的全部xml文件,就不需要一个个去打开
|
||||
String packageSerchPath = "classpath*:/com/**/model/**/*Mapper.xml";
|
||||
sqlSessionFactoryBean.setMapperLocations(resolver.getResources(packageSerchPath));
|
||||
sqlSessionFactoryBean.setDataSource(dataSource);
|
||||
//实体类所在的包
|
||||
sqlSessionFactoryBean.setTypeAliasesPackage("com.**.dao,com.**.**.dao");
|
||||
return sqlSessionFactoryBean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
package com.blueland.ebpm.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.activiti.engine.FormService;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.ManagementService;
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||
import org.activiti.engine.delegate.event.ActivitiEventType;
|
||||
import org.activiti.engine.impl.interceptor.SessionFactory;
|
||||
import org.activiti.engine.impl.jobexecutor.DefaultJobExecutor;
|
||||
import org.activiti.engine.impl.persistence.StrongUuidGenerator;
|
||||
import org.activiti.spring.ProcessEngineFactoryBean;
|
||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import com.blueland.bpm.common.util.ApplicationContextHolder;
|
||||
import com.blueland.bpm.engine.core.identity.CustomGroupManagerFactory;
|
||||
import com.blueland.bpm.engine.core.identity.CustomUserManagerFactory;
|
||||
import com.blueland.bpm.engine.core.listener.GlobalTaskAssigneeListener;
|
||||
import com.blueland.bpm.engine.util.cache.MyProcessDefinitionCache;
|
||||
import com.blueland.bpm.unitework.ProcessCancelEvent;
|
||||
import com.blueland.bpm.unitework.ProcessEndEvent;
|
||||
import com.blueland.bpm.unitework.TaskAssigneTransferEvent;
|
||||
import com.blueland.bpm.unitework.TaskCreateListener;
|
||||
import com.blueland.bpm.unitework.TaskDeleleEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
* @description 流程引擎配置
|
||||
* @author lw
|
||||
*/
|
||||
@Configuration
|
||||
public class WorkFlowConfig {
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private PlatformTransactionManager platformTransactionManager;
|
||||
// 引擎名称
|
||||
private String processEngineName = "bpm";
|
||||
// 开启引擎详细流程历史记录
|
||||
private String historyLevel = "audit";
|
||||
// 是否开启审计日志,默认不开启
|
||||
private boolean EnableDatabaseEventLogging = false;
|
||||
// 是否开启job线程,服务任务异步属性需要
|
||||
private boolean jobExecutorActivate = false;
|
||||
// 开启job轮训时间
|
||||
private int jobWaitTimeInMillis = 5000;
|
||||
// 流程图字体
|
||||
private String activityFontName = "微软雅黑";
|
||||
|
||||
/**
|
||||
* @description 初始化流程引擎配置
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public SpringProcessEngineConfiguration processEngineConfiguration() {
|
||||
SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
|
||||
configuration.setDataSource(dataSource);
|
||||
configuration.setTransactionManager(platformTransactionManager);
|
||||
configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
|
||||
configuration.setJobExecutorActivate(jobExecutorActivate);
|
||||
configuration.setHistory(historyLevel);
|
||||
configuration.setActivityFontName(activityFontName);
|
||||
configuration.setLabelFontName(activityFontName);
|
||||
configuration.setIdGenerator(new StrongUuidGenerator());
|
||||
configuration.setDbIdentityUsed(false);
|
||||
configuration.setEnableDatabaseEventLogging(EnableDatabaseEventLogging);
|
||||
DefaultJobExecutor defaultJobExecutor = new DefaultJobExecutor();
|
||||
defaultJobExecutor.setWaitTimeInMillis(jobWaitTimeInMillis);
|
||||
configuration.setJobExecutor(defaultJobExecutor);
|
||||
configuration.setProcessEngineName(processEngineName);
|
||||
configuration.setProcessDefinitionCache(processDefinitionCache());
|
||||
setCustomSessionFactories(configuration);
|
||||
setGlobalListeners(configuration);
|
||||
setGlobalEvent(configuration);
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化引擎工厂
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public ProcessEngineFactoryBean processEngine() {
|
||||
ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
|
||||
processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration());
|
||||
return processEngineFactoryBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化储存服务组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public RepositoryService repositoryService() throws Exception {
|
||||
return processEngine().getObject().getRepositoryService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化运行时服务组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public RuntimeService runtimeService() throws Exception {
|
||||
return processEngine().getObject().getRuntimeService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化任务组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public TaskService taskService() throws Exception {
|
||||
return processEngine().getObject().getTaskService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化流程历史组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public HistoryService historyService() throws Exception {
|
||||
return processEngine().getObject().getHistoryService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化表单组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public FormService formService() throws Exception {
|
||||
return processEngine().getObject().getFormService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化流程用户关系组件
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public IdentityService identityService() throws Exception {
|
||||
return processEngine().getObject().getIdentityService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化流程管理组件
|
||||
* @description Job任务管理、数据库相关通用操作、执行流程引擎命令
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public ManagementService managementService() throws Exception {
|
||||
return processEngine().getObject().getManagementService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 自定义分组管理工厂
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public SessionFactory customGroupManagerFactory() {
|
||||
return new CustomGroupManagerFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 自定义用户管理工厂
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public SessionFactory customUserManagerFactory() {
|
||||
return new CustomUserManagerFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 流程自定义缓存
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean
|
||||
public MyProcessDefinitionCache processDefinitionCache() {
|
||||
MyProcessDefinitionCache myProcessDefinitionCache = new MyProcessDefinitionCache();
|
||||
myProcessDefinitionCache.setRedisTemplate(redisTemplate);
|
||||
return myProcessDefinitionCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 初始化JdbcTemplate
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean(name = "jdbcTemplate")
|
||||
public JdbcTemplate jdbcTemplate() {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate();
|
||||
jdbcTemplate.setDataSource(dataSource);
|
||||
return jdbcTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 自定义用户和角色管理配置
|
||||
* @author ouandyang
|
||||
* @param configuration 流程引擎自定义配置
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
private void setCustomSessionFactories(SpringProcessEngineConfiguration configuration) {
|
||||
List<SessionFactory> customSessionFactories = new ArrayList<SessionFactory>();
|
||||
// 设置自定义用户管理
|
||||
customSessionFactories.add(customGroupManagerFactory());
|
||||
// 设置自定义角色管理
|
||||
customSessionFactories.add(customUserManagerFactory());
|
||||
configuration.setCustomSessionFactories(customSessionFactories);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 全局监听器配置
|
||||
* @author ouandyang
|
||||
* @param configuration 流程引擎自定义配置
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
private void setGlobalListeners(SpringProcessEngineConfiguration configuration) {
|
||||
List<TaskListener> globalTaskCreateListeners = Lists.newArrayList();
|
||||
// 全局设置任务接收人监听器
|
||||
globalTaskCreateListeners.add(new GlobalTaskAssigneeListener());
|
||||
//统一待办任务创建监听器
|
||||
globalTaskCreateListeners.add(new TaskCreateListener());
|
||||
configuration.setGlobalTaskCreateListeners(globalTaskCreateListeners);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 全局事件箭头器配置
|
||||
* @author ouandyang
|
||||
* @param configuration 流程引擎自定义配置
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
private void setGlobalEvent(SpringProcessEngineConfiguration configuration) {
|
||||
Map<String,List<ActivitiEventListener>> typedListeners=Maps.newHashMap();
|
||||
List<ActivitiEventListener> listeners=Lists.newArrayList();
|
||||
listeners.add(new TaskAssigneTransferEvent());
|
||||
//添加转派监听器
|
||||
typedListeners.put(ActivitiEventType.TASK_ASSIGNED_TRANSFER.toString(), listeners);
|
||||
listeners=Lists.newArrayList();
|
||||
listeners.add(new ProcessEndEvent());
|
||||
//添加流程完成监听器
|
||||
typedListeners.put(ActivitiEventType.PROCESS_COMPLETED.toString(), listeners);
|
||||
listeners=Lists.newArrayList();
|
||||
listeners.add(new ProcessCancelEvent());
|
||||
//添加流程作废监听器
|
||||
typedListeners.put(ActivitiEventType.PROCESS_CANCEL.toString(), listeners);
|
||||
listeners=Lists.newArrayList();
|
||||
listeners.add(new TaskDeleleEvent());
|
||||
//添加待办删除监听器
|
||||
typedListeners.put(ActivitiEventType.ENTITY_DELETED.toString(), listeners);
|
||||
configuration.setTypedEventListeners(typedListeners);
|
||||
|
||||
}
|
||||
/**
|
||||
* @description 初始化JdbcTemplate
|
||||
* @author ouandyang
|
||||
* @updateTime 2021/5/13
|
||||
*/
|
||||
@Bean(name = "ApplicationContextHolder")
|
||||
public ApplicationContextHolder applicationContextHolder() {
|
||||
return new ApplicationContextHolder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.blueland.ebpm.exception;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
|
||||
public class ErrorInfo {
|
||||
private String errorCode;
|
||||
private String errMsg;
|
||||
private String exception;
|
||||
|
||||
// public static final String INTERNAL_SERVER_ERROR = "A1000"; //内部服务器错误
|
||||
// public static final String INTERNAL_DATABASE_ERROR = "A1001"; //数据库错误
|
||||
// public static final String INTERNAL_IP_DENEY = "A1002"; //ip地址拒绝
|
||||
//
|
||||
// public static final String WORKFLOW_DATA_ERROR = "B2000"; //流程数据异常
|
||||
// public static final String WORKFLOW_PARAM_ERROR = "B2001"; //输入参数异常
|
||||
// public static final String WORKFLOW_PROCDEF_NOT_EXIST = "B2002"; //流程定义信息不在在
|
||||
// public static final String WORKFLOW_ACTDEF_NOT_EXIST = "B2003";
|
||||
// public static final String WORKFLOW_PROCINST_NOT_EXIST = "B2004";
|
||||
// public static final String WORKFLOW_ACTINST_NOT_EXIST = "B2005";
|
||||
// public static final String WORKFLOW_NEXTACT_NOT_EXIST = "B2006";
|
||||
// public static final String WORKFLOW_NEXTACTUSER_NOT_EXIST = "B2007";
|
||||
// public static final String WORKFLOW_TODO_NOT_EXIST = "B2020";
|
||||
// public static final String WORKFLOW_TODO_RECOMMIT = "B2021";
|
||||
//
|
||||
// public static final String READ_SYNC_ERROR = "B3000";
|
||||
// public static final String READ_PARAM_ERROR = "B3001";
|
||||
//
|
||||
// public static final String COMMON_PARAM_ERROR = "B4001";
|
||||
// public static final String COMMON_OBJECT_EXIST = "B4002"; //对象已存在
|
||||
// public static final String COMMON_OBJECT_NOT_EXIST = "B4003";
|
||||
// public static final String COMMON_SSO_FAULT = "B4004";
|
||||
|
||||
public ErrorInfo(String errorCode, String errMsg, Exception ex) {
|
||||
this.errorCode = errorCode;
|
||||
this.errMsg = errMsg;
|
||||
if (ex != null) {
|
||||
this.exception = ex.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.errMsg = message;
|
||||
}
|
||||
|
||||
public void setException(String exception) {
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public String getException() {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.blueland.ebpm.exception;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.ActivitiObjectNotFoundException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.transaction.UnexpectedRollbackException;
|
||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.bpm.engine.core.model.ProcessExeErrorShare;
|
||||
import com.blueland.bpm.engine.util.WorkFlowException;
|
||||
|
||||
@ControllerAdvice
|
||||
public class ExceptionHandle {
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
public ErrorInfo handleNotFound(ActivitiObjectNotFoundException e) {
|
||||
return new ErrorInfo(ExceptionErrorCode.B2000.name(), "Object Not found", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleWorkFlowException(WorkFlowException e) {
|
||||
logger.error("",e);
|
||||
return new ErrorInfo(e.getExceptionErrorCode().name() ,e.getMessage(), e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleRestException(RestException e) {
|
||||
logger.error("",e);
|
||||
return new ErrorInfo(e.getErrCode(), "Excute Error", e);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleNullPointerException(NullPointerException e) {
|
||||
logger.error("",e);
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Null Pointer", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(value=HttpStatus.NOT_FOUND)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleNoHandlerFoundException(NoHandlerFoundException e) {
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "No HandlerFound", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleJsonPropertyException(HttpMessageNotReadableException e) {
|
||||
logger.error("",e);
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Json Error", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Http Method Error", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.UNSUPPORTED_MEDIA_TYPE)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleHttpMediaTypeNotSupportedException(HttpMediaTypeNotSupportedException e) {
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Media Type Error", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleIllegalArgumentException(IllegalArgumentException e) {
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Illegal Argument", e);
|
||||
}
|
||||
|
||||
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
@ResponseBody
|
||||
@ExceptionHandler
|
||||
public ErrorInfo handleUnexpectedRollbackException(UnexpectedRollbackException e) {
|
||||
logger.error("",e);
|
||||
Map resultMap=ProcessExeErrorShare.getProcessExeErrorData();
|
||||
if(resultMap!=null){
|
||||
ExceptionErrorCode exceptionErrorCode=(ExceptionErrorCode) resultMap.get("executeErrorCode");
|
||||
String executeErrorMsg=(String) resultMap.get("executeErrorMsg");
|
||||
if(StringUtils.isNotEmpty(executeErrorMsg)){
|
||||
return new ErrorInfo(exceptionErrorCode.name(), executeErrorMsg, e);
|
||||
}
|
||||
}
|
||||
return new ErrorInfo(ExceptionErrorCode.A1000.name(), "Database Error", e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.blueland.ebpm.exception;
|
||||
|
||||
public class RestException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String errCode = "A1000";
|
||||
|
||||
|
||||
public RestException(String message) {
|
||||
this("A1000", message);
|
||||
}
|
||||
|
||||
public RestException(String errorCode, String message) {
|
||||
super(message);
|
||||
this.errCode = errorCode;
|
||||
}
|
||||
|
||||
// public RestException(String message, Throwable cause) {
|
||||
// super(message, cause);
|
||||
// }
|
||||
//
|
||||
// public RestException(String errCode, String message, Throwable cause) {
|
||||
// super(message, cause);
|
||||
// this.errCode = errCode;
|
||||
// }
|
||||
|
||||
public String getErrCode() {
|
||||
return this.errCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.blueland.ebpm.filter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Repeatable 过滤器
|
||||
*
|
||||
* @author rzdata
|
||||
*/
|
||||
public class RepeatableFilter implements Filter {
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
ServletRequest requestWrapper = null;
|
||||
if (request instanceof HttpServletRequest
|
||||
&& StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) {
|
||||
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
||||
}
|
||||
if (null == requestWrapper) {
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
chain.doFilter(requestWrapper, response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.blueland.ebpm.filter;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 构建可重复读取inputStream的request
|
||||
*
|
||||
* @author rzdata
|
||||
*/
|
||||
public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper {
|
||||
private final byte[] body;
|
||||
|
||||
public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException {
|
||||
super(request);
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
|
||||
body = IoUtil.read(request.getInputStream(),StandardCharsets.UTF_8).getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader getReader() throws IOException {
|
||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return bais.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return body.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.blueland.ebpm.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SimpleCORSFilter implements Filter {
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET");
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
//response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||
response.setHeader("X-Content-Type-Options", "nosniff");
|
||||
response.setHeader("X-XSS-Protection", "1; mode=block");
|
||||
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
|
||||
public void destroy() {}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.blueland.ebpm.filter;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 防止XSS攻击的过滤器
|
||||
*
|
||||
* @author rzdata
|
||||
*/
|
||||
@Component
|
||||
public class XssFilter implements Filter {
|
||||
/**
|
||||
* 排除链接
|
||||
*/
|
||||
public List<String> excludes = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
String tempExcludes = filterConfig.getInitParameter("excludes");
|
||||
if (StringUtils.isNotEmpty(tempExcludes)) {
|
||||
String[] url = tempExcludes.split(",");
|
||||
for (int i = 0; url != null && i < url.length; i++) {
|
||||
excludes.add(url[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
if (handleExcludeURL(req, resp)) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request);
|
||||
chain.doFilter(xssRequest, response);
|
||||
}
|
||||
|
||||
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) {
|
||||
String url = request.getServletPath();
|
||||
String method = request.getMethod();
|
||||
// GET DELETE 不过滤
|
||||
if (method == null || method.matches("GET") || method.matches("DELETE")) {
|
||||
return true;
|
||||
}
|
||||
return matches(url, excludes);
|
||||
}
|
||||
|
||||
public static boolean matches(String str, List<String> strs) {
|
||||
if (StringUtils.isEmpty(str) || CollUtil.isEmpty(strs)) {
|
||||
return false;
|
||||
}
|
||||
for (String pattern : strs) {
|
||||
if (isMatch(pattern, str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isMatch(String pattern, String url) {
|
||||
return ReUtil.isMatch(pattern, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.blueland.ebpm.filter;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* XSS过滤处理
|
||||
*
|
||||
* @author rzdata
|
||||
*/
|
||||
@Component
|
||||
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
/**
|
||||
* @param request
|
||||
*/
|
||||
public XssHttpServletRequestWrapper(@Qualifier("xssHttpServletRequestWrapper") HttpServletRequest request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
String[] values = super.getParameterValues(name);
|
||||
if (values != null) {
|
||||
int length = values.length;
|
||||
String[] escapseValues = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
// 防xss攻击和过滤前后空格
|
||||
escapseValues[i] = HtmlUtil.cleanHtmlTag(values[i]).trim();
|
||||
}
|
||||
return escapseValues;
|
||||
}
|
||||
return super.getParameterValues(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
// 非json类型,直接返回
|
||||
if (!isJsonRequest()) {
|
||||
return super.getInputStream();
|
||||
}
|
||||
|
||||
// 为空,直接返回
|
||||
String json = IoUtil.read(super.getInputStream(), StandardCharsets.UTF_8);
|
||||
if (StringUtils.isEmpty(json)) {
|
||||
return super.getInputStream();
|
||||
}
|
||||
|
||||
// xss过滤
|
||||
json = HtmlUtil.cleanHtmlTag(json).trim();
|
||||
byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8);
|
||||
final ByteArrayInputStream bis = IoUtil.toStream(jsonBytes);
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return jsonBytes.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return bis.read();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是Json请求
|
||||
*
|
||||
*/
|
||||
public boolean isJsonRequest() {
|
||||
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||
return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* xss过滤
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String cleanXSS(String value) {
|
||||
if (Objects.isNull(value)) {
|
||||
return value;
|
||||
}
|
||||
//在这里自定义需要过滤的字符
|
||||
value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;");
|
||||
value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
|
||||
value = value.replaceAll("'", "& #39;");
|
||||
value = value.replaceAll("eval\\((.*)\\)", "");
|
||||
value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\"");
|
||||
value = value.replaceAll("<script>", "");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.blueland.ebpm.home.dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.ebpm.home.model.HomePage;
|
||||
|
||||
@Repository
|
||||
public class HomePageDao extends BaseIbatis3Dao<HomePage,String>{
|
||||
public List<HomePage> getAppTaskCount(String owner,String state) {
|
||||
Map<String,Object> params=new HashMap<String,Object>();
|
||||
params.put("owner", owner);
|
||||
params.put("state", state);
|
||||
return getSqlSessionTemplate().selectList("HomePage.getAppTaskCount",params);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.blueland.ebpm.home.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
|
||||
@Repository
|
||||
public class OrgEntityDao extends BaseIbatis3Dao<Org,String>{
|
||||
/**
|
||||
* 更新用户数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public int updateById(Org org) {
|
||||
return getSqlSessionTemplate().update("OrgEntity.updateById",org);
|
||||
}
|
||||
|
||||
public int insertObj(Org org) {
|
||||
return getSqlSessionTemplate().insert("OrgEntity.insert",org);
|
||||
}
|
||||
|
||||
public int deleteByOrgId(String orgId) {
|
||||
return getSqlSessionTemplate().delete("OrgEntity.deleteByOrgId",orgId);
|
||||
}
|
||||
|
||||
public Org findOrgByDeptId(String deptId) {
|
||||
|
||||
return getSqlSessionTemplate().selectOne("OrgEntity.findOrgByDeptId", deptId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.blueland.ebpm.home.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
|
||||
@Repository
|
||||
public class UserEntityDao extends BaseIbatis3Dao<User,String>{
|
||||
/**
|
||||
* 更新用户数据
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public int updateByUserId(User user) {
|
||||
return getSqlSessionTemplate().update("UserEntity.updateByUserId",user);
|
||||
}
|
||||
|
||||
public int insertObj(User user) {
|
||||
return getSqlSessionTemplate().insert("UserEntity.insert",user);
|
||||
}
|
||||
|
||||
public int deleteByUserId(String userId) {
|
||||
return getSqlSessionTemplate().delete("UserEntity.deleteByUserId",userId);
|
||||
}
|
||||
/**
|
||||
* 查询用户信息
|
||||
* @param staffPostCode
|
||||
* @return
|
||||
*/
|
||||
public User findUserByUserId(String userId) {
|
||||
return getSqlSessionTemplate().selectOne("UserEntity.findUserByUserId", userId);
|
||||
}
|
||||
|
||||
public User findUserByRemark(String remark) {
|
||||
return getSqlSessionTemplate().selectOne("UserEntity.findUserByRemark", remark);
|
||||
}
|
||||
/**
|
||||
* 根据用户 num 更新数据
|
||||
* @param user
|
||||
*/
|
||||
public int updateByRemark(User user) {
|
||||
return getSqlSessionTemplate().update("UserEntity.updateByRemark",user);
|
||||
}
|
||||
|
||||
public int updateStatusByUserId(String userId) {
|
||||
return getSqlSessionTemplate().update("UserEntity.updateStatusByUserId",userId);
|
||||
}
|
||||
|
||||
public int updateQyStatusByUserId(String userId) {
|
||||
return getSqlSessionTemplate().update("UserEntity.updateQyStatusByUserId", userId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.blueland.ebpm.home.model;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* @作者 lw
|
||||
* @创建时间 2021年2月5日
|
||||
* @说明
|
||||
*/
|
||||
public class HomePage implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 5454155825314635342L;
|
||||
private String appId;
|
||||
private String count;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(String count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="HomePage">
|
||||
<resultMap id="RM_HomePage" type="com.blueland.ebpm.home.model.HomePage">
|
||||
<result property="appId" column="UNITE_TENANT_ID"/>
|
||||
<result property="count" column="COUNT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="HomePage.getAppTaskCount" resultMap="RM_HomePage">
|
||||
SELECT UNITE_TENANT_ID,count(1) as count FROM T_UNITEWORK_TASK WHERE UNITE_REC_USERID =#{owner} and UNITE_STATUS = #{state} GROUP BY UNITE_TENANT_ID
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
package com.blueland.ebpm.home.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>Title: Org</p>
|
||||
* <p>Description: </p>
|
||||
* @作者 dsl
|
||||
* @创建时间 2022年3月29日下午5:05:38
|
||||
*
|
||||
*/
|
||||
public class OrgEntity {
|
||||
/**
|
||||
* 组织ID-唯一标识组织对象id db_column: org_id
|
||||
*/
|
||||
private String orgId;
|
||||
/**
|
||||
* 组织名称-组织名称 db_column: org_full_name
|
||||
*/
|
||||
private String orgFullName;
|
||||
/**
|
||||
* 组织短名称-组织短名称 db_column: org_name
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 全拼- db_column: org_full_spells
|
||||
*/
|
||||
private String orgFullSpells;
|
||||
/**
|
||||
* 简拼- db_column: org_spells
|
||||
*/
|
||||
private String orgSpells;
|
||||
|
||||
/**
|
||||
* 组织联盟分类-工业公司、商业公司、零售户、供应商 db_column: org_type
|
||||
*/
|
||||
private String orgType;
|
||||
/**
|
||||
* 组织管理类型-GS:公司BM:部门KS:科室QT:其他
|
||||
db_column: org_Mgr_type
|
||||
*/
|
||||
private String orgMgrType;
|
||||
|
||||
/**
|
||||
* 组织级别-1、2、3、4层级 db_column: org_level
|
||||
*/
|
||||
private Integer orgLevel;
|
||||
/**
|
||||
* 上级组织ID-上级组织UUID db_column: org_parent_id
|
||||
*/
|
||||
private String orgParentId;
|
||||
/**
|
||||
* 上级组织名称-上级组织名称 db_column: org_parent_name
|
||||
*/
|
||||
private String orgParentName;
|
||||
/**
|
||||
* 所属组织ID-所属组织UUID db_column: company_id
|
||||
*/
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 所属组织ID-所属组织名称 db_column: company_id
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
* 组织负责人ID-组织负责人UUID db_column: org_branch_leader
|
||||
*/
|
||||
private String orgBranchLeader;
|
||||
|
||||
/**
|
||||
* 组织负责人ID-组织负责人姓名 db_column: org_branch_leader_name
|
||||
*/
|
||||
private String orgBranchLeaderName;
|
||||
|
||||
/**
|
||||
* 办公地址-办公地址 db_column: org_work_address
|
||||
*/
|
||||
private String orgWorkAddress;
|
||||
/**
|
||||
* 办公电话-办公电话 db_column: org_work_phone
|
||||
*/
|
||||
private String orgWorkPhone;
|
||||
/**
|
||||
* 组织状态-启用、禁用 db_column: org_status
|
||||
*/
|
||||
private String orgStatus;
|
||||
/**
|
||||
* 组织排序-组织排序 db_column: org_sort
|
||||
*/
|
||||
|
||||
private Integer orgSort;
|
||||
/**
|
||||
* 删除标识-组织单元的删除标识 删除 : y、未删除: n db_column: org_del_status
|
||||
*/
|
||||
//@Length(max=10)
|
||||
//private String orgDelStatus;
|
||||
/**
|
||||
* 创建时间-创建时间 db_column: org_create_time
|
||||
*/
|
||||
|
||||
private Date orgCreateTime;
|
||||
/**
|
||||
* 创建人-创建人ID db_column: org_creator
|
||||
*/
|
||||
private String orgCreator;
|
||||
/**
|
||||
* 最近修改时间-最近修改时间 db_column: org_update_time
|
||||
*/
|
||||
|
||||
private Date orgUpdateTime;
|
||||
/**
|
||||
* 最近修改人-最近修改人ID db_column: org_updator
|
||||
*/
|
||||
private String orgUpdator;
|
||||
//columns END
|
||||
/**
|
||||
* 部门ID db_column: dept_id
|
||||
*/
|
||||
private String deptId;
|
||||
/**
|
||||
* 部门名称 db_column: dept_name
|
||||
*/
|
||||
private String deptName;
|
||||
//组织子分类
|
||||
private String orgSubType;
|
||||
/**
|
||||
* 组织编制类型 编制内:BZN,编制外:BZW db_column: org_work_type
|
||||
*/
|
||||
private String orgWorkType;
|
||||
|
||||
private UserEntity staffInfo;
|
||||
// 编制数量
|
||||
private String staffing;
|
||||
|
||||
// 冗余字段(查询条件)
|
||||
private String queryOrg;
|
||||
//组织hrId
|
||||
private String orgHrId;
|
||||
private List<String> orgIdlist;
|
||||
|
||||
private List<String> companyIdList;
|
||||
|
||||
//数据库不存在此字段,用来做权限判断
|
||||
private String orgBtn;
|
||||
public OrgEntity(){
|
||||
}
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getOrgFullName() {
|
||||
return orgFullName;
|
||||
}
|
||||
|
||||
public void setOrgFullName(String orgFullName) {
|
||||
this.orgFullName = orgFullName;
|
||||
}
|
||||
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
|
||||
public String getOrgFullSpells() {
|
||||
return orgFullSpells;
|
||||
}
|
||||
|
||||
public void setOrgFullSpells(String orgFullSpells) {
|
||||
this.orgFullSpells = orgFullSpells;
|
||||
}
|
||||
|
||||
public String getOrgSpells() {
|
||||
return orgSpells;
|
||||
}
|
||||
|
||||
public void setOrgSpells(String orgSpells) {
|
||||
this.orgSpells = orgSpells;
|
||||
}
|
||||
|
||||
public String getOrgType() {
|
||||
return orgType;
|
||||
}
|
||||
|
||||
public void setOrgType(String orgType) {
|
||||
this.orgType = orgType;
|
||||
}
|
||||
|
||||
public String getOrgMgrType() {
|
||||
return orgMgrType;
|
||||
}
|
||||
|
||||
public void setOrgMgrType(String orgMgrType) {
|
||||
this.orgMgrType = orgMgrType;
|
||||
}
|
||||
|
||||
public Integer getOrgLevel() {
|
||||
return orgLevel;
|
||||
}
|
||||
|
||||
public void setOrgLevel(Integer orgLevel) {
|
||||
this.orgLevel = orgLevel;
|
||||
}
|
||||
|
||||
public String getOrgParentId() {
|
||||
return orgParentId;
|
||||
}
|
||||
|
||||
public void setOrgParentId(String orgParentId) {
|
||||
this.orgParentId = orgParentId;
|
||||
}
|
||||
|
||||
public String getOrgParentName() {
|
||||
return orgParentName;
|
||||
}
|
||||
|
||||
public void setOrgParentName(String orgParentName) {
|
||||
this.orgParentName = orgParentName;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getOrgBranchLeader() {
|
||||
return orgBranchLeader;
|
||||
}
|
||||
|
||||
public void setOrgBranchLeader(String orgBranchLeader) {
|
||||
this.orgBranchLeader = orgBranchLeader;
|
||||
}
|
||||
|
||||
public String getOrgBranchLeaderName() {
|
||||
return orgBranchLeaderName;
|
||||
}
|
||||
|
||||
public void setOrgBranchLeaderName(String orgBranchLeaderName) {
|
||||
this.orgBranchLeaderName = orgBranchLeaderName;
|
||||
}
|
||||
|
||||
public String getOrgWorkAddress() {
|
||||
return orgWorkAddress;
|
||||
}
|
||||
|
||||
public void setOrgWorkAddress(String orgWorkAddress) {
|
||||
this.orgWorkAddress = orgWorkAddress;
|
||||
}
|
||||
|
||||
public String getOrgWorkPhone() {
|
||||
return orgWorkPhone;
|
||||
}
|
||||
|
||||
public void setOrgWorkPhone(String orgWorkPhone) {
|
||||
this.orgWorkPhone = orgWorkPhone;
|
||||
}
|
||||
|
||||
public String getOrgStatus() {
|
||||
return orgStatus;
|
||||
}
|
||||
|
||||
public void setOrgStatus(String orgStatus) {
|
||||
this.orgStatus = orgStatus;
|
||||
}
|
||||
|
||||
public Integer getOrgSort() {
|
||||
return orgSort;
|
||||
}
|
||||
|
||||
public void setOrgSort(Integer orgSort) {
|
||||
this.orgSort = orgSort;
|
||||
}
|
||||
|
||||
public Date getOrgCreateTime() {
|
||||
return orgCreateTime;
|
||||
}
|
||||
|
||||
public void setOrgCreateTime(Date orgCreateTime) {
|
||||
this.orgCreateTime = orgCreateTime;
|
||||
}
|
||||
|
||||
public String getOrgCreator() {
|
||||
return orgCreator;
|
||||
}
|
||||
|
||||
public void setOrgCreator(String orgCreator) {
|
||||
this.orgCreator = orgCreator;
|
||||
}
|
||||
|
||||
public Date getOrgUpdateTime() {
|
||||
return orgUpdateTime;
|
||||
}
|
||||
|
||||
public void setOrgUpdateTime(Date orgUpdateTime) {
|
||||
this.orgUpdateTime = orgUpdateTime;
|
||||
}
|
||||
|
||||
public String getOrgUpdator() {
|
||||
return orgUpdator;
|
||||
}
|
||||
|
||||
public void setOrgUpdator(String orgUpdator) {
|
||||
this.orgUpdator = orgUpdator;
|
||||
}
|
||||
|
||||
public String getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(String deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getOrgSubType() {
|
||||
return orgSubType;
|
||||
}
|
||||
|
||||
public void setOrgSubType(String orgSubType) {
|
||||
this.orgSubType = orgSubType;
|
||||
}
|
||||
|
||||
public String getOrgWorkType() {
|
||||
return orgWorkType;
|
||||
}
|
||||
|
||||
public void setOrgWorkType(String orgWorkType) {
|
||||
this.orgWorkType = orgWorkType;
|
||||
}
|
||||
|
||||
public UserEntity getStaffInfo() {
|
||||
return staffInfo;
|
||||
}
|
||||
|
||||
public void setStaffInfo(UserEntity staffInfo) {
|
||||
this.staffInfo = staffInfo;
|
||||
}
|
||||
|
||||
public String getStaffing() {
|
||||
return staffing;
|
||||
}
|
||||
|
||||
public void setStaffing(String staffing) {
|
||||
this.staffing = staffing;
|
||||
}
|
||||
|
||||
public String getQueryOrg() {
|
||||
return queryOrg;
|
||||
}
|
||||
|
||||
public void setQueryOrg(String queryOrg) {
|
||||
this.queryOrg = queryOrg;
|
||||
}
|
||||
|
||||
public String getOrgHrId() {
|
||||
return orgHrId;
|
||||
}
|
||||
|
||||
public void setOrgHrId(String orgHrId) {
|
||||
this.orgHrId = orgHrId;
|
||||
}
|
||||
|
||||
public List<String> getOrgIdlist() {
|
||||
return orgIdlist;
|
||||
}
|
||||
|
||||
public void setOrgIdlist(List<String> orgIdlist) {
|
||||
this.orgIdlist = orgIdlist;
|
||||
}
|
||||
|
||||
public List<String> getCompanyIdList() {
|
||||
return companyIdList;
|
||||
}
|
||||
|
||||
public void setCompanyIdList(List<String> companyIdList) {
|
||||
this.companyIdList = companyIdList;
|
||||
}
|
||||
|
||||
public String getOrgBtn() {
|
||||
return orgBtn;
|
||||
}
|
||||
|
||||
public void setOrgBtn(String orgBtn) {
|
||||
this.orgBtn = orgBtn;
|
||||
}
|
||||
|
||||
public OrgEntity(
|
||||
String orgId
|
||||
){
|
||||
this.orgId = orgId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="OrgEntity">
|
||||
<resultMap id="RM_OrgEntity" type="com.blueland.bpm.identity.model.Org">
|
||||
<result column="ORG_ID" jdbcType="VARCHAR" property="orgId" />
|
||||
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName" />
|
||||
<result column="ORG_FULL_NAME" jdbcType="VARCHAR" property="orgFullName" />
|
||||
<result column="ORG_FULL_PATH_NAME" jdbcType="CHAR" property="orgFullPathName" />
|
||||
<result column="ORG_FULL_PATH_ID" jdbcType="CHAR" property="orgFullPathId" />
|
||||
<result column="ORG_PARENT_ID" jdbcType="VARCHAR" property="orgParentId" />
|
||||
<result column="ORG_TYPE" jdbcType="CHAR" property="orgType" />
|
||||
<result column="ORG_LEVEL" jdbcType="INTEGER" property="orgLevel" />
|
||||
<result column="ORG_AREA_TYPE" jdbcType="VARCHAR" property="orgAreaType" />
|
||||
<result column="ORG_SORT" jdbcType="INTEGER" property="orgSort" />
|
||||
<result column="ORG_WORK_PHONE" jdbcType="CHAR" property="orgWorkPhone" />
|
||||
<result column="ORG_WORK_ADDRESS" jdbcType="CHAR" property="orgWorkAddress" />
|
||||
<result column="ORG_PRINCIPAL" jdbcType="CHAR" property="orgPrincipal" />
|
||||
<result column="ORG_STATUS" jdbcType="VARCHAR" property="orgStatus" />
|
||||
<result column="ORG_CREATE_TIME" jdbcType="VARBINARY" property="orgCreateTime" />
|
||||
<result column="REMARK" jdbcType="CHAR" property="remark" />
|
||||
<result column="COMPANY_ID" jdbcType="VARCHAR" property="companyId" />
|
||||
<result column="DEPT_ID" jdbcType="VARCHAR" property="deptId" />
|
||||
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName" />
|
||||
<result column="COMPANY_NAME" jdbcType="VARCHAR" property="companyName" />
|
||||
<result column="ORG_BRANCH_LEADER" jdbcType="CHAR" property="orgBranchLeader" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
COMPANY_ID,COMPANY_NAME,DEPT_ID,DEPT_NAME,ORG_AREA_TYPE,ORG_BRANCH_LEADER,ORG_CREATE_TIME,ORG_FULL_NAME,ORG_FULL_PATH_ID,ORG_FULL_PATH_NAME,ORG_ID,ORG_LEVEL,ORG_NAME,ORG_PARENT_ID,ORG_PRINCIPAL,ORG_SORT,ORG_STATUS,ORG_TYPE,ORG_WORK_ADDRESS,ORG_WORK_PHONE,REMARK
|
||||
</sql>
|
||||
<insert id="insert">
|
||||
insert into `T_PUB_ORG` (<include refid="Base_Column_List"/>) VALUES (
|
||||
#{companyId,jdbcType=VARCHAR},
|
||||
#{companyName,jdbcType=VARCHAR},
|
||||
#{deptId,jdbcType=VARCHAR},
|
||||
#{deptName,jdbcType=VARCHAR},
|
||||
#{orgAreaType,jdbcType=VARCHAR},
|
||||
#{orgBranchLeader,jdbcType=VARCHAR},
|
||||
#{orgCreateTime,jdbcType=TIMESTAMP},
|
||||
#{orgFullName,jdbcType=VARCHAR},
|
||||
#{orgFullPathId,jdbcType=VARCHAR},
|
||||
#{orgFullPathName,jdbcType=VARCHAR},
|
||||
#{orgId,jdbcType=VARCHAR},
|
||||
#{orgLevel,jdbcType=INTEGER},
|
||||
#{orgName,jdbcType=VARCHAR},
|
||||
#{orgParentId,jdbcType=VARCHAR},
|
||||
#{orgPrincipal,jdbcType=VARCHAR},
|
||||
#{orgSort,jdbcType=INTEGER},
|
||||
#{orgStatus,jdbcType=VARCHAR},
|
||||
#{orgType,jdbcType=VARCHAR},
|
||||
#{orgWorkAddress,jdbcType=VARCHAR},
|
||||
#{orgWorkPhone,jdbcType=VARCHAR},
|
||||
#{remark,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateById">
|
||||
UPDATE T_PUB_ORG
|
||||
<set>
|
||||
<if test="companyId!=null">COMPANY_ID=#{companyId,jdbcType=VARCHAR},</if>
|
||||
<if test="companyName!=null">COMPANY_NAME=#{companyName,jdbcType=VARCHAR},</if>
|
||||
<if test="deptId!=null">DEPT_ID=#{deptId,jdbcType=VARCHAR},</if>
|
||||
<if test="deptName!=null">DEPT_NAME=#{deptName,jdbcType=VARCHAR},</if>
|
||||
<if test="orgAreaType!=null">ORG_AREA_TYPE=#{orgAreaType,jdbcType=VARCHAR},</if>
|
||||
<if test="orgBranchLeader!=null">ORG_BRANCH_LEADER=#{orgBranchLeader,jdbcType=VARCHAR},</if>
|
||||
<if test="orgCreateTime!=null">ORG_CREATE_TIME=#{orgCreateTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="orgFullName!=null">ORG_FULL_NAME=#{orgFullName,jdbcType=VARCHAR},</if>
|
||||
<if test="orgFullPathId!=null">ORG_FULL_PATH_ID=#{orgFullPathId,jdbcType=VARCHAR},</if>
|
||||
<if test="orgFullPathName!=null">ORG_FULL_PATH_NAME=#{orgFullPathName,jdbcType=VARCHAR},</if>
|
||||
<if test="orgLevel!=null">ORG_LEVEL=#{orgLevel,jdbcType=INTEGER},</if>
|
||||
<if test="orgName!=null">ORG_NAME=#{orgName,jdbcType=VARCHAR},</if>
|
||||
<if test="orgParentId!=null">ORG_PARENT_ID=#{orgParentId,jdbcType=VARCHAR},</if>
|
||||
<if test="orgPrincipal!=null">ORG_PRINCIPAL=#{orgPrincipal,jdbcType=VARCHAR},</if>
|
||||
<if test="orgSort!=null">ORG_SORT=#{orgSort,jdbcType=INTEGER},</if>
|
||||
<if test="orgStatus!=null">ORG_STATUS=#{orgStatus,jdbcType=VARCHAR},</if>
|
||||
<if test="orgType!=null">ORG_TYPE=#{orgType,jdbcType=VARCHAR},</if>
|
||||
<if test="orgWorkAddress!=null">ORG_WORK_ADDRESS=#{orgWorkAddress,jdbcType=VARCHAR},</if>
|
||||
<if test="orgWorkPhone!=null">ORG_WORK_PHONE=#{orgWorkPhone,jdbcType=VARCHAR},</if>
|
||||
<if test="remark!=null">REMARK=#{remark,jdbcType=VARCHAR}</if>
|
||||
</set>
|
||||
where ORG_ID = #{orgId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<delete id="deleteByOrgId" parameterType="java.lang.String">
|
||||
DELETE FROM T_PUB_ORG WHERE ORG_ID= #{orgId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<select id="findOrgByDeptId" resultMap="RM_OrgEntity">
|
||||
SELECT * FROM T_PUB_ORG WHERE DEPT_ID = #{deptId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,813 @@
|
||||
package com.blueland.ebpm.home.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class UserEntity {
|
||||
|
||||
// columns START
|
||||
/**
|
||||
* 员工ID-唯一标识员工对象id db_column: staff_id
|
||||
*/
|
||||
private String staffId;
|
||||
|
||||
/**
|
||||
* 人资HR员工编号 db_column: staff_hr_id
|
||||
*/
|
||||
private String staffHrId;
|
||||
|
||||
/**
|
||||
* 姓名 db_column: staff_name
|
||||
*/
|
||||
private String staffName;
|
||||
// /**
|
||||
// * 英文名 db_column: staff_en_name
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffEnName;
|
||||
/**
|
||||
* 组织机构UUID db_column: org_id
|
||||
*/
|
||||
private String orgId;
|
||||
/**
|
||||
* 组织机构名称 db_column: org_name
|
||||
*/
|
||||
private String orgName;
|
||||
/**
|
||||
* 员工姓名的全拼 db_column: staff_spells
|
||||
*/
|
||||
private String staffSpells;
|
||||
/**
|
||||
* 员工姓名的简拼 db_column: staff_short_spells
|
||||
*/
|
||||
private String staffShortSpells;
|
||||
/**
|
||||
* 员工工号,如:01821
|
||||
*/
|
||||
private String staffNum;
|
||||
/**
|
||||
* 员工工号,如:01821
|
||||
*/
|
||||
private String staffShortNum;
|
||||
/**
|
||||
* 岗位UUID db_column: position_id
|
||||
*/
|
||||
private String positionId;
|
||||
/**
|
||||
* 岗位名称 db_column: position_name
|
||||
*/
|
||||
private String positionName;
|
||||
/**
|
||||
* 性别-N:男,V:女 db_column: staff_sex
|
||||
*/
|
||||
private String staffSex;
|
||||
// /**
|
||||
// * 年龄-年龄 db_column: staff_age
|
||||
// */
|
||||
// private Integer staffAge;
|
||||
// /**
|
||||
// * 证件类型,如:身份证,驾照,护照等 db_column: staff_paperwork_type
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffPaperworkType;
|
||||
// /**
|
||||
// * 身份证号,遵循中国身份证标准 db_column: staff_paperwork_num
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffPaperworkNum;
|
||||
/**
|
||||
* 邮件地址 db_column: staff_mail
|
||||
*/
|
||||
private String staffMail;
|
||||
/**
|
||||
* 常用手机 db_column: staff_mobile
|
||||
*/
|
||||
private String staffMobile;
|
||||
// /**
|
||||
// * 备用手机 db_column: staff_mobile_bak
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffMobileBak;
|
||||
/**
|
||||
* 传真(该字段传的是上级人工号)
|
||||
*/
|
||||
private String staffFax;
|
||||
|
||||
//20220310 zt add 上级人工号
|
||||
private String bossNum;
|
||||
|
||||
// /**
|
||||
// * 短号码 db_column: staff_short_fax
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffShortFax;
|
||||
/**
|
||||
* 企业微信id db_column: staff_wechart
|
||||
*/
|
||||
private String staffWechart;
|
||||
// /**
|
||||
// * 家庭住址 db_column: staff_home_address
|
||||
// */
|
||||
// @Length(max = 1000)
|
||||
// private String staffHomeAddress;
|
||||
// /**
|
||||
// * 家庭电话 db_column: staff_home_phone
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffHomePhone;
|
||||
// /**
|
||||
// * 办公地址 db_column: staff_work_address
|
||||
// */
|
||||
// @Length(max = 1000)
|
||||
// private String staffWorkAddress;
|
||||
// /**
|
||||
// * 办公电话 db_column: staff_work_phone
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffWorkPhone;
|
||||
// /**
|
||||
// * 护照号 db_column: staff_passport
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffPassport;
|
||||
// /**
|
||||
// * 民族 db_column: staff_nation
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffNation;
|
||||
// /**
|
||||
// * 政治面貌 db_column: staff_political_status
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String staffPoliticalStatus;
|
||||
// /**
|
||||
// * 籍贯 db_column: staff_native_place
|
||||
// */
|
||||
// @Length(max = 200)
|
||||
// private String staffNativePlace;
|
||||
/**
|
||||
* 排序 db_column: staff_sort
|
||||
*/
|
||||
private Integer staffSort;
|
||||
/**
|
||||
* 员工状态 启用:QY 禁用:JY db_column: staff_status
|
||||
*/
|
||||
private String staffStatus;
|
||||
// /**
|
||||
// * 员工类型-1、编制内员工 2、编制外员工 db_column: staff_work_type
|
||||
// */
|
||||
// @Length(max = 20)
|
||||
// private String staffWorkType;
|
||||
/**
|
||||
* 是否临时账号-正常:ZC,临时:LS db_column: staff_account_type
|
||||
*/
|
||||
private String staffAccountType;
|
||||
/**
|
||||
* 员工类型,GYGS:工业公司, ,SYGS:商业公司, LSH:零售户(场所) ,XFZ:消费者 ,GYS:供应商 db_column:
|
||||
* staff_type
|
||||
*/
|
||||
private String staffType;
|
||||
|
||||
/**
|
||||
* 员工类型,GYGS:工业公司, ,SYGS:商业公司, LSH:零售户(场所) ,XFZ:消费者 ,GYS:供应商 db_column:
|
||||
* staff_type
|
||||
*/
|
||||
private String staffSubType;
|
||||
/**
|
||||
* 创建人 db_column: staff_creator
|
||||
*/
|
||||
private String staffCreator;
|
||||
/**
|
||||
* 创建时间 db_column: staff_create_time
|
||||
*/
|
||||
private Date staffCreateTime;
|
||||
/**
|
||||
* 修改人 db_column: staff_updator
|
||||
*/
|
||||
private String staffUpdator;
|
||||
/**
|
||||
* 最后修改时间 db_column: staff_lastupdate_time
|
||||
*/
|
||||
private Date staffLastupdateTime;
|
||||
|
||||
// /**
|
||||
// * 职位HrId db_column: position_hr_id
|
||||
// */
|
||||
// @Length(max = 100)
|
||||
// private String positionHrId;
|
||||
|
||||
// /**
|
||||
// * 是否是主身份,Y 是、N 否 冗余字段
|
||||
// */
|
||||
// private String mainIdentityStatus;
|
||||
|
||||
// /**
|
||||
// * 是否是当前身份,Y 是、N 否 冗余字段
|
||||
// */
|
||||
// private String currentIdentityStatus;
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String companyName;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private String deptId;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
// columns END
|
||||
// 零售户名称
|
||||
// private String retailName;
|
||||
// 省编号
|
||||
// private String provinceId;
|
||||
// 市编号
|
||||
// private String cityId;
|
||||
// 区编号
|
||||
// private String areaId;
|
||||
// 员工登录账号,主账号
|
||||
private String staffCode;
|
||||
// 人员生日
|
||||
private Date staffBirthday;
|
||||
// 员工状态 db_column: staff_job_status
|
||||
private String staffJobStatus;
|
||||
|
||||
// 任岗编码(唯一值,岗位编码_工号)
|
||||
private String staffPostCode;
|
||||
|
||||
// 任岗类型(主岗main, 兼岗 parttime)
|
||||
private String staffPostType;
|
||||
// /**
|
||||
// * 学历 db_column: staff_education 11-研究生教育 12-博士研究生 13-硕士研究生 14-研究生班 15-研究生课程班
|
||||
// * 16-中央党校研究生 17-省(区、市)委党校研究生 18-本科 19-大学 20-大专及以下 21-大学普通班 22-第二学士学位班 23-中央党校大学
|
||||
// * 24-省(区、市)委党校大学 25-中央党校大专 26-省(区、市)委党校大专 27-大专专业证书 28-中等职业学校 29-中专 30-职高 31-技校
|
||||
// * 32-普通高中 33-普通高中 34-初中 35-初中 36-小学
|
||||
// */
|
||||
// private String staffEducation;
|
||||
|
||||
// /**
|
||||
// * 退休时间 db_column: staff_retired_time
|
||||
// */
|
||||
// private Date staffRetiredTime;
|
||||
|
||||
// /**
|
||||
// * 查询条件,冗余字段,数据库中不存在 Y代表投资公司的员工,N或者空代表非投资公司员工
|
||||
// */
|
||||
// private String isTzgs;
|
||||
|
||||
// // 是否已经创建标识
|
||||
// private String isCreate;
|
||||
|
||||
// 冗余字段(查询条件),只查询该组织下主身份的员工
|
||||
// private String mainIdentityStaff;
|
||||
|
||||
// 冗余字段(查询条件)
|
||||
// private String queryStaff ;
|
||||
|
||||
// private String queryOrgId;
|
||||
// 冗余字段(当前员工的职位)
|
||||
// private String currentPositionId;
|
||||
|
||||
public UserEntity() {
|
||||
}
|
||||
|
||||
public String getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(String staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public String getStaffHrId() {
|
||||
return staffHrId;
|
||||
}
|
||||
|
||||
public void setStaffHrId(String staffHrId) {
|
||||
this.staffHrId = staffHrId;
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return staffName;
|
||||
}
|
||||
|
||||
public void setStaffName(String staffName) {
|
||||
this.staffName = staffName;
|
||||
}
|
||||
|
||||
// public String getStaffEnName() {
|
||||
// return staffEnName;
|
||||
// }
|
||||
//
|
||||
// public void setStaffEnName(String staffEnName) {
|
||||
// this.staffEnName = staffEnName;
|
||||
// }
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getOrgName() {
|
||||
return orgName;
|
||||
}
|
||||
|
||||
public void setOrgName(String orgName) {
|
||||
this.orgName = orgName;
|
||||
}
|
||||
|
||||
public String getStaffSpells() {
|
||||
return staffSpells;
|
||||
}
|
||||
|
||||
public void setStaffSpells(String staffSpells) {
|
||||
this.staffSpells = staffSpells;
|
||||
}
|
||||
|
||||
public String getStaffShortSpells() {
|
||||
return staffShortSpells;
|
||||
}
|
||||
|
||||
public void setStaffShortSpells(String staffShortSpells) {
|
||||
this.staffShortSpells = staffShortSpells;
|
||||
}
|
||||
|
||||
public String getStaffNum() {
|
||||
return staffNum;
|
||||
}
|
||||
|
||||
public void setStaffNum(String staffNum) {
|
||||
this.staffNum = staffNum;
|
||||
}
|
||||
|
||||
public String getStaffShortNum() {
|
||||
return staffShortNum;
|
||||
}
|
||||
|
||||
public void setStaffShortNum(String staffShortNum) {
|
||||
this.staffShortNum = staffShortNum;
|
||||
}
|
||||
|
||||
public String getPositionId() {
|
||||
return positionId;
|
||||
}
|
||||
|
||||
public void setPositionId(String positionId) {
|
||||
this.positionId = positionId;
|
||||
}
|
||||
|
||||
public String getPositionName() {
|
||||
return positionName;
|
||||
}
|
||||
|
||||
public void setPositionName(String positionName) {
|
||||
this.positionName = positionName;
|
||||
}
|
||||
|
||||
public String getStaffSex() {
|
||||
return staffSex;
|
||||
}
|
||||
|
||||
public void setStaffSex(String staffSex) {
|
||||
this.staffSex = staffSex;
|
||||
}
|
||||
|
||||
// public Integer getStaffAge() {
|
||||
// return staffAge;
|
||||
// }
|
||||
//
|
||||
// public void setStaffAge(Integer staffAge) {
|
||||
// this.staffAge = staffAge;
|
||||
// }
|
||||
|
||||
// public String getStaffPaperworkType() {
|
||||
// return staffPaperworkType;
|
||||
// }
|
||||
//
|
||||
// public void setStaffPaperworkType(String staffPaperworkType) {
|
||||
// this.staffPaperworkType = staffPaperworkType;
|
||||
// }
|
||||
|
||||
// public String getStaffPaperworkNum() {
|
||||
// return staffPaperworkNum;
|
||||
// }
|
||||
//
|
||||
// public void setStaffPaperworkNum(String staffPaperworkNum) {
|
||||
// this.staffPaperworkNum = staffPaperworkNum;
|
||||
// }
|
||||
|
||||
public String getStaffMail() {
|
||||
return staffMail;
|
||||
}
|
||||
|
||||
public void setStaffMail(String staffMail) {
|
||||
this.staffMail = staffMail;
|
||||
}
|
||||
|
||||
public String getStaffMobile() {
|
||||
return staffMobile;
|
||||
}
|
||||
|
||||
public void setStaffMobile(String staffMobile) {
|
||||
this.staffMobile = staffMobile;
|
||||
}
|
||||
|
||||
// public String getStaffMobileBak() {
|
||||
// return staffMobileBak;
|
||||
// }
|
||||
//
|
||||
// public void setStaffMobileBak(String staffMobileBak) {
|
||||
// this.staffMobileBak = staffMobileBak;
|
||||
// }
|
||||
|
||||
public String getStaffFax() {
|
||||
return staffFax;
|
||||
}
|
||||
|
||||
public void setStaffFax(String staffFax) {
|
||||
this.staffFax = staffFax;
|
||||
}
|
||||
|
||||
// public String getStaffShortFax() {
|
||||
// return staffShortFax;
|
||||
// }
|
||||
//
|
||||
// public void setStaffShortFax(String staffShortFax) {
|
||||
// this.staffShortFax = staffShortFax;
|
||||
// }
|
||||
|
||||
public String getBossNum() {
|
||||
return bossNum;
|
||||
}
|
||||
|
||||
public void setBossNum(String bossNum) {
|
||||
this.bossNum = bossNum;
|
||||
}
|
||||
|
||||
public String getStaffWechart() {
|
||||
return staffWechart;
|
||||
}
|
||||
|
||||
public void setStaffWechart(String staffWechart) {
|
||||
this.staffWechart = staffWechart;
|
||||
}
|
||||
|
||||
// public String getStaffHomeAddress() {
|
||||
// return staffHomeAddress;
|
||||
// }
|
||||
//
|
||||
// public void setStaffHomeAddress(String staffHomeAddress) {
|
||||
// this.staffHomeAddress = staffHomeAddress;
|
||||
// }
|
||||
|
||||
// public String getStaffHomePhone() {
|
||||
// return staffHomePhone;
|
||||
// }
|
||||
//
|
||||
// public void setStaffHomePhone(String staffHomePhone) {
|
||||
// this.staffHomePhone = staffHomePhone;
|
||||
// }
|
||||
|
||||
// public String getStaffWorkAddress() {
|
||||
// return staffWorkAddress;
|
||||
// }
|
||||
//
|
||||
// public void setStaffWorkAddress(String staffWorkAddress) {
|
||||
// this.staffWorkAddress = staffWorkAddress;
|
||||
// }
|
||||
|
||||
// public String getStaffWorkPhone() {
|
||||
// return staffWorkPhone;
|
||||
// }
|
||||
//
|
||||
// public void setStaffWorkPhone(String staffWorkPhone) {
|
||||
// this.staffWorkPhone = staffWorkPhone;
|
||||
// }
|
||||
|
||||
// public String getStaffPassport() {
|
||||
// return staffPassport;
|
||||
// }
|
||||
//
|
||||
// public void setStaffPassport(String staffPassport) {
|
||||
// this.staffPassport = staffPassport;
|
||||
// }
|
||||
|
||||
// public String getStaffNation() {
|
||||
// return staffNation;
|
||||
// }
|
||||
//
|
||||
// public void setStaffNation(String staffNation) {
|
||||
// this.staffNation = staffNation;
|
||||
// }
|
||||
|
||||
// public String getStaffPoliticalStatus() {
|
||||
// return staffPoliticalStatus;
|
||||
// }
|
||||
//
|
||||
// public void setStaffPoliticalStatus(String staffPoliticalStatus) {
|
||||
// this.staffPoliticalStatus = staffPoliticalStatus;
|
||||
// }
|
||||
|
||||
// public String getStaffNativePlace() {
|
||||
// return staffNativePlace;
|
||||
// }
|
||||
//
|
||||
// public void setStaffNativePlace(String staffNativePlace) {
|
||||
// this.staffNativePlace = staffNativePlace;
|
||||
// }
|
||||
|
||||
public Integer getStaffSort() {
|
||||
return staffSort;
|
||||
}
|
||||
|
||||
public void setStaffSort(Integer staffSort) {
|
||||
this.staffSort = staffSort;
|
||||
}
|
||||
|
||||
public String getStaffStatus() {
|
||||
return staffStatus;
|
||||
}
|
||||
|
||||
public void setStaffStatus(String staffStatus) {
|
||||
this.staffStatus = staffStatus;
|
||||
}
|
||||
|
||||
// public String getStaffWorkType() {
|
||||
// return staffWorkType;
|
||||
// }
|
||||
//
|
||||
// public void setStaffWorkType(String staffWorkType) {
|
||||
// this.staffWorkType = staffWorkType;
|
||||
// }
|
||||
|
||||
public String getStaffAccountType() {
|
||||
return staffAccountType;
|
||||
}
|
||||
|
||||
public void setStaffAccountType(String staffAccountType) {
|
||||
this.staffAccountType = staffAccountType;
|
||||
}
|
||||
|
||||
public String getStaffType() {
|
||||
return staffType;
|
||||
}
|
||||
|
||||
public void setStaffType(String staffType) {
|
||||
this.staffType = staffType;
|
||||
}
|
||||
|
||||
public String getStaffSubType() {
|
||||
return staffSubType;
|
||||
}
|
||||
|
||||
public void setStaffSubType(String staffSubType) {
|
||||
this.staffSubType = staffSubType;
|
||||
}
|
||||
|
||||
public String getStaffCreator() {
|
||||
return staffCreator;
|
||||
}
|
||||
|
||||
public void setStaffCreator(String staffCreator) {
|
||||
this.staffCreator = staffCreator;
|
||||
}
|
||||
|
||||
public Date getStaffCreateTime() {
|
||||
return staffCreateTime;
|
||||
}
|
||||
|
||||
public void setStaffCreateTime(Date staffCreateTime) {
|
||||
this.staffCreateTime = staffCreateTime;
|
||||
}
|
||||
|
||||
public String getStaffUpdator() {
|
||||
return staffUpdator;
|
||||
}
|
||||
|
||||
public void setStaffUpdator(String staffUpdator) {
|
||||
this.staffUpdator = staffUpdator;
|
||||
}
|
||||
|
||||
public Date getStaffLastupdateTime() {
|
||||
return staffLastupdateTime;
|
||||
}
|
||||
|
||||
public void setStaffLastupdateTime(Date staffLastupdateTime) {
|
||||
this.staffLastupdateTime = staffLastupdateTime;
|
||||
}
|
||||
|
||||
// public String getPositionHrId() {
|
||||
// return positionHrId;
|
||||
// }
|
||||
//
|
||||
// public void setPositionHrId(String positionHrId) {
|
||||
// this.positionHrId = positionHrId;
|
||||
// }
|
||||
|
||||
// public String getMainIdentityStatus() {
|
||||
// return mainIdentityStatus;
|
||||
// }
|
||||
//
|
||||
// public void setMainIdentityStatus(String mainIdentityStatus) {
|
||||
// this.mainIdentityStatus = mainIdentityStatus;
|
||||
// }
|
||||
|
||||
// public String getCurrentIdentityStatus() {
|
||||
// return currentIdentityStatus;
|
||||
// }
|
||||
//
|
||||
// public void setCurrentIdentityStatus(String currentIdentityStatus) {
|
||||
// this.currentIdentityStatus = currentIdentityStatus;
|
||||
// }
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(String deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
// public String getRetailName() {
|
||||
// return retailName;
|
||||
// }
|
||||
//
|
||||
// public void setRetailName(String retailName) {
|
||||
// this.retailName = retailName;
|
||||
// }
|
||||
|
||||
// public String getProvinceId() {
|
||||
// return provinceId;
|
||||
// }
|
||||
//
|
||||
// public void setProvinceId(String provinceId) {
|
||||
// this.provinceId = provinceId;
|
||||
// }
|
||||
|
||||
// public String getCityId() {
|
||||
// return cityId;
|
||||
// }
|
||||
//
|
||||
// public void setCityId(String cityId) {
|
||||
// this.cityId = cityId;
|
||||
// }
|
||||
|
||||
// public String getAreaId() {
|
||||
// return areaId;
|
||||
// }
|
||||
//
|
||||
// public void setAreaId(String areaId) {
|
||||
// this.areaId = areaId;
|
||||
// }
|
||||
|
||||
public String getStaffCode() {
|
||||
return staffCode;
|
||||
}
|
||||
|
||||
public void setStaffCode(String staffCode) {
|
||||
this.staffCode = staffCode;
|
||||
}
|
||||
|
||||
public Date getStaffBirthday() {
|
||||
return staffBirthday;
|
||||
}
|
||||
|
||||
public void setStaffBirthday(Date staffBirthday) {
|
||||
this.staffBirthday = staffBirthday;
|
||||
}
|
||||
|
||||
public String getStaffJobStatus() {
|
||||
return staffJobStatus;
|
||||
}
|
||||
|
||||
public void setStaffJobStatus(String staffJobStatus) {
|
||||
this.staffJobStatus = staffJobStatus;
|
||||
}
|
||||
|
||||
public String getStaffPostCode() {
|
||||
return staffPostCode;
|
||||
}
|
||||
|
||||
public void setStaffPostCode(String staffPostCode) {
|
||||
this.staffPostCode = staffPostCode;
|
||||
}
|
||||
|
||||
public String getStaffPostType() {
|
||||
return staffPostType;
|
||||
}
|
||||
|
||||
public void setStaffPostType(String staffPostType) {
|
||||
this.staffPostType = staffPostType;
|
||||
}
|
||||
|
||||
// public String getStaffEducation() {
|
||||
// return staffEducation;
|
||||
// }
|
||||
//
|
||||
// public void setStaffEducation(String staffEducation) {
|
||||
// this.staffEducation = staffEducation;
|
||||
// }
|
||||
|
||||
// public Date getStaffRetiredTime() {
|
||||
// return staffRetiredTime;
|
||||
// }
|
||||
//
|
||||
// public void setStaffRetiredTime(Date staffRetiredTime) {
|
||||
// this.staffRetiredTime = staffRetiredTime;
|
||||
// }
|
||||
|
||||
// public String getIsTzgs() {
|
||||
// return isTzgs;
|
||||
// }
|
||||
//
|
||||
// public void setIsTzgs(String isTzgs) {
|
||||
// this.isTzgs = isTzgs;
|
||||
// }
|
||||
|
||||
// public String getIsCreate() {
|
||||
// return isCreate;
|
||||
// }
|
||||
//
|
||||
// public void setIsCreate(String isCreate) {
|
||||
// this.isCreate = isCreate;
|
||||
// }
|
||||
|
||||
// public String getMainIdentityStaff() {
|
||||
// return mainIdentityStaff;
|
||||
// }
|
||||
//
|
||||
// public void setMainIdentityStaff(String mainIdentityStaff) {
|
||||
// this.mainIdentityStaff = mainIdentityStaff;
|
||||
// }
|
||||
|
||||
// public String getQueryStaff() {
|
||||
// return queryStaff;
|
||||
// }
|
||||
//
|
||||
// public void setQueryStaff(String queryStaff) {
|
||||
// this.queryStaff = queryStaff;
|
||||
// }
|
||||
|
||||
// public String getQueryOrgId() {
|
||||
// return queryOrgId;
|
||||
// }
|
||||
//
|
||||
// public void setQueryOrgId(String queryOrgId) {
|
||||
// this.queryOrgId = queryOrgId;
|
||||
// }
|
||||
|
||||
// public String getCurrentPositionId() {
|
||||
// return currentPositionId;
|
||||
// }
|
||||
//
|
||||
// public void setCurrentPositionId(String currentPositionId) {
|
||||
// this.currentPositionId = currentPositionId;
|
||||
// }
|
||||
|
||||
// public Staff(String staffId, String staffName, String orgId, String orgName) {
|
||||
// this.staffId = staffId;
|
||||
// this.staffName = staffName;
|
||||
// this.orgId = orgId;
|
||||
// this.orgName = orgName;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="UserEntity">
|
||||
<resultMap id="RM_userEntity" type="com.blueland.bpm.identity.model.User">
|
||||
<result property="userId" column="USER_ID"/>
|
||||
<result property="userCode" column="USER_CODE"/>
|
||||
<result property="userName" column="USER_NAME"/>
|
||||
<result property="userSex" column="USER_SEX"/>
|
||||
<result property="userAge" column="USER_AGE"/>
|
||||
<result property="companyId" column="COMPANY_ID"/>
|
||||
<result property="companyName" column="COMPANY_NAME"/>
|
||||
<result property="orgId" column="ORG_ID"/>
|
||||
<result property="orgName" column="ORG_NAME"/>
|
||||
<result property="deptId" column="DEPT_ID"/>
|
||||
<result property="deptName" column="DEPT_NAME"/>
|
||||
<result property="companyName" column="COMPANY_NAME"/>
|
||||
<result property="userMobile" column="USER_MOBILE"/>
|
||||
<result property="userMail" column="USER_MAIL"/>
|
||||
<result property="userWorkAddress" column="USER_WORK_ADDRESS"/>
|
||||
<result property="userWorkPhone" column="USER_WORK_PHONE"/>
|
||||
<result property="userHomeAddree" column="USER_HOME_ADDREE"/>
|
||||
<result property="userHomePhone" column="USER_HOME_PHONE"/>
|
||||
<result property="positionId" column="POSITION_ID"/>
|
||||
<result property="pluralityPositionId" column="PLURALITY_POSITION_ID"/>
|
||||
<result property="titleId" column="TITLE_ID"/>
|
||||
<result property="pluralityTitleId" column="PLURALITY_TITLE_ID"/>
|
||||
<result property="userSort" column="USER_SORT"/>
|
||||
<result property="userType" column="USER_TYPE"/>
|
||||
<result property="userStatus" column="USER_STATUS"/>
|
||||
<result property="userPwd" column="USER_PWD"/>
|
||||
<result property="userCreateTime" column="USER_CREATE_TIME"/>
|
||||
<result property="userUpdateTime" column="USER_UPDATE_TIME"/>
|
||||
<result property="userCreator" column="USER_CREATOR"/>
|
||||
<result property="remark" column="REMARK"/>
|
||||
<result property="deptId" column="DEPT_ID"/>
|
||||
<result property="deptName" column="DEPT_NAME"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
`USER_ID`, `USER_CODE`, `USER_NAME`, `USER_SEX`, `USER_AGE`, `USER_MOBILE`, `USER_MAIL`,
|
||||
`USER_WORK_ADDRESS`, `USER_WORK_PHONE`, `USER_HOME_ADDREE`, `USER_HOME_PHONE`, `POSITION_ID`,
|
||||
`PLURALITY_POSITION_ID`, `TITLE_ID`, `PLURALITY_TITLE_ID`, `USER_TYPE`, `USER_STATUS`,
|
||||
`USER_SORT`, `USER_PWD`, `USER_CREATE_TIME`, `USER_UPDATE_TIME`, `USER_CREATOR`,
|
||||
`REMARK`, `COMPANY_ID`, `ORG_ID`, `DEPT_ID`, `COMPANY_NAME`, `DEPT_NAME`, `ORG_NAME`
|
||||
</sql>
|
||||
<insert id="insert">
|
||||
insert into `T_PUB_USER` (<include refid="Base_Column_List"/>) VALUES (
|
||||
#{userId,jdbcType=VARCHAR},
|
||||
#{userCode,jdbcType=VARCHAR},
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
#{userSex,jdbcType=VARCHAR},
|
||||
#{userAge,jdbcType=INTEGER},
|
||||
#{userMobile,jdbcType=VARCHAR},
|
||||
#{userMail,jdbcType=VARCHAR},
|
||||
#{userWorkAddress,jdbcType=CHAR},
|
||||
#{userWorkPhone,jdbcType=CHAR},
|
||||
#{userHomeAddree,jdbcType=CHAR},
|
||||
#{userHomePhone,jdbcType=CHAR},
|
||||
#{positionId,jdbcType=CHAR},
|
||||
#{pluralityPositionId,jdbcType=CHAR},
|
||||
#{titleId,jdbcType=CHAR},
|
||||
#{pluralityTitleId,jdbcType=CHAR},
|
||||
#{userType,jdbcType=CHAR},
|
||||
#{userStatus,jdbcType=VARCHAR},
|
||||
#{userSort,jdbcType=INTEGER},
|
||||
#{userPwd,jdbcType=VARCHAR},
|
||||
#{userCreateTime,jdbcType=VARBINARY},
|
||||
#{userUpdateTime,jdbcType=VARBINARY},
|
||||
#{userCreator,jdbcType=CHAR},
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
#{companyId,jdbcType=VARCHAR},
|
||||
#{orgId,jdbcType=VARCHAR},
|
||||
#{deptId,jdbcType=VARCHAR},
|
||||
#{companyName,jdbcType=VARCHAR},
|
||||
#{deptName,jdbcType=VARCHAR},
|
||||
#{orgName,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<update id="updateByRemark">
|
||||
UPDATE T_PUB_USER
|
||||
<set>
|
||||
<if test="@Ognl@isNotEmpty(userId)">
|
||||
USER_ID = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userCode)">
|
||||
USER_CODE = #{userCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userName)">
|
||||
USER_NAME = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userSex)">
|
||||
USER_SEX = #{userSex,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userAge)">
|
||||
USER_AGE = #{userAge,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyId)">
|
||||
COMPANY_ID =
|
||||
#{companyId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyName)">
|
||||
COMPANY_NAME = #{companyName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
ORG_ID = #{orgId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(orgName)">
|
||||
ORG_NAME = #{orgName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(deptId)">
|
||||
DEPT_ID = #{deptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(deptName)">
|
||||
DEPT_NAME = #{deptName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyName)">
|
||||
COMPANY_NAME = #{companyName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userMobile)">
|
||||
USER_MOBILE =
|
||||
#{userMobile,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userMail)">
|
||||
USER_MAIL =
|
||||
#{userMail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userPwd)">
|
||||
USER_PWD = #{userPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userStatus)">
|
||||
USER_STATUS = #{userStatus,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
</set>
|
||||
WHERE REMARK = #{remark,jdbcType=VARCHAR} and USER_ID = #{userId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByUserId">
|
||||
UPDATE T_PUB_USER
|
||||
<set>
|
||||
<if test="@Ognl@isNotEmpty(userCode)">
|
||||
USER_CODE = #{userCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userName)">
|
||||
USER_NAME = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userSex)">
|
||||
USER_SEX = #{userSex,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userAge)">
|
||||
USER_AGE = #{userAge,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyId)">
|
||||
COMPANY_ID =
|
||||
#{companyId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyName)">
|
||||
COMPANY_NAME = #{companyName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
ORG_ID = #{orgId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(orgName)">
|
||||
ORG_NAME = #{orgName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(deptId)">
|
||||
DEPT_ID = #{deptId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(deptName)">
|
||||
DEPT_NAME = #{deptName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(companyName)">
|
||||
COMPANY_NAME = #{companyName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userMobile)">
|
||||
USER_MOBILE =
|
||||
#{userMobile,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userMail)">
|
||||
USER_MAIL =
|
||||
#{userMail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userPwd)">
|
||||
USER_PWD = #{userPwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(remark)">
|
||||
REMARK = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userStatus)">
|
||||
USER_STATUS = #{userStatus,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
</set>
|
||||
WHERE USER_ID = #{userId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM T_PUB_USER WHERE USER_ID= #{userId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<select id="findUserByUserId" resultMap="RM_userEntity">
|
||||
SELECT * FROM T_PUB_USER WHERE USER_ID = #{userId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<select id="findUserByRemark" resultMap="RM_userEntity">
|
||||
SELECT * FROM T_PUB_USER WHERE REMARK = #{remark,jdbcType=VARCHAR} ORDER BY USER_CREATE_TIME LIMIT 1
|
||||
</select>
|
||||
<update id="updateStatusByUserId">
|
||||
UPDATE T_PUB_USER SET USER_STATUS='JY' WHERE USER_ID= #{userId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<update id="updateQyStatusByUserId">
|
||||
UPDATE T_PUB_USER SET USER_STATUS='QY' WHERE USER_ID= #{userId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.blueland.ebpm.home.model;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class UserPostEntity {
|
||||
|
||||
// columns START
|
||||
/**
|
||||
* 员工工号
|
||||
*/
|
||||
private String staffNum;
|
||||
|
||||
/**
|
||||
* 员工账号
|
||||
*/
|
||||
private String staffCode;
|
||||
|
||||
// 任岗编码(唯一值,岗位编码_工号)
|
||||
private String staffPostCode;
|
||||
|
||||
// 任岗类型(主岗main, 兼岗 parttime)
|
||||
private String staffPostType;
|
||||
|
||||
// 部门编码
|
||||
private String deptCode;
|
||||
// 部门名称
|
||||
private String deptName;
|
||||
// 岗位编码:如A01A01A04A0302
|
||||
private String positionCode;
|
||||
// 岗位名称
|
||||
private String positionName;
|
||||
// 状态(启用enable, 禁用disable,删除delete);系统目前只有启用的数据
|
||||
private String status;
|
||||
// 创建人账号
|
||||
private String createUser;
|
||||
// 创建时间
|
||||
private String createTime;
|
||||
|
||||
private String updateUser;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
public String getStaffNum() {
|
||||
return staffNum;
|
||||
}
|
||||
|
||||
public void setStaffNum(String staffNum) {
|
||||
this.staffNum = staffNum;
|
||||
}
|
||||
|
||||
public String getStaffCode() {
|
||||
return staffCode;
|
||||
}
|
||||
|
||||
public void setStaffCode(String staffCode) {
|
||||
this.staffCode = staffCode;
|
||||
}
|
||||
|
||||
public String getStaffPostCode() {
|
||||
return staffPostCode;
|
||||
}
|
||||
|
||||
public void setStaffPostCode(String staffPostCode) {
|
||||
this.staffPostCode = staffPostCode;
|
||||
}
|
||||
|
||||
public String getStaffPostType() {
|
||||
return staffPostType;
|
||||
}
|
||||
|
||||
public void setStaffPostType(String staffPostType) {
|
||||
this.staffPostType = staffPostType;
|
||||
}
|
||||
|
||||
public String getDeptCode() {
|
||||
return deptCode;
|
||||
}
|
||||
|
||||
public void setDeptCode(String deptCode) {
|
||||
this.deptCode = deptCode;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getPositionCode() {
|
||||
return positionCode;
|
||||
}
|
||||
|
||||
public void setPositionCode(String positionCode) {
|
||||
this.positionCode = positionCode;
|
||||
}
|
||||
|
||||
public String getPositionName() {
|
||||
return positionName;
|
||||
}
|
||||
|
||||
public void setPositionName(String positionName) {
|
||||
this.positionName = positionName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateUser() {
|
||||
return createUser;
|
||||
}
|
||||
|
||||
public void setCreateUser(String createUser) {
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
|
||||
public String getUpdateUser() {
|
||||
return updateUser;
|
||||
}
|
||||
|
||||
public void setUpdateUser(String updateUser) {
|
||||
this.updateUser = updateUser;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.blueland.ebpm.listenner;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.engine.config.model.GloblBizProcessHandler;
|
||||
import com.blueland.bpm.engine.config.service.GloblBizProcessHandlerManager;
|
||||
import com.blueland.bpm.engine.core.handler.GlobalBizHandler;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.unitework.model.UniteworkTask;
|
||||
import com.blueland.unitework.service.UniteworkService;
|
||||
import com.rzdata.dzy.third.message.domain.AliyunSmsResult;
|
||||
import com.rzdata.dzy.third.message.service.IMessageSendService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 待办提醒处理
|
||||
*
|
||||
* @author lw
|
||||
*
|
||||
*/
|
||||
|
||||
public class GlobalTaskMsgMotice implements GlobalBizHandler {
|
||||
|
||||
private String TODOTYPE = "todo";
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
UniteworkService uniteworkService = (UniteworkService) com.blueland.bpm.common.util.ApplicationContextHolder
|
||||
.getBean("uniteworkService");
|
||||
UserService userService = (UserService) com.blueland.bpm.common.util.ApplicationContextHolder
|
||||
.getBean("userServiceImpl");
|
||||
ApplicationManager applicationManager = (ApplicationManager) com.blueland.bpm.common.util.ApplicationContextHolder
|
||||
.getBean("applicationManager");
|
||||
|
||||
IMessageSendService messageSendService = (IMessageSendService) com.blueland.bpm.common.util.ApplicationContextHolder
|
||||
.getBean("messageSendServiceImpl");
|
||||
|
||||
GloblBizProcessHandlerManager globlBizProcessHandlerManager = (GloblBizProcessHandlerManager) com.blueland.bpm.common.util.ApplicationContextHolder
|
||||
.getBean("globlBizProcessHandlerManager");
|
||||
|
||||
@Value("${rzdata.sendSmsMessage}")
|
||||
String sendSmsMessage;
|
||||
|
||||
@Override
|
||||
public void execute(Map<String, Object> processMap) {
|
||||
// TODO Auto-generated method stub
|
||||
exeTasks(processMap);
|
||||
exeHisTasks(processMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办通知
|
||||
*
|
||||
* @param processMap
|
||||
*/
|
||||
private void exeTasks(Map<String, Object> processMap) {
|
||||
List<UniteworkTask> tasks = (List<UniteworkTask>) processMap.get(GlobalTaskMsgMotice.TASKS_KEY);
|
||||
if (tasks == null || tasks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (UniteworkTask task : tasks) {
|
||||
try {
|
||||
noticeTask(task);
|
||||
} catch (Exception e) {
|
||||
logger.error(String.format("待办提醒消息发送失败,task[%s],processMap[%s]", task, processMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 已办通知
|
||||
*
|
||||
* @param processMap
|
||||
*/
|
||||
private void exeHisTasks(Map<String, Object> processMap) {
|
||||
List<UniteworkTask> hisTasks = (List<UniteworkTask>) processMap.get(GlobalTaskMsgMotice.HIS_TASKS_KEY);
|
||||
if (hisTasks == null || hisTasks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (UniteworkTask hisTask : hisTasks) {
|
||||
try {
|
||||
noticeHisTask(hisTask);
|
||||
} catch (Exception e) {
|
||||
logger.error(String.format("已办提醒消息发送失败,task[%s],processMap[%s]", hisTask, processMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void noticeTask(UniteworkTask task) {
|
||||
try {
|
||||
GloblBizProcessHandler globlBizProcessHandler = globlBizProcessHandlerManager.getById("send_message");
|
||||
if(null == globlBizProcessHandler){
|
||||
return;
|
||||
}
|
||||
if(!"open".equals(globlBizProcessHandler.getGbphRemark())){
|
||||
return;
|
||||
}
|
||||
String msgTemplate = "您有一条待办消息。消息标题:{}";
|
||||
String userId = task.getRecUserId();
|
||||
User user = userService.getUserById(userId);
|
||||
if(null == user){
|
||||
return;
|
||||
}
|
||||
String msgContent = StrUtil.format(msgTemplate, task.getTitle());
|
||||
AliyunSmsResult aliyunSmsResult = messageSendService.sendSmsMessageSync(user.getUserMobile(), msgContent);
|
||||
System.out.println("短信发送结果====>" + "当前流程实例ID:" + task.getProcInstId() + ";当前环节实例ID:" + task.getCurActInstId()
|
||||
+ ";当前环节名称:" + task.getCurActDefName() + ";发送结果:" + JSONUtil.toJsonStr(aliyunSmsResult));
|
||||
} catch (Exception e) {
|
||||
this.logger.error("发送消息错误:" + e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void noticeHisTask(UniteworkTask task) {
|
||||
/*
|
||||
* imService.sendUptMsg(task, "已处理待办:"+ task.getTitle());
|
||||
* mqService.putMsg(UniteworkService.buildDoneMsg(task), task);
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.DataObjectRelation;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectRelationManager;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityResourceModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.ebpm.bean.ActivityDefinitionBean;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ExtAttributBean;
|
||||
import com.blueland.ebpm.util.ComparatorActivity;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/activitydefinition")
|
||||
public class ActivityDefineController {
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private ProcessConfigService processConfigService;
|
||||
|
||||
@Autowired
|
||||
private DataObjectRelationManager dataObjectRelationManager;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/{actDefId}", produces = "application/json;charset=UTF-8")
|
||||
public ActivityDefinitionBean getActivity(@PathVariable String procDefId,
|
||||
@PathVariable String actDefId) {
|
||||
ActivityDefinitionModel model = processDefinitionService.getActivity(
|
||||
procDefId, actDefId);
|
||||
model.setActivityInfoConfig(processConfigService.getActivityInfoConfig(
|
||||
procDefId, actDefId));
|
||||
ActivityDefinitionBean bean = beansBuilder.build(model);
|
||||
bean.setPageUrl(processConfigService.getWorkflowPage(procDefId, actDefId));
|
||||
return bean;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/useract", produces = "application/json;charset=UTF-8")
|
||||
public List<ActivityDefinitionBean> getUserActivitys(@PathVariable String procDefId) {
|
||||
List<ActivityDefinitionModel> models = processDefinitionService.getProcessUserActivitys(procDefId);
|
||||
List<ActivityDefinitionBean> beans=new ArrayList<ActivityDefinitionBean>();
|
||||
for (ActivityDefinitionModel model : models) {
|
||||
model.setActivityInfoConfig(processConfigService.getActivityInfoConfig(
|
||||
procDefId, model.getActDefId()));
|
||||
ActivityDefinitionBean bean = beansBuilder.build(model);
|
||||
bean.setPageUrl(processConfigService.getWorkflowPage(procDefId, model.getActDefId()));
|
||||
beans.add(bean);
|
||||
}
|
||||
try{
|
||||
Collections.sort(beans, new ComparatorActivity());
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return beans;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}", produces = "application/json;charset=UTF-8")
|
||||
public List<ActivityDefinitionBean> getActivitys(@PathVariable String procDefId) {
|
||||
List<ActivityDefinitionModel> models = processDefinitionService.getProcessActivitys(procDefId);
|
||||
List<ActivityDefinitionBean> beans=new ArrayList<ActivityDefinitionBean>();
|
||||
for (ActivityDefinitionModel model : models) {
|
||||
model.setActivityInfoConfig(processConfigService.getActivityInfoConfig(
|
||||
procDefId, model.getActDefId()));
|
||||
ActivityDefinitionBean bean = beansBuilder.build(model);
|
||||
bean.setPageUrl(processConfigService.getWorkflowPage(procDefId, model.getActDefId()));
|
||||
beans.add(bean);
|
||||
}
|
||||
return beans;
|
||||
}
|
||||
|
||||
//@RequestMapping(value = "/{procDefId}/{actDefId}/page", produces = "text/plain;charset=UTF-8")
|
||||
@RequestMapping(value = "/{procDefId}/{actDefId}/page", produces = "application/json;charset=UTF-8")
|
||||
public Map<String,String> getWorkflowPage(@PathVariable String procDefId, @PathVariable String actDefId) {
|
||||
String page = processConfigService.getWorkflowPage(procDefId, actDefId);
|
||||
Map<String,String> result = new HashMap<String,String>();
|
||||
result.put("page", page);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/{actDefId}/extattrs", produces = "application/json; charset=UTF-8")
|
||||
public List<ExtAttributBean> getActExtattrs(@PathVariable String procDefId,
|
||||
@PathVariable String actDefId) {
|
||||
List<DataObjectRelation> list = dataObjectRelationManager
|
||||
.findDataObjectRelationsByActivityDefId(procDefId, actDefId);
|
||||
return beansBuilder.build(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/allactextattrs", produces = "application/json; charset=UTF-8")
|
||||
public List<ExtAttributBean> getAllActExtattrs(@PathVariable String procDefId) {
|
||||
List<DataObjectRelation> list = dataObjectRelationManager.findAllActDataObjectRelations(procDefId);
|
||||
return beansBuilder.build(list);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/{procDefId}/{actDefId}/resource", produces = "application/json; charset=UTF-8")
|
||||
public List<ActivityResourceModel> getActResouce(
|
||||
@PathVariable String procDefId,
|
||||
@PathVariable String actDefId) {
|
||||
return processDefinitionService.getResource(procDefId, actDefId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/{sourceActDefId}/{destActDefId}/extattrs", produces = "application/json; charset=UTF-8")
|
||||
public List<ExtAttributBean> getTransExtattrs(
|
||||
@PathVariable String procDefId,
|
||||
@PathVariable String sourceActDefId,
|
||||
@PathVariable String destActDefId) {
|
||||
List<DataObjectRelation> list = dataObjectRelationManager
|
||||
.findDataObjectRelationsBySequenceFlow(procDefId,
|
||||
sourceActDefId, destActDefId);
|
||||
return beansBuilder.build(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.ebpm.util.RestUtils;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityResourceModel;
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.bpm.engine.core.model.ProcessPageContext;
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import com.blueland.ebpm.bean.ActivityDefinitionBean;
|
||||
import com.blueland.ebpm.bean.ActivityInstanceBean;
|
||||
import com.blueland.ebpm.bean.ActivityOpBean;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/activityinstance")
|
||||
public class ActivityInstanceController {
|
||||
@Autowired
|
||||
private ProcessConfigService processConfigService;
|
||||
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value = "/{actInstId}")
|
||||
public ActivityInstanceBean getActInst(@PathVariable String actInstId) {
|
||||
ActivityInstanceModel model = processInstanceService.getHistoryTask(actInstId);
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/next/nextacts", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public List<ActivityDefinitionBean> getNextActivities(
|
||||
@RequestBody Map<String, String> param) {
|
||||
String curActInstId = param.get("curActInstId");
|
||||
String processInstId = null;
|
||||
String processDefinitionId = null;
|
||||
String curActDefId = null;
|
||||
if (RestUtils.isEmpty(curActInstId)) {
|
||||
processDefinitionId = param.get("procDefId");
|
||||
curActDefId = param.get("curActDefId");
|
||||
} else {
|
||||
ActivityInstanceModel model = processInstanceService
|
||||
.getTask(curActInstId);
|
||||
processDefinitionId = model.getProcDefId();
|
||||
processInstId = model.getProcInstId();
|
||||
curActDefId = model.getActDefId();
|
||||
}
|
||||
List<ActivityDefinitionModel> list = processDefinitionService
|
||||
.getNextActivity(processInstId, processDefinitionId,
|
||||
curActDefId, param);
|
||||
return beansBuilder.buildActDefList(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/next/nextactusers", produces = "application/json;charset=UTF-8")
|
||||
public List<ActivityResourceModel> getNextActivityUserTree(
|
||||
@RequestBody Map<String, String> param) {
|
||||
String curActInstId = param.get("curActInstId");
|
||||
String destActDefId = param.get("destActDefId");
|
||||
String userId = param.get("userId");
|
||||
String userOrgId = param.get("userOrgId");
|
||||
String procInstId = null;
|
||||
String procDefId = null;
|
||||
String curActDefId = null;
|
||||
if (RestUtils.isEmpty(curActInstId)) {
|
||||
procDefId = param.get("procDefId");
|
||||
curActDefId = param.get("curActDefId");
|
||||
} else {
|
||||
ActivityInstanceModel model = processInstanceService
|
||||
.getTask(curActInstId);
|
||||
procInstId = model.getProcInstId();
|
||||
procDefId = model.getProcDefId();
|
||||
curActDefId = model.getActDefId();
|
||||
}
|
||||
|
||||
return processDefinitionService.getActivityUserTree(procInstId,
|
||||
procDefId, curActInstId, curActDefId, destActDefId, userId,
|
||||
userOrgId, null, param);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/oppower", produces = "application/json; charset=UTF-8")
|
||||
public List<ActivityOpBean> getOpPower( @RequestBody Map<String, String> param) {
|
||||
String scope = param.get("scope");
|
||||
if (RestUtils.isEmpty(scope))
|
||||
throw new IllegalArgumentException("scope is null");
|
||||
|
||||
if (scope.equals("1")) { // 新建
|
||||
String procDefId = param.get("procDefId");
|
||||
if (RestUtils.isEmpty(procDefId))
|
||||
throw new IllegalArgumentException("procDefId is null");
|
||||
String actDefId = param.get("actDefId");
|
||||
if (RestUtils.isEmpty(actDefId))
|
||||
throw new IllegalArgumentException("actDefId is null");
|
||||
Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
ActivityInfoConfig actInfo = processConfigService
|
||||
.getActivityInfoConfig(procDefId, actDefId, scope,
|
||||
pageDetailVaribale);
|
||||
return beansBuilder.buildActOpList(actInfo
|
||||
.getActivityOperatePowers());
|
||||
} else {
|
||||
String actInstId = param.get("actInstId");
|
||||
if (RestUtils.isEmpty(actInstId))
|
||||
throw new IllegalArgumentException("actInstId is null");
|
||||
String userId = param.get("userId");
|
||||
if (RestUtils.isEmpty(userId))
|
||||
throw new IllegalArgumentException("userId is null");
|
||||
String userOrgId = param.get("userOrgId");
|
||||
if (RestUtils.isEmpty(userOrgId))
|
||||
throw new IllegalArgumentException("userOrgId is null");
|
||||
|
||||
ActivityInstanceModel actInst = processInstanceService.getHistoryTask(actInstId);
|
||||
if (actInst == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + actInstId);
|
||||
String procDefId = actInst.getProcDefId();
|
||||
String actDefId = actInst.getActDefId();
|
||||
Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
pageDetailVaribale.put("task", actInst);
|
||||
HistoricProcessInstanceEntity processInstance = (HistoricProcessInstanceEntity) processInstanceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(actInst.getProcInstId()).singleResult();
|
||||
if (processInstance == null)
|
||||
throw new RestException(ExceptionErrorCode.B2051.name(), "process instance not found, id=" + actInst.getProcInstId());
|
||||
pageDetailVaribale.put("processInstance", processInstance);
|
||||
ProcessPageContext processPageContext = new ProcessPageContext(
|
||||
scope, WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY, "",
|
||||
userId, userOrgId);
|
||||
pageDetailVaribale.put("processPageContext", processPageContext);
|
||||
ActivityInfoConfig actInfo = processConfigService
|
||||
.getActivityInfoConfig(procDefId, actDefId, scope,
|
||||
pageDetailVaribale);
|
||||
return beansBuilder.buildActOpList(actInfo.getActivityOperatePowers());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{actInstId}/backactivities", produces = "application/json; charset=UTF-8")
|
||||
public List<ActivityInstanceBean> findBackActivity(@PathVariable String actInstId){
|
||||
List<ActivityInstanceModel> result = processInstanceService.findBackAvtivity(actInstId);
|
||||
return beansBuilder.buildActInstList(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@RequestMapping(value = "/{actInstId}/comment", produces = "application/json; charset=UTF-8")
|
||||
public List<ProcessLogModel> getActInstComment(@PathVariable String actInstId){
|
||||
return processInstanceService.getActInstComments(actInstId);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.ebpm.util.RestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.bpm.idea.model.CommonIdeaEntity;
|
||||
import com.blueland.bpm.idea.service.CommonIdeaManager;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.CommonIdeaBean;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/common/idea")
|
||||
public class CommonIdeaController {
|
||||
|
||||
@Autowired
|
||||
CommonIdeaManager commonIdeaManager;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value="/{id}", method=RequestMethod.GET, produces="application/json; charset=UTF-8")
|
||||
public CommonIdeaBean getCommonIdea(@PathVariable String id) {
|
||||
CommonIdeaEntity model = commonIdeaManager.getById(id);
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{id}", method=RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public Map<String,Object> addCommonIdea(@PathVariable String id,@RequestBody CommonIdeaEntity commonIdea) {
|
||||
Map<String,Object> result = new HashMap<String,Object>();
|
||||
if(RestUtils.isEmpty(id)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
CommonIdeaEntity entity = commonIdeaManager.getById(id);
|
||||
if(entity != null) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "CommonIdea exist,id=" + id);
|
||||
}
|
||||
commonIdea.setId(id);
|
||||
commonIdea.setCreateTime(new Date());
|
||||
commonIdeaManager.save(commonIdea);
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{id}", method=RequestMethod.PUT, produces="application/json; charset=UTF-8")
|
||||
public Map<String,Object> updateCommonIdea(@PathVariable String id, @RequestBody CommonIdeaEntity commonIdea){
|
||||
Map<String,Object> result = new HashMap<String,Object>();
|
||||
if(RestUtils.isEmpty(id)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
CommonIdeaEntity entity = commonIdeaManager.getById(id);
|
||||
if(entity == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "CommonIdea not exist,id=" + id);
|
||||
}
|
||||
commonIdea.setId(id);
|
||||
commonIdeaManager.update(commonIdea);
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{id}", method=RequestMethod.DELETE, produces="application/json; charset=UTF-8")
|
||||
public Map<String, Object> deleteCommonIdea(@PathVariable String id){
|
||||
Map<String,Object> result = new HashMap<String,Object>();
|
||||
if(RestUtils.isEmpty(id)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
CommonIdeaEntity entity = commonIdeaManager.getById(id);
|
||||
if(entity == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "CommonIdea not exist,id=" + id);
|
||||
}
|
||||
commonIdeaManager.removeById(id);
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{usercode}/list", method=RequestMethod.GET, produces="application/json; charset=UTF-8")
|
||||
public List<CommonIdeaBean> getUserCommonIdeaList(@PathVariable String usercode){
|
||||
if(RestUtils.isEmpty(usercode))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "usercode is null");
|
||||
List<CommonIdeaEntity> result = commonIdeaManager.selectByUserCode(usercode);
|
||||
return beansBuilder.buildCommIdeaList(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.model.SysGlType;
|
||||
import com.blueland.bpm.engine.config.service.SysGlTypeManager;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ProcessDefinitionBean;
|
||||
import com.blueland.ebpm.bean.SysGlTypeBean;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flowtype")
|
||||
public class FlowTypeController {
|
||||
|
||||
@Autowired
|
||||
private SysGlTypeManager sysGlTypeManager;
|
||||
|
||||
@Autowired
|
||||
private ProcessConfigService processConfigService;
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value="/{tenantId}/list", produces = "application/json;charset=UTF-8")
|
||||
public List<SysGlTypeBean> getTypesList(@PathVariable String tenantId){
|
||||
|
||||
SysGlType param = new SysGlType();
|
||||
param.setAppKey(tenantId);
|
||||
List<SysGlType> result = sysGlTypeManager.findByExample(param);
|
||||
return beansBuilder.buildTypeList(result);
|
||||
}
|
||||
|
||||
// private void getTree(String typeId, List<SysGlType> result){
|
||||
// SysGlType sysGlType = sysGlTypeManager.getById(typeId);
|
||||
// if(sysGlType == null)
|
||||
// return;
|
||||
// result.add(sysGlType);
|
||||
//
|
||||
// SysGlType param = new SysGlType();
|
||||
// param.setTypeParentId(sysGlType.getTypeId());
|
||||
// List<SysGlType> list = sysGlTypeManager.findByExample(param);
|
||||
// if(list == null || list.size() == 0)
|
||||
// return;
|
||||
// for(SysGlType type : list)
|
||||
// getTree(type.getTypeId(), result);
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/{typeId}", produces = "application/json;charset=UTF-8")
|
||||
public SysGlTypeBean getType(@PathVariable String typeId) {
|
||||
SysGlType type = sysGlTypeManager.getById(typeId);
|
||||
SysGlTypeBean bean = beansBuilder.build(type);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{typeId}/children", produces = "application/json;charset=UTF-8")
|
||||
public List<SysGlTypeBean> getChildren(@PathVariable String typeId){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId(typeId);
|
||||
List<SysGlType> list = sysGlTypeManager.findByExample(param);
|
||||
return beansBuilder.buildTypeList(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{typeId}/flowlist", produces = "application/json;charset=UTF-8")
|
||||
public List<ProcessDefinitionBean> getFlowList(@PathVariable String typeId){
|
||||
List<ProcessDefinitionBean> result = new ArrayList<ProcessDefinitionBean>();
|
||||
ProcessInfoConfig params = new ProcessInfoConfig();
|
||||
params.setProcessTypeId(typeId);
|
||||
List<ProcessInfoConfig> list = processConfigService.findProcessInfoConfigs(params);
|
||||
for(ProcessInfoConfig config : list) {
|
||||
ProcessDefinitionModel model = processDefinitionService.getProcessDef(config.getProcessDefId());
|
||||
model.setProcessInfoConfig(config);
|
||||
result.add(beansBuilder.build(model));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.ebpm.home.dao.HomePageDao;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({ "" })
|
||||
public class HomePageController {
|
||||
@Autowired
|
||||
HomePageDao homePageDao;
|
||||
|
||||
/**
|
||||
* 为门户首页星标集成使用
|
||||
* @param owner
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/{owner}/task/count", method=RequestMethod.GET, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> getAppTaskCount(@PathVariable String owner,@RequestParam(required=false) String state){
|
||||
if(StringUtils.isEmpty(state)) {
|
||||
state="1";
|
||||
}
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
List tasks=homePageDao.getAppTaskCount(owner,state);
|
||||
result.put("returnMsg", "操作成功");
|
||||
result.put("returnCode", "200");
|
||||
result.put("result", tasks);
|
||||
}catch(Exception e) {
|
||||
result.put("returnMsg", "操作失败:"+e.getMessage());
|
||||
result.put("returnCode", "404");
|
||||
result.put("result", null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class IndexController {
|
||||
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@GetMapping("/")
|
||||
public String index() {
|
||||
return "服务运行正常!";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.SearchProcessListDTO;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ProcessDefinitionBean;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/query")
|
||||
public class ObjectQueryController {
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@RequestMapping(value = "/procdeflist", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public List<ProcessDefinitionBean> queryProcList(@RequestBody SearchProcessListDTO query) {
|
||||
List<ProcessDefinitionModel> result = processDefinitionService.findProcessDefs(query);
|
||||
return beansBuilder.buildProcDefList(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* @ResponseBody
|
||||
*
|
||||
* @RequestMapping(value = "/todolist", method = RequestMethod.POST, produces =
|
||||
* "application/json;charset=UTF-8") public Page<ActivityInstanceBean>
|
||||
* queryToDoList(
|
||||
*
|
||||
* @RequestBody SearchProcessListDTO query) { if(query.getPageNumber() == 0)
|
||||
* query.setPageSize(10); Page<ActivityInstanceModel> page = processListService
|
||||
* .queryTodoList(query); return beansBuilder.buildActInstPage(page); }
|
||||
*
|
||||
* @ResponseBody
|
||||
*
|
||||
* @RequestMapping(value = "/zaibanlist", method = RequestMethod.POST, produces
|
||||
* = "application/json;charset=UTF-8") public Page<ActivityInstanceBean>
|
||||
* queryZaibanList(
|
||||
*
|
||||
* @RequestBody SearchProcessListDTO query) { if(query.getPageNumber() == 0)
|
||||
* query.setPageSize(10); Page<ActivityInstanceModel> page = processListService
|
||||
* .queryZaibanList(query); return beansBuilder.buildActInstPage(page); }
|
||||
*
|
||||
* @ResponseBody//2.6
|
||||
*
|
||||
* @RequestMapping(value="/finishlist", method=RequestMethod.POST,
|
||||
* produces="application/json;charset=UTF-8") public Page<ProcessInstanceBean>
|
||||
* queryFinishList(@RequestBody SearchProcessListDTO query){
|
||||
* if(query.getPageNumber() == 0) query.setPageSize(10);
|
||||
* Page<ProcessInstanceModel> page = processListService.queryFinishList(query);
|
||||
* return beansBuilder.buildInstProcPage(page); }
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.engine.config.model.DataObjectRelation;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectRelationManager;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.ebpm.bean.ActivityDefinitionBean;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ExtAttributBean;
|
||||
import com.blueland.ebpm.bean.ProcessDefinitionBean;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程定义类服务
|
||||
*
|
||||
* @author janus
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/processdefinition")
|
||||
public class ProcessDefineController {
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private ProcessConfigService processConfigService;
|
||||
|
||||
@Autowired
|
||||
private DataObjectRelationManager dataObjectRelationManager;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/id", produces = "application/json;charset=UTF-8")
|
||||
public ProcessDefinitionBean getProcDef(@PathVariable String procDefId) {
|
||||
ProcessDefinitionModel model = processDefinitionService.getProcessDef(procDefId);
|
||||
model.setProcessInfoConfig(processConfigService.getProcessInfoConfig(procDefId));
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{procDefKey}/key", produces="application/json; charset=UTF-8")
|
||||
public ProcessDefinitionBean getProcDefByKey(@PathVariable String procDefKey) {
|
||||
ProcessDefinitionModel model = processDefinitionService.getProcessDefBykey(procDefKey);
|
||||
model.setProcessInfoConfig(processConfigService.getProcessInfoConfig(model.getProcDefId()));
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/startactdef", produces = "application/json;charset=UTF-8")
|
||||
public ActivityDefinitionBean getStartActivity(
|
||||
@PathVariable String procDefId) {
|
||||
ActivityDefinitionModel model = processDefinitionService.getStartActivity(procDefId);
|
||||
model.setActivityInfoConfig(processConfigService.getActivityInfoConfig(procDefId, model.getActDefId()));
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procDefId}/extattrs", produces = "application/json; charset=UTF-8")
|
||||
public List<ExtAttributBean> getProcExtattrs(@PathVariable String procDefId) {
|
||||
List<DataObjectRelation> list = dataObjectRelationManager.findDataObjectRelationsByProcessDefId(procDefId);
|
||||
return beansBuilder.build(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{tentantId}/{userId}/{userOrgId}/newlist", produces="application/json; charset=UTF-8")
|
||||
public List<ProcessDefinitionBean> getNewList(@PathVariable String tentantId, @PathVariable String userId, @PathVariable String userOrgId){
|
||||
User user = userService.getUserById(userId);
|
||||
Map<String, List<ProcessDefinitionModel>> maps = processDefinitionService.findProcessDefStartByUser(tentantId, user.getUserId());
|
||||
return beansBuilder.build(maps);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/{tentantId}/{userId}/{userOrgId}/{flowType}/newlist", produces="application/json; charset=UTF-8")
|
||||
public List<ProcessDefinitionBean> getNewList(@PathVariable String tentantId, @PathVariable String userId, @PathVariable String userOrgId, @PathVariable String flowType){
|
||||
User user = userService.getUserById(userId);
|
||||
Map<String, List<ProcessDefinitionModel>> maps = processDefinitionService.findProcessDefStartByUser(tentantId, user.getUserId(),flowType);
|
||||
return beansBuilder.build(maps);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{procDefId}/imgurl", produces="application/json; charset=UTF-8")
|
||||
public Map<String,String> getProcDefImgUrl(@PathVariable String procDefId) {
|
||||
String url = SysConfig.getValue("MANAGE_URL") + "/procDefMgr/resource.do?resourceType=image&procDefId=" + procDefId;
|
||||
Map<String,String> result = new HashMap<String,String>();
|
||||
result.put("url", url);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,866 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import com.blueland.bpm.common.page.impl.ListPage;
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.engine.core.model.*;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteServiceFacde;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ProcessInstanceBean;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
import com.blueland.ebpm.util.RestUtils;
|
||||
import com.blueland.unitework.model.UniteworkTask;
|
||||
import com.blueland.unitework.service.UniteworkService;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.TaskEntity;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value="/processinstance")
|
||||
public class ProcessInstanceController {
|
||||
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
|
||||
@Autowired
|
||||
private ProcessExecuteServiceFacde processExecuteService;
|
||||
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
|
||||
@Autowired
|
||||
protected IdentityService identityService;
|
||||
|
||||
@Autowired
|
||||
protected TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private UniteworkService uniteworkService;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value = "/{procInstId}/id", produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean getProcInstById(@PathVariable String procInstId) {
|
||||
ProcessInstanceModel model = processInstanceService.getProcessInstanceById(procInstId);
|
||||
if(model == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2051.name(), "process instance not found, id=" + procInstId);
|
||||
}
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{bussisnesKey}/bizkey", produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean getProcInstByBizkey(@PathVariable String bussisnesKey) {
|
||||
ProcessInstanceModel model = processInstanceService.getProcessInstanceByBizKey(bussisnesKey);
|
||||
return beansBuilder.build(model);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{bussisnesKey}/bizkeys", produces="application/json; charset=UTF-8")
|
||||
public List<ProcessInstanceBean> getProcesInstByBizkey(@PathVariable String bussisnesKey) {
|
||||
List<ProcessInstanceModel> list = processInstanceService.getProcessInstancesByBizKey(bussisnesKey);
|
||||
return beansBuilder.buildProcInstList(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{procInstId}/histasklog", produces="application/json; charset=UTF-8")
|
||||
public Map<String,Object> getHisTaskLog(@PathVariable String procInstId){
|
||||
Map<String, Object> tmpResult = processTraceService.getHisTaskLog(procInstId);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("procInst", beansBuilder.build((HistoricProcessInstanceEntity)tmpResult.get("curProcessInstance")));
|
||||
result.put("procLogs", beansBuilder.buildProcessLogList((List<ProcessLogModel>)tmpResult.get("processDetailLogs")));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/{topProcInstId}/histaskcomentlog", produces="application/json; charset=UTF-8")
|
||||
public Map<String,Object> getHisTaskComentLog(@PathVariable String topProcInstId){
|
||||
Map<String, Object> tmpResult = processTraceService.getHisTaskComments(topProcInstId);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("procInst", beansBuilder.build((HistoricProcessInstanceEntity)tmpResult.get("curProcessInstance")));
|
||||
result.put("procLogs", beansBuilder.buildProcessLogList((List<ProcessLogModel>)tmpResult.get("processDetailLogs")));
|
||||
return result;
|
||||
}
|
||||
|
||||
//@RequestMapping(value="/{procInstId}/histasklogurl", produces="text/plain; charset=UTF-8")
|
||||
@RequestMapping(value="/{procInstId}/histasklogurl", produces="application/json; charset=UTF-8")
|
||||
public Map<String,String> getProcLogUrl(@PathVariable String procInstId) {
|
||||
String url = SysConfig.getValue("MANAGE_URL") + "/workflow/trace/traceProcess.do?processInstanceId=" + procInstId;
|
||||
Map<String,String> result = new HashMap<String,String>();
|
||||
result.put("url", url);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{procInstId}/dataobject", produces="application/json; charset=UTF-8")
|
||||
public BusinessDataObject getProcDataObject(@PathVariable String procInstId) {
|
||||
return processInstanceService.getBusinessDataObject(procInstId);
|
||||
}
|
||||
|
||||
// @RequestMapping(value="/runtime/processinstance/getactdataobject", produces="application/json; charset=UTF-8")
|
||||
// public BusinessDataObject getActDataObject(@RequestParam String actInstId) {
|
||||
// return (BusinessDataObject) processInstanceService.getTaskVariables(actInstId).get("wf_businessDataObject");
|
||||
// }
|
||||
|
||||
@RequestMapping(value="/createprocinst", method = RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean createProcinst(@RequestBody ProcessInputModel model){
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserId is null");
|
||||
}
|
||||
/*if(RestUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserOrgId is null");
|
||||
}*/
|
||||
if(RestUtils.isEmpty(model.getWf_procTitle())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procTitle is null");
|
||||
}
|
||||
// if(StringUtils.isEmpty(model.getWf_businessKey())) {
|
||||
// result.put("errorMsg","业务标识字段(wf_businessKey)不能为空");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
String procDefId = model.getWf_procDefId();
|
||||
String procDefKey = model.getWf_procDefKey();
|
||||
if(RestUtils.isEmpty(procDefId) && RestUtils.isEmpty(procDefKey)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procDefId and wf_procDefKey is null");
|
||||
}
|
||||
ProcessDefinitionModel procDefModel = null;
|
||||
if(RestUtils.isEmpty(procDefKey))
|
||||
procDefModel = processDefinitionService.getProcessDef(procDefId);
|
||||
else
|
||||
procDefModel = processDefinitionService.getProcessDefBykey(procDefKey);
|
||||
if(procDefModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2002.name(), "process definition not found, id=" + procDefId + ",key=" + procDefKey);
|
||||
}
|
||||
else {
|
||||
model.setWf_procDefId(procDefModel.getProcDefId());
|
||||
model.setWf_procDefKey(procDefModel.getProcDefKey());
|
||||
model.setWf_procDefName(procDefModel.getProcDefName());
|
||||
model.setWf_appId(procDefModel.getTenantId());
|
||||
}
|
||||
|
||||
if(!RestUtils.isEmpty(model.getWf_curActInstId())) {
|
||||
ActivityInstanceModel curActInstModel = this.processInstanceService.getTask(model.getWf_curActInstId());
|
||||
model.setWf_procInstId(curActInstModel.getProcInstId());
|
||||
}
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_SAVE_ACTIVITY);
|
||||
result = processExecuteService.nextExecute(model);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)result.get("executeErrorCode")).name() , (String)result.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@RequestMapping(value="/lunchprocinst", method = RequestMethod.POST,produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean lunchProceInst(@RequestBody ProcessInputModel model){
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(StringUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new IllegalArgumentException("wf_sendUserId is null");
|
||||
}
|
||||
if(StringUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new IllegalArgumentException("wf_sendUserOrgId is null");
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(model.getWf_procTitle())) {
|
||||
throw new IllegalArgumentException("wf_procTitle is null");
|
||||
}
|
||||
// if(StringUtils.isEmpty(model.getWf_businessKey())) {
|
||||
// result.put("errorMsg","业务标识字段(wf_businessKey)不能为空");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
String procDefId = model.getWf_procDefId();
|
||||
String procDefKey = model.getWf_procDefKey();
|
||||
if(StringUtils.isEmpty(procDefId) && StringUtils.isEmpty(procDefKey)) {
|
||||
throw new IllegalArgumentException("wf_procDefId and wf_procDefKey is null");
|
||||
}
|
||||
ProcessDefinitionModel procDefModel = null;
|
||||
if(StringUtils.isEmpty(procDefKey))
|
||||
procDefModel = processDefinitionService.getProcessDef(procDefId);
|
||||
else
|
||||
procDefModel = processDefinitionService.getProcessDefBykey(procDefKey);
|
||||
if(procDefModel == null) {
|
||||
throw new RestException("process definition not found");
|
||||
}
|
||||
else {
|
||||
model.setWf_procDefId(procDefModel.getProcDefId());
|
||||
model.setWf_procDefKey(procDefModel.getProcDefKey());
|
||||
model.setWf_procDefName(procDefModel.getProcDefName());
|
||||
model.setWf_appId(procDefModel.getTenantId());
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(model.getWf_curActDefId())) {
|
||||
throw new IllegalArgumentException("wf_curActDefId is null");
|
||||
}
|
||||
|
||||
ActivityDefinitionModel curActModel = processDefinitionService.getActivity(procDefModel.getProcDefId(), model.getWf_curActDefId());
|
||||
if(curActModel == null) {
|
||||
throw new RestException("current activity definition not found");
|
||||
}else {
|
||||
model.setWf_curActDefName(curActModel.getActDefName());
|
||||
model.setWf_curActDefType(curActModel.getActType());
|
||||
}
|
||||
|
||||
// if(StringUtils.isEmpty(model.getWf_nextActDefId())) {
|
||||
// throw new IllegalArgumentException("wf_nextActDefid is null");
|
||||
// }
|
||||
|
||||
if(!StringUtils.isEmpty(model.getWf_nextActDefId())) {
|
||||
ActivityDefinitionModel destActModel = processDefinitionService.getActivity(procDefModel.getProcDefId(), model.getWf_nextActDefId());
|
||||
model.setWf_nextActDefName(destActModel.getActDefName());
|
||||
model.setWf_nextActDefType(destActModel.getActType());
|
||||
}
|
||||
|
||||
// if(StringUtils.isEmpty(model.getWf_receiver())) {
|
||||
// result.put("errMsg", "接收人字段(wf_receiver)不能为空");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
result = processExecuteService.nextExecute(model);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException("lunch process instance error");
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
@RequestMapping(value="/nextexecute",method = RequestMethod.POST,produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean nextExcute(@RequestBody ProcessInputModel model){
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
// 越权校验,流程提交人是否为当前待办审核员
|
||||
TaskEntity task = (TaskEntity) taskService.createTaskQuery()
|
||||
.taskId(model.getWf_curActInstId()).taskAssignee(model.getWf_sendUserId())
|
||||
.singleResult();
|
||||
if (task == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "task is not found");
|
||||
}
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserId is null");
|
||||
}
|
||||
/*if(RestUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserOrgId is null");
|
||||
}*/
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_procTitle())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procTitle is null");
|
||||
}
|
||||
|
||||
String procDefId = model.getWf_procDefId();
|
||||
String procDefKey = model.getWf_procDefKey();
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_curActInstId())) { //新建?
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
if(RestUtils.isEmpty(procDefId) && RestUtils.isEmpty(procDefKey)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procDefId and wf_procDefKey is null");
|
||||
}
|
||||
ProcessDefinitionModel procDefModel = null;
|
||||
if(RestUtils.isEmpty(procDefId))
|
||||
procDefModel = processDefinitionService.getProcessDefBykey(procDefKey);
|
||||
else
|
||||
procDefModel = processDefinitionService.getProcessDef(procDefId);
|
||||
if(procDefModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "process definition not found, id=" + procDefId + ", key=" + procDefKey);
|
||||
}
|
||||
else {
|
||||
model.setWf_procDefId(procDefModel.getProcDefId());
|
||||
model.setWf_procDefKey(procDefModel.getProcDefKey());
|
||||
if(StringUtils.isEmpty(model.getWf_curActDefId())) {
|
||||
model.setWf_curActDefId(processDefinitionService.getStartActivity(procDefModel.getProcDefId()).getActDefId());
|
||||
}
|
||||
model.setWf_procDefKey(procDefModel.getProcDefKey());
|
||||
model.setWf_procDefName(procDefModel.getProcDefName());
|
||||
model.setWf_appId(procDefModel.getTenantId());
|
||||
}
|
||||
}else {
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY);
|
||||
ActivityInstanceModel curActInst = processInstanceService.getTask(model.getWf_curActInstId());
|
||||
if(curActInst == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name() ,"current activity instance not found, id=" + model.getWf_curActInstId());
|
||||
|
||||
UniteworkTask uniteworkTask = uniteworkService.getByActInstId(model.getWf_curActInstId());
|
||||
if(uniteworkTask == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "unitework task not found, curActIndtId=" + model.getWf_curActInstId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(model.getWf_batchId())) {
|
||||
if(model.getWf_batchId().equals("no")) {//不使用批次逻辑
|
||||
model.setWf_batchId(null);
|
||||
}else{//批次逻辑不同流程不同环节可以更改
|
||||
|
||||
}
|
||||
}else {//批次逻辑一个流程实例沿用一套,沿用流程批次逻辑
|
||||
model.setWf_batchId(uniteworkTask.getBatchId());
|
||||
}
|
||||
procDefId = curActInst.getProcDefId();
|
||||
model.setWf_procInstId(curActInst.getProcInstId());
|
||||
model.setWf_procDefId(curActInst.getProcDefId());
|
||||
model.setWf_procDefKey(uniteworkTask.getProcDefKey());
|
||||
model.setWf_procDefName(curActInst.getProcDefName());
|
||||
model.setWf_appId(curActInst.getTenantId());
|
||||
model.setWf_curActDefId(curActInst.getActDefId());
|
||||
}
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_curActDefId()))
|
||||
throw new IllegalArgumentException("curActDefId is null");
|
||||
ActivityDefinitionModel curActModel = processDefinitionService.getActivity(model.getWf_procDefId(), model.getWf_curActDefId());
|
||||
if(curActModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2003.name(), "current activity definition not found, procid=" + procDefId + ",actid=" + model.getWf_curActDefId());
|
||||
}else {
|
||||
model.setWf_curActDefName(curActModel.getActDefName());
|
||||
model.setWf_curActDefType(curActModel.getActType());
|
||||
}
|
||||
|
||||
// if(StringUtils.isEmpty(model.getWf_nextActDefId())) {
|
||||
// result.put("errorMsg", "下一活动Id字段(wf_nextActDefId)不能为空");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
if(!RestUtils.isEmpty(model.getWf_nextActDefId())) {
|
||||
ActivityDefinitionModel destActModel = processDefinitionService.getActivity(model.getWf_procDefId(), model.getWf_nextActDefId());
|
||||
model.setWf_nextActDefName(destActModel.getActDefName());
|
||||
model.setWf_nextActDefType(destActModel.getActType());
|
||||
}
|
||||
// if(destActModel == null) {
|
||||
// result.put("errMsg", "没有找到目标活动");
|
||||
// return result;
|
||||
// }else {
|
||||
// model.setWf_nextActDefName(destActModel.getActDefName());
|
||||
// model.setWf_nextActDefType(destActModel.getActType());
|
||||
// }
|
||||
|
||||
// if(StringUtils.isEmpty(model.getWf_receiver())) {
|
||||
// result.put("errMsg", "接收人字段(wf_receiver)不能为空");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
result = processExecuteService.nextExecute(model);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)result.get("executeErrorCode")).name() , (String)result.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Random ran1 = new Random(10);
|
||||
System.out.println(ran1.nextInt()+"");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/nextExcuteBatch", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
public Map<String, Object> nextExcuteBatch(@RequestBody final List<ProcessInputModel> models) {
|
||||
System.out.println("数据大小:" + models.size());
|
||||
long start = System.currentTimeMillis();
|
||||
ListPage page = new ListPage(models, 1, 10);
|
||||
int totalPage = page.getLastPageNumber();
|
||||
|
||||
Map<String, Object> results = new HashMap<String, Object>();
|
||||
ExecutorService execservice = Executors.newFixedThreadPool(totalPage);
|
||||
for (int i = 1; i <= totalPage; i++) {
|
||||
final List result = page.getResult();
|
||||
execservice.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int j = 0;
|
||||
for (ProcessInputModel processInputModel : models) {
|
||||
try {
|
||||
System.out.println("执行j:" + j);
|
||||
nextExcute(processInputModel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
});
|
||||
page = new ListPage(models, i + 1, 10);
|
||||
System.out.println("执行i:" + i);
|
||||
}
|
||||
|
||||
execservice.shutdown();
|
||||
while (true) {
|
||||
if (execservice.isTerminated()) {
|
||||
System.out.println("所有的子线程都结束了!");
|
||||
break;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* List<ProcessInstanceBean> successResult=new ArrayList<ProcessInstanceBean>();
|
||||
* List<ProcessInputModel> errors=new ArrayList<ProcessInputModel>(); int i=1;
|
||||
* for (ProcessInputModel processInputModel : models) { try {
|
||||
* ProcessInstanceBean result=this.nextExcute(processInputModel);
|
||||
* successResult.add(result); }catch(Exception e) {
|
||||
* errors.add(processInputModel); } System.out.println("处理完:"+i); i++; }
|
||||
*/
|
||||
results.put("sucess", "");
|
||||
results.put("errors", "");
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("数据大小:" + models.size() + ",耗时:" + (end - start));
|
||||
return results;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value="/cancelprocinst", method = RequestMethod.POST,produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean cancelProcInst(@RequestBody ProcessInputModel model) {
|
||||
String procInstId = model.getWf_procInstId();
|
||||
if(RestUtils.isEmpty(procInstId)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "procInstId is null");
|
||||
}
|
||||
|
||||
ProcessInstance processInstance=processInstanceService.getRuntimeService().createProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
||||
if(processInstance == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2051.name(), "process instance not found, id=" + procInstId);
|
||||
}
|
||||
List<Task> tasks=processInstanceService.getTaskService().createTaskQuery().processInstanceId(processInstance.getId()).active().orderByTaskCreateTime().desc().list();
|
||||
if(tasks == null || tasks.isEmpty()) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "no task found");
|
||||
}
|
||||
Task task = tasks.get(0);
|
||||
ProcessInputModel processInputModel =(ProcessInputModel) processInstanceService.getTaskVariables(task.getId()).get(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
processInputModel.setWf_procTitle(task.getProcTitle());
|
||||
processInputModel.setWf_actionType(WorkFlowContants.ACTION_TYPE_CANCEL_PROCESS);
|
||||
processInputModel.setWf_curActInstId(task.getId());
|
||||
processInputModel.setWf_procDefId(task.getProcessDefinitionId());
|
||||
processInputModel.setWf_procInstId(task.getProcessInstanceId());
|
||||
processInputModel.setWf_appId(task.getTenantId()); //?
|
||||
processInputModel.setWf_curComment(model.getWf_curComment());
|
||||
Map<String, Object> resultMap = processExecuteService.nextExecute( processInputModel);
|
||||
if(resultMap.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)resultMap.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)resultMap.get("executeErrorCode")).name() , (String)resultMap.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/backtostart", method = RequestMethod.POST,produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean backToStart(@RequestBody ProcessInputModel model){
|
||||
ActivityInstanceModel activityInstanceModel = processInstanceService.getTask(model.getWf_curActInstId());
|
||||
if (activityInstanceModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + model.getWf_curActInstId());
|
||||
}
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserId is null");
|
||||
}
|
||||
/*if(RestUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserOrgId is null");
|
||||
}*/
|
||||
//ProcessInputModel processInputModel =(ProcessInputModel) processInstanceService.getTaskVariables(activityInstanceModel.getActInstId()).get(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
|
||||
UniteworkTask uniteworkTask = uniteworkService.getByActInstId(model.getWf_curActInstId());
|
||||
if(uniteworkTask == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "unitework task not found, curActIndtId=" + model.getWf_curActInstId());
|
||||
if(StringUtils.isNotEmpty(model.getWf_batchId())) {
|
||||
if(model.getWf_batchId().equals("no")) {//不使用批次逻辑
|
||||
model.setWf_batchId(null);
|
||||
}else{//批次逻辑不同流程不同环节可以更改
|
||||
|
||||
}
|
||||
}else {//批次逻辑一个流程实例沿用一套,沿用流程批次逻辑
|
||||
model.setWf_batchId(uniteworkTask.getBatchId());
|
||||
}
|
||||
// processInputModel.setWf_sendUserId(model.getWf_sendUserId());
|
||||
// processInputModel.setWf_sendUserOrgId(model.getWf_sendUserOrgId());
|
||||
// processInputModel.setWf_businessDataObject(model.getWf_businessDataObject());
|
||||
// processInputModel.setWf_curComment(model.getWf_curComment());
|
||||
// processInputModel.setWf_uniteworkUrl(model.getWf_uniteworkUrl());
|
||||
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_CALLBACK_START_ACTIVITY);
|
||||
model.setWf_curActDefId(activityInstanceModel.getActivityDefinition().getActDefId());
|
||||
model.setWf_curActDefName(activityInstanceModel.getActivityDefinition().getActDefName());
|
||||
model.setWf_curActDefType(activityInstanceModel.getActivityDefinition().getActType());
|
||||
model.setWf_procDefId(activityInstanceModel.getProcDefId());
|
||||
model.setWf_procDefKey(uniteworkTask.getProcDefKey());
|
||||
model.setWf_procDefName(uniteworkTask.getProcDefName());
|
||||
model.setWf_appId(activityInstanceModel.getTenantId());
|
||||
model.setWf_procInstId(activityInstanceModel.getProcInstId());
|
||||
|
||||
Map<String, Object> resultMap = processExecuteService.nextExecute(model);
|
||||
if(resultMap.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)resultMap.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)resultMap.get("executeErrorCode")).name() , (String)resultMap.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/backtoprev", method = RequestMethod.POST,produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean backToPrev(@RequestBody ProcessInputModel model){
|
||||
if(RestUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserId is null");
|
||||
}
|
||||
/*if(RestUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserOrgId is null");
|
||||
}*/
|
||||
String curActInstId = model.getWf_curActInstId();
|
||||
if(RestUtils.isEmpty(curActInstId)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_curActInstId is null");
|
||||
}
|
||||
ActivityInstanceModel activityInstanceModel=processInstanceService.getTask(curActInstId);
|
||||
if(activityInstanceModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + curActInstId);
|
||||
}
|
||||
//HistoricVariableInstance hisVarInst=processInstanceService.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(activityInstanceModel.getProcInstId()).variableName(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY).orderByLastUpdateTime().desc().singleResult();
|
||||
//ProcessInputModel processInputModel=(ProcessInputModel)hisVarInst.getValue();
|
||||
//ProcessInputModel processInputModel =(ProcessInputModel) processInstanceService.getTaskVariables(activityInstanceModel.getActInstId()).get(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
UniteworkTask uniteworkTask = uniteworkService.getByActInstId(curActInstId);
|
||||
if(uniteworkTask == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "unitework task not found, curActIndtId=" + curActInstId);
|
||||
if(StringUtils.isNotEmpty(model.getWf_batchId())) {
|
||||
if(model.getWf_batchId().equals("no")) {//不使用批次逻辑
|
||||
model.setWf_batchId(null);
|
||||
}else{//批次逻辑不同流程不同环节可以更改
|
||||
|
||||
}
|
||||
}else {//批次逻辑一个流程实例沿用一套,沿用流程批次逻辑
|
||||
model.setWf_batchId(uniteworkTask.getBatchId());
|
||||
}
|
||||
// processInputModel.setWf_sendUserId(model.getWf_sendUserId());
|
||||
// processInputModel.setWf_sendUserOrgId(model.getWf_sendUserOrgId());
|
||||
// processInputModel.setWf_businessDataObject(model.getWf_businessDataObject());
|
||||
// processInputModel.setWf_curComment(model.getWf_curComment());
|
||||
// processInputModel.setWf_uniteworkUrl(model.getWf_uniteworkUrl());
|
||||
// processInputModel.setWf_procTitle(model.getWf_procTitle());
|
||||
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_CALLBACK_PREV_ACTIVITY);
|
||||
|
||||
|
||||
model.setWf_curActDefId(activityInstanceModel.getActivityDefinition().getActDefId());
|
||||
model.setWf_curActDefName(activityInstanceModel.getActivityDefinition().getActDefName());
|
||||
model.setWf_curActDefType(activityInstanceModel.getActivityDefinition().getActType());
|
||||
model.setWf_procDefId(activityInstanceModel.getProcDefId());
|
||||
model.setWf_procDefKey(uniteworkTask.getProcDefKey());
|
||||
model.setWf_procDefName(uniteworkTask.getProcDefName());
|
||||
model.setWf_appId(activityInstanceModel.getTenantId());
|
||||
model.setWf_procInstId(activityInstanceModel.getProcInstId());
|
||||
|
||||
Map<String, Object> resultMap = processExecuteService.nextExecute(model);
|
||||
if(resultMap.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)resultMap.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)resultMap.get("executeErrorCode")).name() , (String)resultMap.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/callback", method= RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean callBack(@RequestBody ProcessInputModel model) {
|
||||
String curActInstId = model.getWf_curActInstId();
|
||||
if(RestUtils.isEmpty(curActInstId)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_curActInstId is null");
|
||||
}
|
||||
ActivityInstanceModel curActInst=processInstanceService.getHistoryTask(curActInstId);
|
||||
if(curActInst == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + curActInstId);
|
||||
}
|
||||
UniteworkTask params=new UniteworkTask();
|
||||
params.setCurActInstId(model.getWf_curActInstId());
|
||||
UniteworkTask uniteworkTask = uniteworkService.findByParams(params).get(0);
|
||||
if(uniteworkTask == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "unitework task not found, curActIndtId=" + model.getWf_curActInstId());
|
||||
if(StringUtils.isNotEmpty(model.getWf_batchId())) {
|
||||
if(model.getWf_batchId().equals("no")) {//不使用批次逻辑
|
||||
model.setWf_batchId(null);
|
||||
}else{//批次逻辑不同流程不同环节可以更改
|
||||
|
||||
}
|
||||
}else {//批次逻辑一个流程实例沿用一套,沿用流程批次逻辑
|
||||
model.setWf_batchId(uniteworkTask.getBatchId());
|
||||
}
|
||||
String procDefId = curActInst.getProcDefId();
|
||||
model.setWf_procInstId(curActInst.getProcInstId());
|
||||
model.setWf_procDefId(curActInst.getProcDefId());
|
||||
model.setWf_procDefName(curActInst.getProcDefName());
|
||||
model.setWf_appId(curActInst.getTenantId());
|
||||
|
||||
ActivityDefinitionModel curActModel = processDefinitionService.getActivity(procDefId, curActInst.getActDefId());
|
||||
if(curActModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2003.name(), "current activity definition not found, procid=" + procDefId + ", actid=" + curActInst.getActDefId());
|
||||
}else {
|
||||
model.setWf_curActDefName(curActModel.getActDefName());
|
||||
model.setWf_curActDefType(curActModel.getActType());
|
||||
}
|
||||
|
||||
ProcessDefinitionModel procDefModel = processDefinitionService.getProcessDef(procDefId);
|
||||
if(procDefModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2002.name(), "process definition not found, id=" + procDefId);
|
||||
}
|
||||
else {
|
||||
model.setWf_procDefId(procDefModel.getProcDefId());
|
||||
model.setWf_procDefKey(procDefModel.getProcDefKey());
|
||||
model.setWf_procDefName(procDefModel.getProcDefName());
|
||||
}
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_CALLBACK_ACTIVITY);
|
||||
model.setWf_procTitle(curActInst.getProcTitle());
|
||||
Map<String, Object> resultMap = processExecuteService.nextExecute(model);
|
||||
if(resultMap.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)resultMap.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)resultMap.get("executeErrorCode")).name() , (String)resultMap.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/reject", method= RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean reject(@RequestBody ProcessInputModel model){
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_sendUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserId is null");
|
||||
}
|
||||
/*if(RestUtils.isEmpty(model.getWf_sendUserOrgId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_sendUserOrgId is null");
|
||||
}
|
||||
*/
|
||||
if(RestUtils.isEmpty(model.getWf_procTitle())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procTitle is null");
|
||||
}
|
||||
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_REJECT_ACTIVITY);
|
||||
ActivityInstanceModel curActInst = processInstanceService.getTask(model.getWf_curActInstId());
|
||||
if(curActInst == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name() ,"current activity instance not found, id=" + model.getWf_curActInstId());
|
||||
|
||||
UniteworkTask uniteworkTask = uniteworkService.getByActInstId(model.getWf_curActInstId());
|
||||
if(uniteworkTask == null)
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "unitework task not found, curActIndtId=" + model.getWf_curActInstId());
|
||||
else
|
||||
model.setWf_batchId(uniteworkTask.getBatchId());
|
||||
model.setWf_procInstId(curActInst.getProcInstId());
|
||||
model.setWf_procDefId(curActInst.getProcDefId());
|
||||
model.setWf_procDefKey(uniteworkTask.getProcDefKey());
|
||||
model.setWf_procDefName(curActInst.getProcDefName());
|
||||
model.setWf_appId(curActInst.getTenantId());
|
||||
model.setWf_curActDefId(curActInst.getActDefId());
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_curActDefId()))
|
||||
throw new IllegalArgumentException("curActDefId is null");
|
||||
ActivityDefinitionModel curActModel = processDefinitionService.getActivity(model.getWf_procDefId(), model.getWf_curActDefId());
|
||||
if(curActModel == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2003.name(), "current activity definition not found, procid=" + model.getWf_procDefId() + ",actid=" + model.getWf_curActDefId());
|
||||
}else {
|
||||
model.setWf_curActDefName(curActModel.getActDefName());
|
||||
model.setWf_curActDefType(curActModel.getActType());
|
||||
}
|
||||
|
||||
if(!RestUtils.isEmpty(model.getWf_nextActDefId())) {
|
||||
ActivityDefinitionModel destActModel = processDefinitionService.getActivity(model.getWf_procDefId(), model.getWf_nextActDefId());
|
||||
model.setWf_nextActDefName(destActModel.getActDefName());
|
||||
model.setWf_nextActDefType(destActModel.getActType());
|
||||
}
|
||||
|
||||
result = processExecuteService.nextExecute(model);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)result.get("executeErrorCode")).name() , (String)result.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/singal", method= RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean singal(@RequestBody ProcessInputModel model){
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_procTitle())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_procTitle is null");
|
||||
}
|
||||
model.setWf_actionType(WorkFlowContants.ACTION_TYPE_SIGNAL_RECEIVE_ACTIVITY);
|
||||
result = processExecuteService.nextExecute(model);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)result.get("executeErrorCode")).name() , (String)result.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/transfer", method= RequestMethod.POST, produces="application/json; charset=UTF-8")
|
||||
public ProcessInstanceBean transfer(@RequestBody ProcessInputModel model) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
if(RestUtils.isEmpty(model.getWf_curActInstId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "wf_curActInstId is null");
|
||||
}
|
||||
|
||||
ActivityInstanceModel actInst=processInstanceService.getTask(model.getWf_curActInstId());
|
||||
if(actInst==null){
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "current activity instance not found, id=" + model.getWf_curActInstId());
|
||||
}
|
||||
//List<ActivityReceiverModel> activityReceiverModels=new ArrayList<ActivityReceiverModel>();
|
||||
//activityReceiverModels.add(new ActivityReceiverModel(actInst.getReceiverUserId(),actInst.getReceiverUserName(),actInst.getReceiverOrgId(),actInst.getReceiverOrgName()));
|
||||
ProcessInputModel processInputModel =(ProcessInputModel) processInstanceService.getTaskVariables(actInst.getActInstId()).get(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
//processInputModel.setWf_receiver(receivers);
|
||||
processInputModel.setWf_receivers(model.getWf_receivers());
|
||||
processInputModel.setWf_sender(actInst.getReceiver());
|
||||
processInputModel.setWf_sendUserId(actInst.getReceiverUserId());
|
||||
processInputModel.setWf_sendUserOrgId(actInst.getReceiverOrgId());
|
||||
processInputModel.setWf_actionType(WorkFlowContants.ACTION_TYPE_RECEIVER_TRANSFER);
|
||||
processInputModel.setWf_curActInstId(actInst.getActInstId());
|
||||
processInputModel.setWf_curActDefId(actInst.getActivityDefinition().getActDefId());
|
||||
processInputModel.setWf_curActDefName(actInst.getActivityDefinition().getActDefName());
|
||||
processInputModel.setWf_procDefId(actInst.getProcDefId());
|
||||
processInputModel.setWf_procTitle(actInst.getProcTitle());
|
||||
processInputModel.setWf_procInstId(actInst.getProcInstId());
|
||||
processInputModel.setWf_curComment(model.getWf_curComment());
|
||||
result = processExecuteService.nextExecute(processInputModel);
|
||||
if(result.get("processInstanceModel") != null) {
|
||||
ProcessInstanceModel instance = (ProcessInstanceModel)result.get("processInstanceModel");
|
||||
return beansBuilder.build(instance);
|
||||
}else {
|
||||
throw new RestException(((ExceptionErrorCode)result.get("executeErrorCode")).name() , (String)result.get("executeErrorMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/{actInstId}/claim/{sender}", method= RequestMethod.GET, produces="application/json; charset=UTF-8")
|
||||
public boolean claim(@PathVariable String actInstId, @PathVariable String sender) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
if(RestUtils.isEmpty(actInstId)||RestUtils.isEmpty(sender)) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "actInst or sender is null");
|
||||
}
|
||||
ActivityInstanceModel actInst=processInstanceService.getTask(actInstId);
|
||||
if(actInst==null){
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "current activity instance not found, id=" + actInstId);
|
||||
}
|
||||
if(!actInst.getReceiver().equals(sender)) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "current sender not power, id=" + actInstId);
|
||||
}
|
||||
processInstanceService.getTaskService().updateOwner(actInstId, sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/{procInstId}/claimActivities/{actDefId}/{owner}", produces = "application/json; charset=UTF-8")
|
||||
public Map<String, Object> findclaimActivities(@PathVariable String procInstId, @PathVariable String actDefId,
|
||||
@PathVariable String owner) {
|
||||
boolean claimFlag = false;
|
||||
HistoricTaskInstance claimTask = null;
|
||||
List<HistoricTaskInstance> historicTaskInstances = processInstanceService.getHistoryService()
|
||||
.createHistoricTaskInstanceQuery().processInstanceId(procInstId).taskDefinitionKey(actDefId).unfinished().list();
|
||||
for (HistoricTaskInstance historicTaskInstance : historicTaskInstances) {
|
||||
if (StringUtils.isNoneEmpty(historicTaskInstance.getOwner())) {
|
||||
if(historicTaskInstance.getOwner().equals(owner)) {
|
||||
claimFlag = true;
|
||||
}
|
||||
claimTask = historicTaskInstance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = Maps.newHashMap();
|
||||
result.put("claimFlag", claimFlag);
|
||||
result.put("claimTask", claimTask);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/isTodoUser/{curActInstId}/{userId}", method= RequestMethod.GET)
|
||||
public boolean transfer(@PathVariable String curActInstId, @PathVariable String userId) {
|
||||
if(StringUtils.isEmpty(curActInstId) || StringUtils.isEmpty(userId)){
|
||||
return false;
|
||||
}
|
||||
// 越权校验,流程提交人是否为当前待办审核员
|
||||
TaskEntity task = (TaskEntity) taskService.createTaskQuery()
|
||||
.taskId(curActInstId).taskAssignee(userId)
|
||||
.singleResult();
|
||||
if (null != task) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@RequestMapping(value = "/myStartRecordlist", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Page<UniteworkTask> myStartRecordlist(@RequestBody UniteworkTask task) {
|
||||
if (task.getPageSize() == 0)
|
||||
task.setPageNumber(10);
|
||||
if (RestUtils.isEmpty(task.getStartUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "startUserId is empty");
|
||||
|
||||
return processInstanceService.queryTask(task);
|
||||
}*/
|
||||
|
||||
/*
|
||||
@RequestMapping(value = "/myStartRecordcount", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> myStartRecordcount(@RequestBody UniteworkTask task) {
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");
|
||||
int count = uniteworkService.getTaskCount(task);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("count", count);
|
||||
return result;
|
||||
}*/
|
||||
|
||||
//
|
||||
// @RequestMapping(value="/runtime/processinstance/getoppower", produces="application/json; charset=UTF-8")
|
||||
// public List<ActivityOpBean> getOpPower(String actInstId, String scope) {
|
||||
// List<ActivityOpBean> result = new ArrayList<ActivityOpBean>();
|
||||
// Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
// ActivityInstanceModel actInst = processInstanceService.getTask(actInstId);
|
||||
// ActivityInfoConfig actInfo = processConfigServce.getActivityInfoConfig(actInst.getProcDefId(), actInst.getActDefId(), scope, pageDetailVaribale);
|
||||
// return beansBuilder.buildActOpList(actInfo.getActivityOperatePowers());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @RequestMapping(value="/runtime/processinstance/execute", method=RequestMethod.POST, produces="application/json;charset=UTF-8")
|
||||
// public Map<String,Object> excute(@RequestBody ProcessInputModel inputModel){
|
||||
// return processExecuteService.nextExecute(inputModel);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value="/runtime/processinstance/getallcomment", produces="application/json; charset=UTF-8")
|
||||
// public List<ProcessLogModel> getAllComment(@RequestParam String procInstId){
|
||||
// return processInstanceService.getProcessComments(procInstId);
|
||||
// }
|
||||
//
|
||||
// @RequestMapping(value="/runtime/processinstance/test", produces="application/json; charset=UTF-8")
|
||||
// public ProcessInputModel test(){
|
||||
// ProcessInputModel model = new ProcessInputModel();
|
||||
// BusinessDataObject obj = new BusinessDataObject();
|
||||
// obj.setBizData("<xml><xml>");
|
||||
// obj.setObjectType("DEMO");
|
||||
// model.setWf_businessDataObject(obj);
|
||||
// return model;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.identity.RoleService;
|
||||
import com.blueland.bpm.identity.model.Userrole;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({ "/role" })
|
||||
public class RoleController {
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
/**
|
||||
* 批量添加用户
|
||||
* @param userroles
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/addUsers" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }, produces = { "application/json;charset=UTF-8" })
|
||||
public Map<String, Object> addUsers(@RequestBody List<Userrole> userroles) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
List<Userrole> userroleMeassages = new ArrayList();
|
||||
List<String> addSuccessUsers = new ArrayList();
|
||||
String addSuccessUser = "";
|
||||
List<String> addErrorMessages = new ArrayList();
|
||||
List<String> addErrorUsers = new ArrayList();
|
||||
String addErrorUser = "";
|
||||
String addEerrorMessage = "";
|
||||
for (Userrole userrole : userroles) {
|
||||
Userrole userroleMeassage = userRoleMessage(userrole);
|
||||
if(userroleMeassage == userrole){
|
||||
Boolean addFlag = false;
|
||||
try{
|
||||
addFlag = roleService.addUsers2Role(userrole);
|
||||
}catch(Exception e){
|
||||
addErrorUser = userrole.getUserId();
|
||||
addErrorUsers.add(addErrorUser);
|
||||
addEerrorMessage = e.getMessage();
|
||||
addErrorMessages.add("add user "+userrole.getUserId()+" to "+ userrole.getRoleId() + " error"+addEerrorMessage);
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(true == addFlag){
|
||||
addSuccessUser = userrole.getUserId();
|
||||
addSuccessUsers.add(addSuccessUser);
|
||||
}else{
|
||||
addErrorUser = userrole.getUserId();
|
||||
addErrorUsers.add(addErrorUser);
|
||||
}
|
||||
}else{
|
||||
userroleMeassages.add(userroleMeassage);
|
||||
// addEerrorMessage = userrole.getUserId();
|
||||
// addErrorMessages.add(addSuccessMessage);
|
||||
addErrorUser = userrole.getUserId();
|
||||
addErrorUsers.add(addErrorUser);
|
||||
}
|
||||
}
|
||||
map.put("addSuccessUsers", addSuccessUsers);
|
||||
map.put("addErrorMeassage", addErrorMessages);
|
||||
map.put("addErrorReason", userroleMeassages);
|
||||
map.put("addErrorUsers", addErrorUsers);
|
||||
//Gson gson = new Gson();
|
||||
//String postData = gson.toJson(map);
|
||||
if(addErrorMessages.size() == 0 && userroleMeassages.size() == 0){
|
||||
//Map<String, Object> statusMap = new HashMap<String, Object>();
|
||||
map.clear();
|
||||
map.put("status", "success");
|
||||
//postData = gson.toJson(statusMap);
|
||||
}else{
|
||||
map.put("status", "failure");
|
||||
//postData = gson.toJson(map);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
* @param userroles
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = { "/delUsers" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }, produces = { "application/json;charset=UTF-8" })
|
||||
public Map<String, Object> delUsers(@RequestBody List<Userrole> userroles) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
List<Userrole> userroleMeassages = new ArrayList();
|
||||
List<String> delSuccessUsers = new ArrayList();
|
||||
String delSuccessUser = "";
|
||||
List<String> delEerrorMessages = new ArrayList();
|
||||
String delEerrorMessage = "";
|
||||
List<String> delEerrorUsers = new ArrayList();
|
||||
String delEerrorUser = "";
|
||||
for (Userrole userrole : userroles) {
|
||||
Userrole userroleMeassage = userRoleMessage(userrole);
|
||||
if(userroleMeassage == userrole){
|
||||
int addFlag = 0;
|
||||
try{
|
||||
addFlag = roleService.delUsers2Role(userrole);
|
||||
}catch(Exception e){
|
||||
delEerrorUser = userrole.getUserId();
|
||||
delEerrorUsers.add(delEerrorUser);
|
||||
delEerrorMessage = e.getMessage();
|
||||
delEerrorMessages.add("delete user "+userrole.getUserId()+" to "+ userrole.getRoleId() + " error"+delEerrorMessage);
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(1 == addFlag){
|
||||
delSuccessUser = userrole.getUserId();
|
||||
delSuccessUsers.add(delSuccessUser);
|
||||
}else{
|
||||
delEerrorUser = userrole.getUserId();
|
||||
delEerrorUsers.add(delEerrorUser);
|
||||
}
|
||||
}else{
|
||||
userroleMeassages.add(userroleMeassage);
|
||||
delSuccessUser = userrole.getUserId();
|
||||
delSuccessUsers.add(delSuccessUser);
|
||||
}
|
||||
}
|
||||
map.put("delSuccessUsers", delSuccessUsers);
|
||||
map.put("delErrorMeassage", delEerrorMessages);
|
||||
map.put("delErrorReason", userroleMeassages);
|
||||
map.put("delEerrorUsers", delEerrorUsers);
|
||||
//Gson gson = new Gson();
|
||||
//String postData = gson.toJson(map);
|
||||
if(delEerrorMessages.size() == 0 && userroleMeassages.size() == 0){
|
||||
map.clear();
|
||||
map.put("status", "success");
|
||||
}else{
|
||||
map.put("status", "failure");
|
||||
//postData = gson.toJson(map);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Userrole userRoleMessage(Userrole userrole){
|
||||
//Userrole userroleMeassage = new Userrole();
|
||||
if(null != userrole){
|
||||
if(!StringUtils.isNotEmpty(userrole.getUserCode())){
|
||||
userrole.setUserCode("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getUserId())){
|
||||
userrole.setUserId("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getUserName())){
|
||||
userrole.setUserName("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getOrgId())){
|
||||
userrole.setOrgId("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getOrgName())){
|
||||
userrole.setOrgName("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getRoleId())){
|
||||
userrole.setRoleId("isNull");
|
||||
}
|
||||
if(!StringUtils.isNotEmpty(userrole.getRoleAppId())){
|
||||
userrole.setRoleAppId("isNull");
|
||||
}
|
||||
}
|
||||
return userrole;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.BusinessDataObject;
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessLogModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessOperateFacade;
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import com.blueland.ebpm.bean.ActivityDefinitionBean;
|
||||
import com.blueland.ebpm.bean.ActivityInstanceBean;
|
||||
import com.blueland.ebpm.bean.ActivityOpBean;
|
||||
import com.blueland.ebpm.bean.BeansBuilder;
|
||||
import com.blueland.ebpm.bean.ProcessDefinitionBean;
|
||||
import com.blueland.ebpm.bean.ProcessInstanceBean;
|
||||
import com.blueland.ebpm.bean.ProcessLogBean;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
|
||||
@RestController
|
||||
public class SpecialController {
|
||||
|
||||
@Autowired
|
||||
private ProcessOperateFacade processOperateFacase;
|
||||
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
|
||||
@Autowired
|
||||
private BeansBuilder beansBuilder;
|
||||
|
||||
@RequestMapping(value = "/special/newflowinfo", produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> getNewFlowInfo(@RequestParam String procDefId,
|
||||
@RequestParam String userId, @RequestParam String userOrgId) {
|
||||
Map<String, Object> tmpResult = processOperateFacase.getProcessStartDetail(procDefId, userId, userOrgId);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
ProcessDefinitionBean procDef = beansBuilder.build((ProcessDefinitionModel)tmpResult.get("processDefinition"));
|
||||
ActivityDefinitionBean curActDef = beansBuilder.build((ActivityDefinitionModel)tmpResult.get("curActivity"));
|
||||
result.put("procDef", procDef);
|
||||
result.put("curActDef", curActDef);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/special/todoflowinfo", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
|
||||
public Map<String, Object> getTodoFlowInfo(@RequestParam String curActInstId, @RequestParam String userId, @RequestParam String userOrgId) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
ActivityInstanceModel actInst = processInstanceService.getTask(curActInstId);
|
||||
if(actInst == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + curActInstId);
|
||||
}
|
||||
|
||||
Map<String, Object> tmpResult = processOperateFacase.getProcessToDoDetail(actInst.getProcDefId(), actInst.getProcInstId(),
|
||||
curActInstId, actInst.getActDefId(), userId, userOrgId);
|
||||
Map<String, Object> tmpLogs = processTraceService.getHisTaskLog(actInst.getProcInstId());
|
||||
ActivityDefinitionModel actDef = (ActivityDefinitionModel)tmpResult.get("curActivity");
|
||||
ActivityInfoConfig config = actDef.getActivityInfoConfig();
|
||||
|
||||
ProcessDefinitionBean procDef = beansBuilder.build((ProcessDefinitionModel)tmpResult.get("processDefinition"));
|
||||
ProcessInstanceBean procInst = beansBuilder.build((HistoricProcessInstanceEntity)tmpResult.get("processInstance"));
|
||||
ActivityDefinitionBean curActDef = beansBuilder.build(actDef);
|
||||
List<ActivityOpBean> actOppowers = beansBuilder.buildActOpList(config.getActivityOperatePowers());
|
||||
ActivityInstanceBean curActInst = beansBuilder.build((ActivityInstanceModel)tmpResult.get("task"));
|
||||
BusinessDataObject dataObject = (BusinessDataObject) processInstanceService.getBusinessDataObject(procInst.getProcInstId());
|
||||
List<ProcessLogBean> procLogs = beansBuilder.buildProcessLogList((List<ProcessLogModel>)tmpLogs.get("processDetailLogs"));
|
||||
|
||||
|
||||
result.put("procDef", procDef);
|
||||
result.put("procInst", procInst);
|
||||
result.put("curActDef", curActDef);
|
||||
result.put("actOppowers", actOppowers);
|
||||
result.put("curActInst", curActInst);
|
||||
result.put("dataObject", dataObject);
|
||||
result.put("procLogs", procLogs);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/special/zaibanflowinfo", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
|
||||
public Map<String, Object> getZaibanFlowInfo(@RequestParam String curActInstId, @RequestParam String userId, @RequestParam String userOrgId) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
ActivityInstanceModel actInst = processInstanceService.getHistoryTask(curActInstId);
|
||||
if(actInst == null) {
|
||||
throw new RestException(ExceptionErrorCode.B2052.name(), "activity instance not found, id=" + curActInstId);
|
||||
}
|
||||
|
||||
Map<String, Object> tmpResult = processOperateFacase.getProcessZaibanDetail(actInst.getProcDefId(), actInst.getProcInstId(),
|
||||
curActInstId, actInst.getActDefId(), userId, userOrgId);
|
||||
Map<String, Object> tmpLogs = processTraceService.getHisTaskLog(actInst.getProcInstId());
|
||||
ActivityDefinitionModel actDef = (ActivityDefinitionModel)tmpResult.get("curActivity");
|
||||
ActivityInfoConfig config = actDef.getActivityInfoConfig();
|
||||
|
||||
ProcessDefinitionBean procDef = beansBuilder.build((ProcessDefinitionModel)tmpResult.get("processDefinition"));
|
||||
ProcessInstanceBean procInst = beansBuilder.build((HistoricProcessInstanceEntity)tmpResult.get("processInstance"));
|
||||
ActivityDefinitionBean curActDef = beansBuilder.build(actDef);
|
||||
List<ActivityOpBean> actOppowers = beansBuilder.buildActOpList(config.getActivityOperatePowers());
|
||||
ActivityInstanceBean curActInst = beansBuilder.build((ActivityInstanceModel)tmpResult.get("task"));
|
||||
BusinessDataObject dataObject = (BusinessDataObject) processInstanceService.getBusinessDataObject(procInst.getProcInstId());
|
||||
List<ProcessLogBean> procLogs = beansBuilder.buildProcessLogList((List<ProcessLogModel>)tmpLogs.get("processDetailLogs"));
|
||||
|
||||
|
||||
result.put("procDef", procDef);
|
||||
result.put("procInst", procInst);
|
||||
result.put("curActDef", curActDef);
|
||||
result.put("actOppowers", actOppowers);
|
||||
result.put("curActInst", curActInst);
|
||||
result.put("dataObject", dataObject);
|
||||
result.put("procLogs", procLogs);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/special/finishflowinfo", method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
|
||||
public Map<String, Object> getFinishFlowInfo(@RequestParam String procInstId, @RequestParam String userId, @RequestParam String userOrgId) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
Map<String, Object> tmpResult = processOperateFacase.getProcessFinishDetail(procInstId, userId, userOrgId);
|
||||
Map<String, Object> tmpLogs = processTraceService.getHisTaskLog(procInstId);
|
||||
|
||||
ActivityDefinitionModel actDef = (ActivityDefinitionModel)tmpResult.get("curActivity");
|
||||
ActivityInfoConfig config = actDef.getActivityInfoConfig();
|
||||
|
||||
ProcessDefinitionBean procDef = beansBuilder.build((ProcessDefinitionModel)tmpResult.get("processDefinition"));
|
||||
ProcessInstanceBean procInst = beansBuilder.build((HistoricProcessInstanceEntity)tmpResult.get("processInstance"));
|
||||
ActivityDefinitionBean curActDef = beansBuilder.build(actDef);
|
||||
List<ActivityOpBean> actOppowers = beansBuilder.buildActOpList(config.getActivityOperatePowers());
|
||||
ActivityInstanceBean curActInst = beansBuilder.build((ActivityInstanceModel)tmpResult.get("task"));
|
||||
BusinessDataObject dataObject = (BusinessDataObject) processInstanceService.getBusinessDataObject(procInstId);
|
||||
List<ProcessLogBean> procLogs = beansBuilder.buildProcessLogList((List<ProcessLogModel>)tmpLogs.get("processDetailLogs"));
|
||||
|
||||
result.put("procDef", procDef);
|
||||
result.put("procInst", procInst);
|
||||
result.put("curActDef", curActDef);
|
||||
result.put("actOppowers", actOppowers);
|
||||
result.put("curActInst", curActInst);
|
||||
result.put("dataObject", dataObject);
|
||||
result.put("procLogs", procLogs);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.ebpm.util.RestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
import com.blueland.unitework.model.UniteworkTask;
|
||||
import com.blueland.unitework.service.UniteworkService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/unitework")
|
||||
public class UniteworkController {
|
||||
|
||||
@Autowired
|
||||
private UniteworkService uniteworkService;
|
||||
|
||||
@RequestMapping(value = "/myrecordlist", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Page<UniteworkTask> queryUniteworkList(@RequestBody UniteworkTask task) {
|
||||
if (task.getPageSize() == 0)
|
||||
task.setPageNumber(10);
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");
|
||||
return uniteworkService.queryTask(task);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/myYibanlist", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Page<UniteworkTask> myYibanlist(@RequestBody UniteworkTask task) {
|
||||
if (task.getPageSize() == 0)
|
||||
task.setPageNumber(10);
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
/* if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");*/
|
||||
return uniteworkService.queryYibanTask(task);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/queryUnitework", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public List<UniteworkTask> queryUnitework(@RequestBody UniteworkTask task) {
|
||||
if (task.getPageSize() == 0)
|
||||
task.setPageNumber(10);
|
||||
if (RestUtils.isEmpty(task.getProcInstId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "procInstId is empty");
|
||||
return uniteworkService.findByParams(task);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/myrecordcount", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> queryUniteworkCount(@RequestBody UniteworkTask task) {
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");
|
||||
int count = uniteworkService.getTaskCount(task);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("count", count);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/query/procinstid", produces = "application/json;charset=UTF-8")
|
||||
public List<UniteworkTask> queryByProcInstId(@RequestParam String procInstId){
|
||||
return uniteworkService.queryByProcInstId(procInstId);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/query/procinstid/actdefid", produces = "application/json;charset=UTF-8")
|
||||
public List<UniteworkTask> queryByProcInstIdActDefId(@RequestParam String procInstId, @RequestParam String curActDefId){
|
||||
return uniteworkService.queryByProcInstIdActDefId(procInstId, curActDefId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procInstId}/{sourceActId}/{targerActId}/isYiBanTask", produces = "application/json; charset=UTF-8")
|
||||
public boolean isYiBanTask(@PathVariable String procInstId,@PathVariable String sourceActId,@PathVariable String targerActId){
|
||||
if(StringUtils.isEmpty(procInstId)||StringUtils.isEmpty(sourceActId)||StringUtils.isEmpty(targerActId)){
|
||||
return false;
|
||||
}
|
||||
UniteworkTask task=new UniteworkTask();
|
||||
task.setCurActDefId(targerActId);
|
||||
task.setPrevActDefId(sourceActId);
|
||||
task.setProcInstId(procInstId);
|
||||
task.setStatus(UniteworkTask.TASK_TYPE_YIBAN);
|
||||
List<UniteworkTask> yiBanTasks=uniteworkService.findByParams(task);
|
||||
if(yiBanTasks!=null&&!yiBanTasks.isEmpty()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{procInstId}/{recUserId}/isYBTask", produces = "application/json; charset=UTF-8")
|
||||
public boolean isYiBanTask(@PathVariable String procInstId, @PathVariable String recUserId){
|
||||
if(StringUtils.isEmpty(procInstId) || StringUtils.isEmpty(recUserId)){
|
||||
return false;
|
||||
}
|
||||
UniteworkTask task=new UniteworkTask();
|
||||
task.setProcInstId(procInstId);
|
||||
task.setRecUserId(recUserId);
|
||||
List<UniteworkTask> yiBanTasks = uniteworkService.findByParams(task);
|
||||
if(yiBanTasks!=null && !yiBanTasks.isEmpty()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/{procInstId}/{sourceActId}/{targerActId}/isYiBanTaskByTopId", produces = "application/json; charset=UTF-8")
|
||||
public boolean isYiBanTaskByTopId(@PathVariable String procInstId,@PathVariable String sourceActId,@PathVariable String targerActId){
|
||||
if(StringUtils.isEmpty(procInstId)||StringUtils.isEmpty(sourceActId)||StringUtils.isEmpty(targerActId)){
|
||||
return false;
|
||||
}
|
||||
UniteworkTask task=new UniteworkTask();
|
||||
task.setCurActDefId(targerActId);
|
||||
task.setPrevActDefId(sourceActId);
|
||||
task.setTopProcInstId(procInstId);
|
||||
task.setStatus(UniteworkTask.TASK_TYPE_YIBAN);
|
||||
List<UniteworkTask> yiBanTasks=uniteworkService.findByParams(task);
|
||||
if(yiBanTasks!=null&&!yiBanTasks.isEmpty()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/syncreadwork", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> syncReadWork(@RequestBody UniteworkTask task) {
|
||||
String type = task.getStatus();
|
||||
if (type.equals(UniteworkTask.TASK_TYPE_READ)) {
|
||||
if (RestUtils.isEmpty(task.getRecUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is null");
|
||||
}
|
||||
if (RestUtils.isEmpty(task.getId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
uniteworkService.insertRead(task);
|
||||
}else if(type.equals(UniteworkTask.TASK_TYPE_READED)) {
|
||||
uniteworkService.changeToRead(task.getId());
|
||||
}else if(type.equals(UniteworkTask.TASK_TYPE_DEL)) {
|
||||
uniteworkService.deleteRead(task.getId());
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办变已办,供未接入流程中心的第三方应用调用
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/changeTaskStatus", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> changeTaskStatus(@RequestBody UniteworkTask task) {
|
||||
if (RestUtils.isEmpty(task.getId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
uniteworkService.changeToYiban(task.getId(),task.getDealTime());
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.blueland.ebpm.util.RestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.core.model.ExceptionErrorCode;
|
||||
import com.blueland.ebpm.exception.RestException;
|
||||
import com.blueland.unitework.model.UniteworkTask;
|
||||
import com.blueland.unitework.service.UniteworkService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/unitework-sso")
|
||||
public class UniteworkSSOController {
|
||||
|
||||
@Autowired
|
||||
private UniteworkService uniteworkService;
|
||||
|
||||
@RequestMapping(value = "/myrecordlist", produces = "application/json;charset=UTF-8")
|
||||
public Page<UniteworkTask> queryUniteworkList(HttpServletRequest request,@RequestBody UniteworkTask task) {
|
||||
String userid = request.getHeader("iv-user");
|
||||
|
||||
if(RestUtils.isEmpty(userid) || "unauthenticated".equalsIgnoreCase(userid)){
|
||||
throw new RestException(ExceptionErrorCode.A1000.name(), "SSO Fault.");
|
||||
}else {
|
||||
task.setRecUserId(userid);
|
||||
}
|
||||
|
||||
if (task.getPageSize() == 0)
|
||||
task.setPageNumber(10);
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");
|
||||
return uniteworkService.queryTask(task);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/myrecordcount", produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> queryUniteworkCount(HttpServletRequest request, @RequestBody UniteworkTask task) {
|
||||
if (RestUtils.isEmpty(task.getRecUserId()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is empty");
|
||||
if (RestUtils.isEmpty(task.getStatus()))
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "status is empty");
|
||||
int count = uniteworkService.getTaskCount(task);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("count", count);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/syncreadwork", produces = "application/json;charset=UTF-8")
|
||||
public Map<String, Object> syncReadWork(HttpServletRequest request, @RequestBody UniteworkTask task) {
|
||||
String type = task.getStatus();
|
||||
if (type.equals("4")) {
|
||||
if (RestUtils.isEmpty(task.getRecUserId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "recUserId is null");
|
||||
}
|
||||
if (RestUtils.isEmpty(task.getId())) {
|
||||
throw new RestException(ExceptionErrorCode.B2001.name(), "id is null");
|
||||
}
|
||||
uniteworkService.insertRead(task);
|
||||
}else if(type.equals("5")) {
|
||||
uniteworkService.changeToRead(task.getId());
|
||||
}else if(type.equals("7")) {
|
||||
uniteworkService.deleteRead(task.getId());
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("result", "OK");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.ebpm.home.dao.OrgEntityDao;
|
||||
import com.blueland.ebpm.home.dao.UserEntityDao;
|
||||
import com.blueland.ebpm.home.model.UserEntity;
|
||||
import com.blueland.ebpm.home.model.UserPostEntity;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/userpost")
|
||||
public class UserPostSyncController {
|
||||
@Autowired
|
||||
private UserEntityDao userEntityDao;
|
||||
@Autowired
|
||||
private OrgEntityDao orgEntityDao;
|
||||
// 任岗类型
|
||||
private static String POSTTYPE = "parttime";
|
||||
|
||||
|
||||
/**
|
||||
* 新增任岗信息
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "", method=RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> saveUser(@RequestBody UserPostEntity model){
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
if(StringUtils.isEmpty(model.getStaffPostCode())){
|
||||
result.put("resultMsg", "操作失败:StaffPostCode不能为空");
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
User obj = userEntityDao.findUserByUserId(model.getStaffPostCode());
|
||||
Org org = orgEntityDao.findOrgByDeptId(model.getDeptCode());
|
||||
if(org==null){
|
||||
result.put("resultMsg", "操作失败:该部门不存在,deptCode:"+model.getDeptCode()+",deptName:"+model.getDeptName());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
// 如果能查到数据,就根据任岗编码更新数据
|
||||
User user = new User();
|
||||
if (obj != null ) {
|
||||
user = dealUser(model,obj,org);
|
||||
userEntityDao.updateByUserId(user);
|
||||
}
|
||||
// 任岗编码查不到,就查员工号 remark
|
||||
else {
|
||||
User userEmpno = userEntityDao.findUserByRemark(model.getStaffNum());
|
||||
// 查询员工号 不为空,就插入数据
|
||||
if(userEmpno != null){
|
||||
user = dealUser(model,userEmpno,org);
|
||||
userEntityDao.insertObj(user);
|
||||
}else{
|
||||
result.put("resultMsg", "操作失败,没有查到该用户信息:staffNum="+model.getStaffNum());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
}
|
||||
}
|
||||
result.put("resultMsg", "操作成功");
|
||||
result.put("resultCode", "200");
|
||||
result.put("result", user);
|
||||
}catch(Exception e) {
|
||||
result.put("resultMsg", "操作失败:"+e.getMessage());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 更新任岗信息
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/update", method=RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> updateUser(@RequestBody UserPostEntity model){
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
if(StringUtils.isEmpty(model.getStaffPostCode())){
|
||||
result.put("resultMsg", "操作失败:StaffPostCode不能为空");
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
User obj = userEntityDao.findUserByUserId(model.getStaffPostCode());
|
||||
Org org = orgEntityDao.findOrgByDeptId(model.getDeptCode());
|
||||
if(org==null){
|
||||
result.put("resultMsg", "操作失败:该部门不存在,deptCode:"+model.getDeptCode()+",deptName:"+model.getDeptName());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
// 不为空 才更新数据
|
||||
if (obj != null) {
|
||||
User user = dealUser(model,obj,org);
|
||||
userEntityDao.updateByUserId(user);
|
||||
}
|
||||
result.put("resultMsg", "操作成功");
|
||||
result.put("resultCode", "200");
|
||||
result.put("result", model);
|
||||
}catch(Exception e) {
|
||||
result.put("resultMsg", "操作失败:"+e.getMessage());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// 拼装用户信息
|
||||
private User dealUser(UserPostEntity model, User obj, Org org) {
|
||||
if (model.getStaffPostType().equals(POSTTYPE)) { // 如果是任岗才更新userId
|
||||
obj.setUserId(model.getStaffPostCode());
|
||||
}
|
||||
obj.setUserCode(model.getStaffCode());
|
||||
obj.setRemark(model.getStaffNum());
|
||||
obj.setOrgId(org.getOrgId());
|
||||
obj.setOrgName(org.getOrgName());
|
||||
obj.setCompanyId(org.getCompanyId());
|
||||
obj.setCompanyName(org.getCompanyName());
|
||||
obj.setDeptId(model.getDeptCode());
|
||||
obj.setDeptName(model.getDeptName());
|
||||
obj.setUserType(model.getStaffPostType());
|
||||
obj.setPositionId(model.getPositionCode());
|
||||
obj.setUserStatus(model.getStatus().equals("enable")?"QY":"JY");
|
||||
obj.setUserUpdateTime(new Date());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户任岗删除接口
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "{userId}", method=RequestMethod.GET, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> deleteOrg(@PathVariable String userId){
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
// 逻辑删除
|
||||
userEntityDao.updateStatusByUserId(userId);
|
||||
result.put("resultMsg", "操作成功");
|
||||
result.put("resultCode", "200");
|
||||
result.put("result", true);
|
||||
}catch(Exception e) {
|
||||
result.put("resultMsg", "操作失败:"+e.getMessage());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.blueland.ebpm.rest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.ebpm.home.dao.UserEntityDao;
|
||||
import com.blueland.ebpm.home.model.UserEntity;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/staff")
|
||||
public class UserSyncController {
|
||||
@Autowired
|
||||
private UserEntityDao userEntityDao;
|
||||
private static String PWD = "000000";
|
||||
// 任岗类型
|
||||
private static String POSTTYPE = "parttime";
|
||||
|
||||
private static String STATUS_JY = "JY";
|
||||
|
||||
/**
|
||||
* 同步新增用户接口
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "", method=RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> saveUser(@RequestBody UserEntity model){
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
if(StringUtils.isEmpty(model.getStaffPostCode())){
|
||||
result.put("resultMsg", "操作失败:StaffPostCode不能为空");
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
User obj = userEntityDao.findUserByRemark(model.getStaffNum());
|
||||
User user = dealUser(model);
|
||||
// 判断主岗是否存在
|
||||
if(obj == null){
|
||||
// 判断账号是否存在
|
||||
obj = userEntityDao.findUserByUserId(model.getStaffCode());
|
||||
if(obj == null){
|
||||
// 主岗、账号都不存在就新增
|
||||
userEntityDao.insertObj(user);
|
||||
}else{
|
||||
// 更新主岗信息
|
||||
userEntityDao.updateByUserId(user);
|
||||
}
|
||||
}else{
|
||||
userEntityDao.updateByRemark(user);
|
||||
}
|
||||
result.put("resultMsg", "操作成功");
|
||||
result.put("resultCode", "200");
|
||||
result.put("result", model);
|
||||
}catch(Exception e) {
|
||||
result.put("resultMsg", "操作失败:"+e.getMessage());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 同步更新用户接口
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/update/code", method=RequestMethod.PUT, produces = "application/json;charset=UTF-8")
|
||||
public Map<String,Object> updateUser(@RequestBody UserEntity model){
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
try {
|
||||
if(StringUtils.isEmpty(model.getStaffNum())){
|
||||
result.put("resultMsg", "操作失败:StaffNum不能为空");
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
return result;
|
||||
}
|
||||
User obj = userEntityDao.findUserByUserId(model.getStaffCode());
|
||||
// 判断主岗是否存在
|
||||
if(obj == null){
|
||||
User user = dealUser(model);
|
||||
// 主岗、账号都不存在就新增
|
||||
userEntityDao.insertObj(user);
|
||||
}else{
|
||||
User user = dealUpdateUser(model);
|
||||
this.userEntityDao.updateByRemark(user);
|
||||
}
|
||||
// userEntityDao.updateByRemark(user);
|
||||
result.put("resultMsg", "操作成功");
|
||||
result.put("resultCode", "200");
|
||||
result.put("result", model);
|
||||
}catch(Exception e) {
|
||||
result.put("resultMsg", "操作失败:"+e.getMessage());
|
||||
result.put("resultCode", "500");
|
||||
result.put("result", null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private User dealUpdateUser(UserEntity model) {
|
||||
User user = new User();
|
||||
user.setUserId(model.getStaffCode());
|
||||
user.setUserCode(model.getStaffCode());
|
||||
user.setUserName(model.getStaffName());
|
||||
user.setUserSex(model.getStaffSex());
|
||||
user.setUserMobile(model.getStaffMobile());
|
||||
user.setUserMail(model.getStaffMail());
|
||||
user.setUserStatus(model.getStaffStatus());
|
||||
user.setUserSort(model.getStaffSort());
|
||||
user.setRemark(model.getStaffNum());
|
||||
user.setCompanyId(model.getCompanyId());
|
||||
user.setCompanyName(model.getCompanyName());
|
||||
user.setOrgId(model.getOrgId());
|
||||
user.setOrgName(model.getOrgName());
|
||||
user.setDeptId(model.getDeptId());
|
||||
user.setDeptName(model.getDeptName());
|
||||
user.setPositionId(model.getPositionId());
|
||||
user.setUserType(model.getStaffPostType());
|
||||
return user;
|
||||
}
|
||||
// 拼装用户信息
|
||||
private User dealUser(UserEntity model) {
|
||||
User user = new User();
|
||||
user.setUserId(model.getStaffCode());
|
||||
if (StringUtils.isNotEmpty(model.getStaffPostType()) && model.getStaffPostType().equals(POSTTYPE)) { // 如果是任岗才更新userId
|
||||
user.setUserId(model.getStaffPostCode());
|
||||
}
|
||||
user.setUserCode(model.getStaffCode());
|
||||
user.setUserName(model.getStaffName());
|
||||
user.setUserSex(model.getStaffSex());
|
||||
user.setUserAge(0);
|
||||
user.setUserMobile(model.getStaffMobile());
|
||||
user.setUserMail(model.getStaffMail());
|
||||
user.setUserStatus(model.getStaffStatus());
|
||||
user.setUserSort(model.getStaffSort());
|
||||
user.setUserPwd(PWD);
|
||||
user.setRemark(model.getStaffNum());
|
||||
user.setCompanyId(model.getCompanyId());
|
||||
user.setCompanyName(model.getCompanyName());
|
||||
user.setOrgId(model.getOrgId());
|
||||
user.setOrgName(model.getOrgName());
|
||||
user.setDeptId(model.getDeptId());
|
||||
user.setDeptName(model.getDeptName());
|
||||
user.setPositionId(model.getPositionId());
|
||||
user.setUserType(model.getStaffPostType());
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.blueland.ebpm.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.activiti.bpmn.model.ExpandProperty;
|
||||
import org.activiti.engine.impl.pvm.process.TransitionImpl;
|
||||
|
||||
import com.blueland.bpm.engine.util.ComparatorTransition;
|
||||
import com.blueland.ebpm.bean.ActivityDefinitionBean;
|
||||
|
||||
|
||||
public class ComparatorActivity implements Comparator<ActivityDefinitionBean>{
|
||||
|
||||
@Override
|
||||
public int compare(ActivityDefinitionBean pvm1, ActivityDefinitionBean pvm2) {
|
||||
Integer val1=pvm1.getActDefOrder();
|
||||
Integer val2=pvm2.getActDefOrder();
|
||||
if(val1==null){
|
||||
val1=99;
|
||||
}
|
||||
if(val2==null){
|
||||
val2=99;
|
||||
}
|
||||
return val1.compareTo(val2);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
List<TransitionImpl> ts=new ArrayList<TransitionImpl>();
|
||||
TransitionImpl t1=new TransitionImpl("r1",null);
|
||||
TransitionImpl t2=new TransitionImpl("r2",null);
|
||||
TransitionImpl t3=new TransitionImpl("r3",null);
|
||||
ts.add(t1);
|
||||
ts.add(t2);
|
||||
ts.add(t3);
|
||||
ExpandProperty expandProperty1=new ExpandProperty();
|
||||
expandProperty1.setId("TRANSITION_DISPLAY_ORDER");
|
||||
expandProperty1.setValue("3");
|
||||
List aa=new ArrayList();
|
||||
aa.add(expandProperty1);
|
||||
//t1.setExpandPropertys(aa);
|
||||
ExpandProperty expandProperty2=new ExpandProperty();
|
||||
expandProperty2.setId("TRANSITION_DISPLAY_ORDER");
|
||||
expandProperty2.setValue("1");
|
||||
List aa2=new ArrayList();
|
||||
aa2.add(expandProperty2);
|
||||
t2.setExpandPropertys(aa2);
|
||||
|
||||
ExpandProperty expandProperty3=new ExpandProperty();
|
||||
expandProperty3.setId("TRANSITION_DISPLAY_ORDER");
|
||||
expandProperty3.setValue("2");
|
||||
List aa3=new ArrayList();
|
||||
aa3.add(expandProperty3);
|
||||
t3.setExpandPropertys(aa3);
|
||||
|
||||
System.out.println("before----");
|
||||
for (TransitionImpl t : ts) {
|
||||
System.out.println(t.getId());
|
||||
}
|
||||
|
||||
Collections.sort(ts,new ComparatorTransition());
|
||||
System.out.println("after----");
|
||||
for (TransitionImpl t : ts) {
|
||||
System.out.println(t.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.blueland.ebpm.util;
|
||||
|
||||
public class RestUtils {
|
||||
|
||||
public static boolean isEmpty(CharSequence cs) {
|
||||
return (cs == null) || (cs.length() == 0) || (cs.equals("null")) || (cs.equals("undefined"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,495 @@
|
||||
package com.blueland.ebpm.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.Clob;
|
||||
import java.sql.SQLException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author luobo
|
||||
*
|
||||
*/
|
||||
public class StringFlowUtil {
|
||||
|
||||
/**
|
||||
* 检测字符串是否不为空(null,"","null")
|
||||
* @param s
|
||||
* @return 不为空则返回true,否则返回false
|
||||
*/
|
||||
public static boolean notEmpty(String s){
|
||||
return s!=null && !"".equals(s) && !"null".equals(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测字符串是否为空(null,"","null")
|
||||
* @param s
|
||||
* @return 为空则返回true,不否则返回false
|
||||
*/
|
||||
public static boolean isEmpty(String s){
|
||||
return s==null || "".equals(s) || "null".equals(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换为字符串数组
|
||||
* @param str 字符串
|
||||
* @param splitRegex 分隔符
|
||||
* @return
|
||||
*/
|
||||
public static String[] str2StrArray(String str,String splitRegex){
|
||||
if(isEmpty(str)){
|
||||
return null;
|
||||
}
|
||||
return str.split(splitRegex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用默认的分隔符(,)将字符串转换为字符串数组
|
||||
* @param str 字符串
|
||||
* @return
|
||||
*/
|
||||
public static String[] str2StrArray(String str){
|
||||
return str2StrArray(str,",\\s*");
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成整形,出现数字格式异常默认为defaultValue
|
||||
* @param object
|
||||
* @param defaultValue
|
||||
* @return
|
||||
*/
|
||||
public static int toInt(Object object,int defaultValue){
|
||||
if(null == object){
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(""+object);
|
||||
} catch (NumberFormatException notint) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成整形,出现数字格式异常默认<E9BB98>?
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static int toInt(Object object){
|
||||
return toInt(object,0);
|
||||
}
|
||||
|
||||
|
||||
public static String toNumricStr(Integer num,Integer digits){
|
||||
String numstr = num.toString();
|
||||
while (numstr.length() < digits){
|
||||
numstr = "0"+numstr;
|
||||
}
|
||||
return numstr;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String [] args){
|
||||
String str="一、卷包车间平面7台综合测试仪需要进行数据采集,要求:1、采集卷接生产过程进行在线质量检测的检测数据。2、将采集数据集成至工艺质量系统,对数据进行分析统计,生成相应报表。3、将采集到的数据集成至卷包数采系统,在卷包数采工控机数采终端能实时查询。\r\n二、检测仪器自动采集与数据应用升级改造:1、新进红外水分安装采集和分析模块,2、填充值采集模块,3、红外校准零点记录与跟踪,4、报表生成,5、对比分析模块,6、目前在用系统升级\r\n三、系统集成";
|
||||
}
|
||||
|
||||
/**
|
||||
* @方法名: handleTextArea
|
||||
* @描述:处理一个实体中的属性,如果是String,则进行转义,以方便前台换行显示
|
||||
* @作者:高星
|
||||
* @时间:2015-8-7 上午9:51:57
|
||||
* @参数:@param obj
|
||||
* @返回值:void
|
||||
*/
|
||||
public void handleTextArea(Object obj){
|
||||
if(obj!=null && obj instanceof Map){
|
||||
Map<String,Object> map=((Map<String, Object>)obj);
|
||||
Set<String> keySet=map.keySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 转换textarea 中提交的数据在页面中按照textarea中一样的格式进行换行显示
|
||||
* @param textarea
|
||||
* @return
|
||||
*/
|
||||
public static String textarea2html(String textarea){
|
||||
if(null != textarea){
|
||||
return textarea.replaceAll("\n", "<br/>").replace(" ", " ");
|
||||
}
|
||||
return textarea;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串中HTML字符转换成TEXT类型字符
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static String textEncode(String text){
|
||||
if(text == null)
|
||||
return "";
|
||||
text = text.replaceAll("<br/>", "\r\n");
|
||||
text = text.replaceAll("", "");
|
||||
text = text.replaceAll("&", "&") ;
|
||||
text = text.replaceAll(""", "\"") ;
|
||||
text = text.replaceAll("<", "<") ;
|
||||
text = text.replaceAll(">", ">") ;
|
||||
text = text.replaceAll("’", "'") ;
|
||||
text = text.replaceAll(" "," ");
|
||||
text = text.replaceAll(" ","\t");
|
||||
return text;
|
||||
}
|
||||
/**
|
||||
* 将字符串中TEXT类型字符转换成HTML字符
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static String textDecode(String text){
|
||||
if(text == null)
|
||||
return "";
|
||||
text = text.replaceAll("","");
|
||||
text = text.replaceAll("&","&") ;
|
||||
text = text.replaceAll("\"",""") ;
|
||||
text = text.replaceAll( "<","<");
|
||||
text = text.replaceAll(">",">");
|
||||
text = text.replaceAll("'","’") ;
|
||||
text = text.replaceAll(" "," ");
|
||||
text = text.replaceAll("\\\\t"," ");
|
||||
text = text.replaceAll("\r\n","<br/>");
|
||||
text = text.replaceAll("\\r\\n","<br/>");
|
||||
text = text.replaceAll("\\\r\\\n","<br/>");
|
||||
text = text.replaceAll("\\\\r\\\\n","<br/>");
|
||||
return text;
|
||||
}
|
||||
|
||||
public static void handleText(Object obj){
|
||||
if(obj!=null && obj instanceof Map){
|
||||
Map map=(Map)obj;
|
||||
Set<String> keySet=map.keySet();
|
||||
for(String key:keySet){
|
||||
Object item=map.get(key);
|
||||
if(item!=null && item instanceof String){
|
||||
map.put(key,StringFlowUtil.textDecode((String)item));
|
||||
}
|
||||
}
|
||||
obj=map;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符串的实际长度(按字节长度,如一个中文长度为2)
|
||||
*
|
||||
* @param str
|
||||
* 待返回长度的字符串
|
||||
* @return 字符串的字节长度
|
||||
*/
|
||||
public static int getStrRealLength(String str) {
|
||||
|
||||
if (str == null)
|
||||
return 0;
|
||||
|
||||
int length = 0;
|
||||
|
||||
char[] chars = str.toCharArray();
|
||||
|
||||
for (char ch : chars) {
|
||||
|
||||
if (ch <= 127) {
|
||||
length++;
|
||||
|
||||
} else {
|
||||
length += 2;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
//求两个字符串数组的并集,利用set的元素唯一性
|
||||
public static String[] union(String[] arr1, String[] arr2) {
|
||||
Set<String> set = new HashSet<String>();
|
||||
for (String str : arr1) {
|
||||
set.add(str);
|
||||
}
|
||||
for (String str : arr2) {
|
||||
set.add(str);
|
||||
}
|
||||
String[] result = {};
|
||||
return set.toArray(result);
|
||||
}
|
||||
|
||||
//求两个数组的交集
|
||||
public static String[] intersect(String[] arr1, String[] arr2) {
|
||||
Map<String, Boolean> map = new HashMap<String, Boolean>();
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
for (String str : arr1) {
|
||||
if (!map.containsKey(str)) {
|
||||
map.put(str, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
for (String str : arr2) {
|
||||
if (map.containsKey(str)) {
|
||||
map.put(str, Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<String, Boolean> e : map.entrySet()) {
|
||||
if (e.getValue().equals(Boolean.TRUE)) {
|
||||
list.add(e.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
String[] result = {};
|
||||
return list.toArray(result);
|
||||
}
|
||||
|
||||
//求两个数组的差集
|
||||
public static String[] minus(String[] arr1, String[] arr2) {
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
LinkedList<String> history = new LinkedList<String>();
|
||||
String[] longerArr = arr1;
|
||||
String[] shorterArr = arr2;
|
||||
//找出较长的数组来减较短的数组
|
||||
if (arr1.length > arr2.length) {
|
||||
longerArr = arr2;
|
||||
shorterArr = arr1;
|
||||
}
|
||||
for (String str : longerArr) {
|
||||
if (!list.contains(str)) {
|
||||
list.add(str);
|
||||
}
|
||||
}
|
||||
for (String str : shorterArr) {
|
||||
if (list.contains(str)) {
|
||||
history.add(str);
|
||||
list.remove(str);
|
||||
} else {
|
||||
if (!history.contains(str)) {
|
||||
list.add(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String[] result = {};
|
||||
return list.toArray(result);
|
||||
}
|
||||
|
||||
public static String convertToString(Object obj,String defaultValue){
|
||||
if(obj==null){
|
||||
return defaultValue;
|
||||
}else{
|
||||
return obj.toString();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @方法名: strToList
|
||||
* @描述:将以特定分隔符分割的字符串转为为List
|
||||
* @作者:高星
|
||||
* @时间:2014-10-13 上午9:51:08
|
||||
* @参数:@param ids
|
||||
* @参数:@param seperator
|
||||
* @参数:@return
|
||||
* @返回值:List
|
||||
*/
|
||||
public static List<String> strToList(String ids,String seperator){
|
||||
List<String> idList=new ArrayList<String>();
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
String[] idArr=ids.split(seperator);
|
||||
for(String id:idArr){
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
idList.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
/**
|
||||
* @方法名: clobToStr
|
||||
* @描述:将Clob字段转化为字符串
|
||||
* @作者:高星
|
||||
* @时间:2014-10-31 下午3:36:43
|
||||
* @参数:@param clob
|
||||
* @参数:@return
|
||||
* @返回值:String
|
||||
*/
|
||||
public static String clobToStr(Clob clob){
|
||||
String result="";
|
||||
try {
|
||||
result= (clob != null ? clob.getSubString(1, (int) clob.length()) :"");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Clob strToClob(String str, Clob lob) throws Exception {
|
||||
Method methodToInvoke = lob.getClass().getMethod(
|
||||
"getCharacterOutputStream", (Class[]) null);
|
||||
Writer writer = (Writer) methodToInvoke.invoke(lob, (Object[]) null);
|
||||
writer.write(str);
|
||||
writer.close();
|
||||
return lob;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能: 按照指定字节长度截取字符串并选择在后面是否加...
|
||||
*
|
||||
* @param str
|
||||
* 需要截取的字符串
|
||||
* @param offset
|
||||
* 需要截取的字节长度,不包括追加的…
|
||||
* @param addEllipsis
|
||||
* 是否添加省略号… true 是 false 否
|
||||
* @return String 截取后的字符串
|
||||
*/
|
||||
public static String getSubStr(String str,int offset,boolean addEllipsis) {
|
||||
if (str == null)
|
||||
return "";
|
||||
int realLength = getStrRealLength(str);
|
||||
if (realLength <= offset) {
|
||||
return str;
|
||||
}
|
||||
int length = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] chars = str.toCharArray();
|
||||
int ii = 0;
|
||||
while (length < offset) {
|
||||
char ch = chars[ii++];
|
||||
if (ch <= 127) {
|
||||
length++;
|
||||
} else {
|
||||
length += 2;
|
||||
}
|
||||
sb.append(ch);
|
||||
}
|
||||
if(addEllipsis==true){
|
||||
sb.append("…");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean contains(String str1,String str2,String separator){
|
||||
boolean b=false;
|
||||
if(StringUtils.isNotBlank(str1) && StringUtils.isNotBlank(str2)){
|
||||
if(null!=separator){
|
||||
b=str1.indexOf(separator+str2+separator)>-1;
|
||||
}else{
|
||||
b=str1.indexOf(str2)>-1;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void handleMapListData(List<Map<String,Object>> dataList){
|
||||
if(dataList!=null && dataList.size()>0){
|
||||
for(int i=0;i<dataList.size();i++){
|
||||
Map<String,Object> item=dataList.get(i);
|
||||
Set<String> keySet=item.keySet();
|
||||
for(String key:keySet){
|
||||
Object value=item.get(key);
|
||||
String className=value.getClass().getSimpleName();
|
||||
if("clob".equals(className.toLowerCase())){
|
||||
item.put(key,StringFlowUtil.clobToStr((Clob) item.get(key)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Long handleDiscountMoney(Long discount){
|
||||
return Math.abs(discount)/100;
|
||||
}
|
||||
|
||||
//取类似10m 10gi 100s中的数字,特点都是数字开头最后是字符. add by wfz 2017-03-28
|
||||
public static int getNumber(String data){
|
||||
data=data.trim();
|
||||
if(isEmpty(data))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int index = 0;
|
||||
for(int i = 0; i < data.length(); i++){
|
||||
if (!Character.isDigit(data.charAt(i))){
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String valueStr="0";
|
||||
String unitStr="m";
|
||||
if(index==0)
|
||||
{
|
||||
valueStr= data;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueStr=data.substring(0,index);//计量数字
|
||||
unitStr=data.substring(index);//计量单位 mi m g gi
|
||||
}
|
||||
int intValue=Integer.valueOf(valueStr);
|
||||
int result=intValue;
|
||||
if(notEmpty(unitStr))
|
||||
{
|
||||
unitStr=unitStr.toLowerCase();
|
||||
switch (unitStr) {
|
||||
case "m":
|
||||
case "mi":
|
||||
result=intValue;
|
||||
break;
|
||||
case "g":
|
||||
result=intValue*1024;
|
||||
break;
|
||||
case "gi":
|
||||
result=intValue*1000;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* 内存转换为g并取整
|
||||
* unit 转换单位1000或1024
|
||||
* divCount 除的次数 k转要除以2次
|
||||
* add by wfz 2017-07-13
|
||||
*/
|
||||
public static String memoryCalc(double mem,Integer unit,Integer divCount )
|
||||
{
|
||||
double result=mem;
|
||||
for(int i=1;i<=divCount;i++)
|
||||
{
|
||||
result=result/unit;
|
||||
}
|
||||
|
||||
NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
|
||||
|
||||
// 保留两位小数
|
||||
nf.setMaximumFractionDigits(2);
|
||||
|
||||
|
||||
// 如果不需要四舍五入,可以使用RoundingMode.DOWN
|
||||
nf.setRoundingMode(RoundingMode.UP);
|
||||
|
||||
|
||||
return nf.format(result);
|
||||
|
||||
}
|
||||
|
||||
public static Date long2Date( long time )
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTimeInMillis( time );
|
||||
return c.getTime();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
logging.level.root=ERROR
|
||||
logging.level.com.blueland=DEBUG
|
||||
spring.main.banner-mode = console
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.force=true
|
||||
server.servlet.encoding.enabled=true
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://192.168.1.168:3307/tool_tech_bpmc?useUnicode=true&characterEncoding=UTF-8
|
||||
spring.datasource.username=tool_tech
|
||||
spring.datasource.password=Tooltech@123
|
||||
spring.datasource.connectionTimeout=60000
|
||||
spring.datasource.idleTimeout=600000
|
||||
spring.datasource.validationTimeout=3000
|
||||
spring.datasource.maxLifetime=700000
|
||||
spring.datasource.maximumPoolSize=10
|
||||
spring.datasource.validationQuery=select 1 from dual
|
||||
|
||||
server.port=8081
|
||||
server.servlet.context-path=/ebpm-process-rest
|
||||
spring.aop.auto=true
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
server.tomcat.connection-timeout=5000
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
server.tomcat.max-http-form-post-size=5MB
|
||||
server.tomcat.max-swallow-size=5MB
|
||||
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
spring.servlet.multipart.max-request-size=100MB
|
||||
server.servlet.session.timeout=PT4H
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus.type-aliases-package=com.**.dao,com.**.**.dao
|
||||
mybatis-plus.base-package=com.**.dao,com.**.**.dao
|
||||
#mybatis-plus.mapper-locations=classpath*:mapping/**/*Mapper.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/com/**/model/**/*Mapper.xml
|
||||
|
||||
spring.redis.host=192.168.1.168
|
||||
spring.redis.port=6379
|
||||
spring.redis.username=
|
||||
spring.redis.password=
|
||||
# use dbIndex
|
||||
spring.redis.database=7
|
||||
spring.redis.maxIdle=300
|
||||
spring.redis.maxWait=3000
|
||||
spring.redis.testOnBorrow=true
|
||||
|
||||
bizworks-api-gateway.host=c7d7025679174c678eda9e13643c0e8b.apigateway.res.zgs.yun
|
||||
bizworks-api-gateway.appKey=1642130464513397
|
||||
bizworks-api-gateway.appSecret=bedce56cca554aedaf65e64aac6199fa
|
||||
|
||||
rzdata.userCenterBizCode=
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
@@ -0,0 +1,56 @@
|
||||
logging.level.root=ERROR
|
||||
logging.level.com.blueland=ERROR
|
||||
spring.main.banner-mode = console
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.force=true
|
||||
server.servlet.encoding.enabled=true
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://rm-2tn06021ed601bk7r.mysql.rds.ops.zgs.yun:3306/dzy_bpm?useUnicode=true&characterEncoding=utf8
|
||||
spring.datasource.username=dzydb_test
|
||||
spring.datasource.password=DZY2022#test
|
||||
spring.datasource.connectionTimeout=60000
|
||||
spring.datasource.idleTimeout=600000
|
||||
spring.datasource.validationTimeout=3000
|
||||
spring.datasource.maxLifetime=700000
|
||||
spring.datasource.maximumPoolSize=10
|
||||
spring.datasource.validationQuery=select 1 from dual
|
||||
|
||||
server.port=8081
|
||||
server.servlet.context-path=/ebpm-process-rest
|
||||
spring.aop.auto=true
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
server.tomcat.connection-timeout=5000
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
server.tomcat.max-http-form-post-size=5MB
|
||||
server.tomcat.max-swallow-size=5MB
|
||||
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
spring.servlet.multipart.max-request-size=100MB
|
||||
server.servlet.session.timeout=PT4H
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus.type-aliases-package=com.**.dao,com.**.**.dao
|
||||
mybatis-plus.base-package=com.**.dao,com.**.**.dao
|
||||
#mybatis-plus.mapper-locations=classpath*:mapping/**/*Mapper.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/com/**/model/**/*Mapper.xml
|
||||
|
||||
spring.redis.host=r-2tn0c051c60728c4.redis.rds.ops.zgs.yun
|
||||
spring.redis.port=6379
|
||||
spring.redis.username=
|
||||
spring.redis.password=Dzy0118redistest
|
||||
# use dbIndex
|
||||
spring.redis.database=7
|
||||
spring.redis.maxIdle=300
|
||||
spring.redis.maxWait=3000
|
||||
spring.redis.testOnBorrow=true
|
||||
|
||||
bizworks-api-gateway.host=2134b85ccc0f480c8b426562089f4dee.apigateway.res.zgs.yun
|
||||
bizworks-api-gateway.appKey=1643168359749509
|
||||
bizworks-api-gateway.appSecret=7c0fdf0f679a4483a760fe5aaafdd2b5
|
||||
|
||||
rzdata.userCenterBizCode=
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
@@ -0,0 +1,56 @@
|
||||
logging.level.root=ERROR
|
||||
logging.level.com.blueland=ERROR
|
||||
spring.main.banner-mode = console
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.force=true
|
||||
server.servlet.encoding.enabled=true
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://rm-2tnk30mw0444u7fy2.mysql.rds.ops.zgs.yun:3306/dzy_bpm?useUnicode=true&characterEncoding=utf8
|
||||
spring.datasource.username=dzydb_prod
|
||||
spring.datasource.password=DZYprod2022
|
||||
spring.datasource.connectionTimeout=60000
|
||||
spring.datasource.idleTimeout=600000
|
||||
spring.datasource.validationTimeout=3000
|
||||
spring.datasource.maxLifetime=700000
|
||||
spring.datasource.maximumPoolSize=100
|
||||
spring.datasource.validationQuery=select 1 from dual
|
||||
|
||||
server.port=8081
|
||||
server.servlet.context-path=/ebpm-process-rest
|
||||
spring.aop.auto=true
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
server.tomcat.connection-timeout=5000
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
server.tomcat.max-http-form-post-size=5MB
|
||||
server.tomcat.max-swallow-size=5MB
|
||||
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
spring.servlet.multipart.max-request-size=100MB
|
||||
server.servlet.session.timeout=PT4H
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus.type-aliases-package=com.**.dao,com.**.**.dao
|
||||
mybatis-plus.base-package=com.**.dao,com.**.**.dao
|
||||
#mybatis-plus.mapper-locations=classpath*:mapping/**/*Mapper.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/com/**/model/**/*Mapper.xml
|
||||
|
||||
spring.redis.host=r-2tn004a93cb7df24.redis.rds.ops.zgs.yun
|
||||
spring.redis.port=6379
|
||||
spring.redis.username=
|
||||
spring.redis.password=DZY0118redisprod
|
||||
# use dbIndex
|
||||
spring.redis.database=7
|
||||
spring.redis.maxIdle=300
|
||||
spring.redis.maxWait=3000
|
||||
spring.redis.testOnBorrow=true
|
||||
|
||||
bizworks-api-gateway.host=ba867127e49b4606866ef819c4d0d8ed.apigateway.res.zgs.yun
|
||||
bizworks-api-gateway.appKey=1649944513364356
|
||||
bizworks-api-gateway.appSecret=aa25a746077a48f689ff9f48322be4ed
|
||||
|
||||
rzdata.userCenterBizCode=
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
@@ -0,0 +1,56 @@
|
||||
logging.level.root=ERROR
|
||||
logging.level.com.blueland=ERROR
|
||||
spring.main.banner-mode = console
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.force=true
|
||||
server.servlet.encoding.enabled=true
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://192.168.1.168:3307/tool_tech_bpmc?useUnicode=true&characterEncoding=UTF-8
|
||||
spring.datasource.username=tool_tech
|
||||
spring.datasource.password=Tooltech@123
|
||||
spring.datasource.connectionTimeout=60000
|
||||
spring.datasource.idleTimeout=600000
|
||||
spring.datasource.validationTimeout=3000
|
||||
spring.datasource.maxLifetime=700000
|
||||
spring.datasource.maximumPoolSize=10
|
||||
spring.datasource.validationQuery=select 1 from dual
|
||||
|
||||
server.port=8081
|
||||
server.servlet.context-path=/ebpm-process-rest
|
||||
spring.aop.auto=true
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
server.tomcat.connection-timeout=5000
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
server.tomcat.max-http-form-post-size=5MB
|
||||
server.tomcat.max-swallow-size=5MB
|
||||
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
spring.servlet.multipart.max-request-size=100MB
|
||||
server.servlet.session.timeout=PT4H
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus.type-aliases-package=com.**.dao,com.**.**.dao
|
||||
mybatis-plus.base-package=com.**.dao,com.**.**.dao
|
||||
#mybatis-plus.mapper-locations=classpath*:mapping/**/*Mapper.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/com/**/model/**/*Mapper.xml
|
||||
|
||||
spring.redis.host=r-2tn4c913fd39ed84.redis.rds.ops.zgs.yun
|
||||
spring.redis.port=6379
|
||||
spring.redis.username=
|
||||
spring.redis.password=Tianwei1217@redis
|
||||
# use dbIndex
|
||||
spring.redis.database=7
|
||||
spring.redis.maxIdle=300
|
||||
spring.redis.maxWait=3000
|
||||
spring.redis.testOnBorrow=true
|
||||
|
||||
bizworks-api-gateway.host=c7d7025679174c678eda9e13643c0e8b.apigateway.res.zgs.yun
|
||||
bizworks-api-gateway.appKey=1642130464513397
|
||||
bizworks-api-gateway.appSecret=bedce56cca554aedaf65e64aac6199fa
|
||||
|
||||
rzdata.userCenterBizCode=
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
56
ebpm-process-rest/src/main/resources/application.properties
Normal file
56
ebpm-process-rest/src/main/resources/application.properties
Normal file
@@ -0,0 +1,56 @@
|
||||
logging.level.root=ERROR
|
||||
logging.level.com.blueland=DEBUG
|
||||
spring.main.banner-mode = console
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
server.servlet.encoding.charset=UTF-8
|
||||
server.servlet.encoding.force=true
|
||||
server.servlet.encoding.enabled=true
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://192.168.1.168:3307/vazyme_bpm?useUnicode=true&characterEncoding=UTF-8
|
||||
spring.datasource.username=dzy
|
||||
spring.datasource.password=Dzy@1215
|
||||
spring.datasource.connectionTimeout=60000
|
||||
spring.datasource.idleTimeout=600000
|
||||
spring.datasource.validationTimeout=3000
|
||||
spring.datasource.maxLifetime=700000
|
||||
spring.datasource.maximumPoolSize=10
|
||||
spring.datasource.validationQuery=select 1 from dual
|
||||
|
||||
server.port=8081
|
||||
server.servlet.context-path=/ebpm-process-rest
|
||||
spring.aop.auto=true
|
||||
server.compression.enabled=true
|
||||
server.compression.min-response-size=1
|
||||
server.tomcat.connection-timeout=5000
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
server.tomcat.max-http-form-post-size=5MB
|
||||
server.tomcat.max-swallow-size=5MB
|
||||
|
||||
spring.servlet.multipart.max-file-size=100MB
|
||||
spring.servlet.multipart.max-request-size=100MB
|
||||
server.servlet.session.timeout=PT4H
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus.type-aliases-package=com.**.dao,com.**.**.dao
|
||||
mybatis-plus.base-package=com.**.dao,com.**.**.dao
|
||||
#mybatis-plus.mapper-locations=classpath*:mapping/**/*Mapper.xml
|
||||
mybatis-plus.mapper-locations=classpath*:/com/**/model/**/*Mapper.xml
|
||||
|
||||
spring.redis.host=192.168.1.168
|
||||
spring.redis.port=6379
|
||||
spring.redis.username=
|
||||
spring.redis.password=
|
||||
# use dbIndex
|
||||
spring.redis.database=7
|
||||
spring.redis.maxIdle=300
|
||||
spring.redis.maxWait=3000
|
||||
spring.redis.testOnBorrow=true
|
||||
|
||||
bizworks-api-gateway.host=c7d7025679174c678eda9e13643c0e8b.apigateway.res.zgs.yun
|
||||
bizworks-api-gateway.appKey=1642130464513397
|
||||
bizworks-api-gateway.appSecret=bedce56cca554aedaf65e64aac6199fa
|
||||
|
||||
rzdata.userCenterBizCode=
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
6
ebpm-process-rest/src/main/resources/banner.txt
Normal file
6
ebpm-process-rest/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
___. __
|
||||
\_ |__ ______ _____ ____ _______ ____ _______/ |_
|
||||
| __ \\____ \ / \_/ ___\ ______ \_ __ \_/ __ \ / ___/\ __\
|
||||
| \_\ \ |_> > Y Y \ \___ /_____/ | | \/\ ___/ \___ \ | |
|
||||
|___ / __/|__|_| /\___ > |__| \___ >____ > |__|
|
||||
\/|__| \/ \/ \/ \/
|
||||
18
ebpm-process-rest/src/main/resources/bizworks/modules.yaml
Normal file
18
ebpm-process-rest/src/main/resources/bizworks/modules.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
#bizworks:
|
||||
# projectCode: "national-tobacco-project"
|
||||
# modules:
|
||||
# - type: "MODULE_CENTER"
|
||||
# # code: "Bpmc"
|
||||
# # version: "v5.0.0"
|
||||
# packages:
|
||||
# - "com.tobacco.mp.uc"
|
||||
|
||||
|
||||
---
|
||||
bizworks:
|
||||
modules:
|
||||
- type: "MODULE_CENTER"
|
||||
code: "Bpmc"
|
||||
packages:
|
||||
- "com.tobacco.mp.bpmc"
|
||||
|
||||
13
ebpm-process-rest/src/main/resources/configuration.xml
Normal file
13
ebpm-process-rest/src/main/resources/configuration.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="GBK"?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN"
|
||||
"http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
|
||||
<configuration>
|
||||
<plugins>
|
||||
<!-- ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>Dialect, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:OracleDialect,SQLServerDialect,SybaseDialect,DB2Dialect,PostgreSQLDialect,MySQLDialect,DerbyDialect,HSQLDialect-->
|
||||
<plugin interceptor="com.blueland.bpm.common.ibatis3.plugin.OffsetLimitInterceptor">
|
||||
<property name="dialectClass" value="com.blueland.bpm.common.jdbc.dialect.MySQLDialect"/>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,22 @@
|
||||
#???? ????
|
||||
MAX_COOKIE=36000000
|
||||
MAX_SESSION=8640000
|
||||
bpm_process_modeler_path=/ebpm-process-modeler/
|
||||
#????ID
|
||||
TOP_ORG_ID=402880e447e99cf10147e9a03b320003
|
||||
IS_OPEN_TENANT=true
|
||||
MANAGE_URL=http://222.244.147.65:39080/bpmc-manage
|
||||
|
||||
WMH_URL=http://117.78.50.82:18081/vazyme/rest/sms/sendflow
|
||||
|
||||
#SEND_SMS_URL=http://10.158.133.173:9080/ebpm-common-rest/sms/send.do
|
||||
|
||||
#SEND_SMS_URL=http://10.158.133.173:9080/ebpm-common-rest/sms/send.do
|
||||
#SEND_QYWX_URL=https://app.vazyme.cn/vazyme-portal-jwt
|
||||
#QYWX_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI4bms4bTRZM1VCaVJhQ0ZZVVBDT0RCS01PelVzNFFKQSJ9.rgltLt1SWK_gVFIidRT8511K4Msd_aUW1n_QdvlyeCw
|
||||
SEND_QYWX_URL=http://192.168.21.31:88/cs-vazyme-portal
|
||||
QYWX_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCQ0FuMkNIRGtvU0RKdjdJcDBrMFdqVkhVUm85NElTRiJ9.zzJtS7TYaaLy-VIANMU96SOw2r9driz-0Qxy-To9ko8
|
||||
|
||||
userservice.type=userServiceImpl
|
||||
orgservice.type=orgServiceImpl
|
||||
presource.type=processDefinitionResource
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.blueland.ebpm.engine;
|
||||
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 本基类主要为子类指定好要装载的spring配置文件
|
||||
*
|
||||
* @author lw
|
||||
* 请设置好要装载的spring配置文件,一般开发数据库与测试数据库分开
|
||||
* 所以你要装载的资源文件应改为"classpath:/spring/*-test-resource.xml"
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
public class BaseManagerTestCase extends AbstractTransactionalJUnit4SpringContextTests{
|
||||
|
||||
protected DataSource getDataSource() {
|
||||
DataSource ds = (DataSource)applicationContext.getBean("dataSource");
|
||||
assertNotNull("not found 'dataSource'",ds);
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.blueland.ebpm.engine;
|
||||
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
public abstract class BaseWfServiceTest //extends AbstractTransactionalJUnit4SpringContextTests {
|
||||
extends AbstractJUnit4SpringContextTests {
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Autowired
|
||||
protected ProcessEngineConfigurationImpl processEngineConfiguration;
|
||||
@Autowired
|
||||
protected ProcessEngine processEngine;
|
||||
|
||||
@Autowired
|
||||
protected RepositoryService repositoryService;
|
||||
@Autowired
|
||||
protected RuntimeService runtimeService;
|
||||
@Autowired
|
||||
protected TaskService taskService;
|
||||
@Autowired
|
||||
protected HistoryService historyService;
|
||||
|
||||
@Autowired
|
||||
protected IdentityService identityService;
|
||||
|
||||
@Autowired
|
||||
protected ManagementService managementService;
|
||||
|
||||
protected String deploymentId;
|
||||
|
||||
public BaseWfServiceTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void initialize() throws Exception {
|
||||
beforeTest();
|
||||
}
|
||||
|
||||
@After
|
||||
public void clean() throws Exception {
|
||||
afterTest();
|
||||
}
|
||||
|
||||
protected void beforeTest() throws Exception{
|
||||
|
||||
}
|
||||
|
||||
protected void afterTest() throws Exception{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*public void setUp() throws Exception {
|
||||
if (identityService.createUserQuery().userId("fozzie").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("fozzie"));
|
||||
}
|
||||
if (identityService.createUserQuery().userId("kermit").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("kermit"));
|
||||
}
|
||||
if (identityService.createUserQuery().userId("gonzo").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("gonzo"));
|
||||
}
|
||||
|
||||
if (identityService.createGroupQuery().groupId("accountancy")
|
||||
.singleResult() == null) {
|
||||
identityService.saveGroup(identityService.newGroup("accountancy"));
|
||||
}
|
||||
if (identityService.createGroupQuery().groupId("management")
|
||||
.singleResult() == null) {
|
||||
identityService.saveGroup(identityService.newGroup("management"));
|
||||
}
|
||||
|
||||
User user1 = identityService.createUserQuery()
|
||||
.memberOfGroup("management").singleResult();
|
||||
if (user1 == null || !"kermit".equals(user1.getId())) {
|
||||
identityService.createMembership("kermit", "management");
|
||||
}
|
||||
User user2 = identityService.createUserQuery()
|
||||
.memberOfGroup("accountancy").singleResult();
|
||||
if (user2 == null || !"fozzie".equals(user2.getId())) {
|
||||
identityService.createMembership("fozzie", "accountancy");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
identityService.deleteUser("fozzie");
|
||||
identityService.deleteUser("kermit");
|
||||
identityService.deleteUser("gonzo");
|
||||
identityService.deleteGroup("accountancy");
|
||||
identityService.deleteGroup("management");
|
||||
identityService.deleteMembership("fozzie", "accountancy");
|
||||
identityService.deleteMembership("kermit", "management");
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.ebpm.engine.config.service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
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.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ActivityInfoConfigManagerTest extends BaseManagerTestCase {
|
||||
@Autowired
|
||||
ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Test
|
||||
public void findActivityOperatePower(){
|
||||
List list=activityInfoConfigManager.findActivityOperatePower("cbCompanySend:1:27620", "zb_deptLeader_sh");
|
||||
System.out.println(list);
|
||||
}
|
||||
@Test
|
||||
public void addActivityOperatePower(){
|
||||
List addOpids=new ArrayList();
|
||||
addOpids.add("CREATE_DOCUMENT_BUTTON");
|
||||
boolean isAdd=activityInfoConfigManager.addActivityOperatePower(addOpids,"cbCompanySend:1:27620", "createDoc");
|
||||
System.out.println(isAdd);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeActivityOperatePower(){
|
||||
List delOpids=new ArrayList();
|
||||
delOpids.add("CREATE_DOCUMENT_BUTTON");
|
||||
boolean isDel=activityInfoConfigManager.removeActivityOperatePower(delOpids,"cbCompanySend:1:27620", "createDoc");
|
||||
System.out.println(isDel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.blueland.ebpm.engine.config.service;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
import com.blueland.bpm.engine.config.service.ActivityOperatePowerManager;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityOperatePower;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ActivityOperatePowerManagerTest extends BaseManagerTestCase {
|
||||
|
||||
private ActivityOperatePowerManager manager;
|
||||
|
||||
@Autowired
|
||||
public void setActivityOperatePowerManager(ActivityOperatePowerManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
//数据库单元测试前会开始事务,结束时会回滚事务,所以测试方法可以不用关心测试数据的删除
|
||||
@Test
|
||||
public void crud() {
|
||||
|
||||
ActivityOperatePower obj = newActivityOperatePower();
|
||||
manager.save(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
manager.update(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
assertNotNull(obj.getOpId());
|
||||
|
||||
manager.removeById(obj.getOpId());
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
}
|
||||
|
||||
public static ActivityOperatePower newActivityOperatePower() {
|
||||
ActivityOperatePower obj = new ActivityOperatePower();
|
||||
|
||||
obj.setOpName(new String("1"));
|
||||
obj.setOpParentId(new String("1"));
|
||||
obj.setOpType(new String("1"));
|
||||
obj.setOpSort(new Integer("1"));
|
||||
obj.setOpScope(new String("1"));
|
||||
obj.setOpClassPath(new String("1"));
|
||||
obj.setOpRemark(new String("1"));
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.blueland.ebpm.engine.config.service;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
import com.blueland.bpm.engine.config.service.ActivityRuleManager;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityRule;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ActivityRuleManagerTest extends BaseManagerTestCase {
|
||||
|
||||
private ActivityRuleManager manager;
|
||||
|
||||
@Autowired
|
||||
public void setActivityRuleManager(ActivityRuleManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
//数据库单元测试前会开始事务,结束时会回滚事务,所以测试方法可以不用关心测试数据的删除
|
||||
@Test
|
||||
public void crud() {
|
||||
|
||||
ActivityRule obj = newActivityRule();
|
||||
manager.save(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
manager.update(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
assertNotNull(obj.getRuleId());
|
||||
|
||||
manager.removeById(obj.getRuleId());
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
}
|
||||
|
||||
public static ActivityRule newActivityRule() {
|
||||
ActivityRule obj = new ActivityRule();
|
||||
obj.setRuleId(java.util.UUID.randomUUID().toString());
|
||||
obj.setRuleName(new String("1"));
|
||||
obj.setProcDefId(new String("1"));
|
||||
obj.setSourceActId(new String("1"));
|
||||
obj.setTargetActId(new String("1"));
|
||||
obj.setRuleScript(new String("1"));
|
||||
obj.setRulePriority(new Integer("1"));
|
||||
obj.setRuleRemark(new String("1"));
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.blueland.ebpm.engine.config.service;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
import com.blueland.bpm.engine.config.service.GloblBizProcessHandlerManager;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.GloblBizProcessHandler;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class GloblBizProcessHandlerManagerTest extends BaseManagerTestCase {
|
||||
|
||||
private GloblBizProcessHandlerManager manager;
|
||||
|
||||
@Autowired
|
||||
public void setGloblBizProcessHandlerManager(GloblBizProcessHandlerManager manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
//数据库单元测试前会开始事务,结束时会回滚事务,所以测试方法可以不用关心测试数据的删除
|
||||
@Test
|
||||
public void crud() {
|
||||
|
||||
GloblBizProcessHandler obj = newGloblBizProcessHandler();
|
||||
manager.save(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
manager.update(obj);
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
assertNotNull(obj.getGbphId());
|
||||
|
||||
manager.removeById(obj.getGbphId());
|
||||
//manager.getEntityDao().flush();
|
||||
|
||||
}
|
||||
|
||||
public static GloblBizProcessHandler newGloblBizProcessHandler() {
|
||||
GloblBizProcessHandler obj = new GloblBizProcessHandler();
|
||||
obj.setGbphId(java.util.UUID.randomUUID().toString());
|
||||
obj.setGbphName(new String("1"));
|
||||
obj.setGbphType(new String("1"));
|
||||
obj.setGbphSort(new Integer("1"));
|
||||
obj.setGbphStatus(new String("1"));
|
||||
obj.setGbphClassName(new String("1"));
|
||||
obj.setGbphRemark(new String("1"));
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.ebpm.engine.config.service;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessInfoConfigManagerTest extends BaseManagerTestCase {
|
||||
@Autowired
|
||||
ProcessInfoConfigManager processInfoConfigManager;
|
||||
|
||||
@Test
|
||||
public void testGetById(){
|
||||
processInfoConfigManager.getById("my-leave-manual:1:7708");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveOrUpdate(){
|
||||
ProcessInfoConfig processInfoConfig=processInfoConfigManager.getById("my-leave-manual:1:7708");
|
||||
processInfoConfigManager.saveOrUpdate(processInfoConfig);
|
||||
processInfoConfig.setProcessPageUrl("ssssss");
|
||||
processInfoConfigManager.saveOrUpdate(processInfoConfig);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions id="definitions"
|
||||
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
|
||||
xmlns:activiti="http://activiti.org/bpmn"
|
||||
targetNamespace="Examples">
|
||||
|
||||
<process id="asyncCallActivityMultiInstancerServiceTask">
|
||||
|
||||
<startEvent id="theStart" />
|
||||
|
||||
<callActivity id="callActivity" calledElement="simpleServiceTask"
|
||||
name="CallActivity with One MultiInstance Task" activiti:async="true">
|
||||
<multiInstanceLoopCharacteristics isSequential="false">
|
||||
<loopCardinality>4</loopCardinality>
|
||||
</multiInstanceLoopCharacteristics>
|
||||
</callActivity>
|
||||
|
||||
<parallelGateway id="fork" name="fork"/>
|
||||
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="fork" />
|
||||
<sequenceFlow id="flow2" sourceRef="fork" targetRef="callActivity" />
|
||||
<parallelGateway id="join" name="join"/>
|
||||
<sequenceFlow id="flow3" sourceRef="fork" targetRef="join" />
|
||||
<sequenceFlow id="flow4" sourceRef="callActivity" targetRef="join" />
|
||||
<sequenceFlow id="flow5" sourceRef="join" targetRef="theEnd" />
|
||||
<endEvent id="theEnd" />
|
||||
|
||||
</process>
|
||||
|
||||
</definitions>
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.blueland.ebpm.engine.core.handler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.handler.BizProcessHandler;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityResourceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
|
||||
|
||||
public class TestBizProcessHandler implements BizProcessHandler {
|
||||
|
||||
@Override
|
||||
public void submitProcessAfter(ProcessInstanceModel processInstanceModel) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitProcessBefore(ProcessInputModel processInputModel) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filterNextStepUserTree(
|
||||
List<ActivityResourceModel> activityResources,
|
||||
ProcessInstanceModel processInstanceModel, String userId,
|
||||
Map<String, Object> fieldsMap) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filterNextStep(
|
||||
List<ActivityDefinitionModel> activityDefinitionModel,
|
||||
ProcessInstanceModel processInstanceModel,
|
||||
Map<String, Object> fieldsMap) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.ebpm.engine.core.power;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessPageContext;
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class AllActivityOperatePowerTest extends BaseManagerTestCase {
|
||||
@Autowired
|
||||
ProcessConfigService processConfigService;
|
||||
@Autowired
|
||||
ProcessInstanceService processInstanceService;
|
||||
|
||||
@Test
|
||||
public void testCallPrevButBut() {// 退回上一步
|
||||
Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
String curUserId = "gaof0709";
|
||||
String curUserOrgId = "204300015350";
|
||||
String curProcInstId = "fcd3f132-04e8-11e5-b040-68f72803f161";
|
||||
String curActInstId = "fcdb443c-04e8-11e5-b040-68f72803f161";
|
||||
ProcessPageContext processPageContext = new ProcessPageContext(
|
||||
WorkFlowContants.TODO_OPEN_PAGE_TYPE,
|
||||
WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY, "", curUserId,
|
||||
curUserOrgId);
|
||||
HistoricProcessInstanceEntity processInstance = (HistoricProcessInstanceEntity) processInstanceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(curProcInstId).singleResult();
|
||||
ActivityInstanceModel task = processInstanceService
|
||||
.getTask(curActInstId);
|
||||
pageDetailVaribale.put("processInstance", processInstance);
|
||||
pageDetailVaribale.put("task", task);
|
||||
pageDetailVaribale.put("processPageContext", processPageContext);
|
||||
//判断按钮是否有权限
|
||||
boolean result=processConfigService.hasActivityButOperatePower("BACK_PREV_ACT_BTN",
|
||||
pageDetailVaribale);
|
||||
//新建暂时时的起草环节无法退回上一步
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallStartBut() {// 退回起草
|
||||
Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
String curProcInstId = "799f18da-0825-11e5-8f2b-68f72803f161";
|
||||
String curActInstId = "79f37a88-0825-11e5-8f2b-68f72803f161";
|
||||
HistoricProcessInstanceEntity processInstance = (HistoricProcessInstanceEntity) processInstanceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(curProcInstId).singleResult();
|
||||
ActivityInstanceModel task = processInstanceService
|
||||
.getTask(curActInstId);
|
||||
pageDetailVaribale.put("processInstance", processInstance);
|
||||
pageDetailVaribale.put("task", task);
|
||||
//判断按钮是否有权限
|
||||
boolean result=processConfigService.hasActivityButOperatePower("BACK_PREV_ACT_BTN",
|
||||
pageDetailVaribale);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCancelBut() {// 作废
|
||||
Map<String, Object> pageDetailVaribale = new HashMap<String, Object>();
|
||||
String curProcInstId = "799f18da-0825-11e5-8f2b-68f72803f161";
|
||||
String curActInstId = "79f37a88-0825-11e5-8f2b-68f72803f161";
|
||||
HistoricProcessInstanceEntity processInstance = (HistoricProcessInstanceEntity) processInstanceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(curProcInstId).singleResult();
|
||||
ActivityInstanceModel task = processInstanceService
|
||||
.getTask(curActInstId);
|
||||
pageDetailVaribale.put("processInstance", processInstance);
|
||||
pageDetailVaribale.put("task", task);
|
||||
//判断按钮是否有权限
|
||||
boolean result=processConfigService.hasActivityButOperatePower("BACK_PREV_ACT_BTN",
|
||||
pageDetailVaribale);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.ebpm.engine.core.script;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.impl.el.ExpressionManager;
|
||||
import org.activiti.engine.impl.javax.el.ELContext;
|
||||
import org.activiti.engine.impl.javax.el.ExpressionFactory;
|
||||
import org.activiti.engine.impl.juel.ExpressionFactoryImpl;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.common.util.ApplicationContextHolder;
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
import com.blueland.bpm.engine.core.model.BusinessDataObject;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.service.GroovyScriptEngine;
|
||||
import com.blueland.bpm.engine.util.ActivityTranstionDelegateExecution;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import com.blueland.bpm.identity.service.UserServiceImpl;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class GroovyScriptEngineTest extends BaseManagerTestCase {
|
||||
@Autowired
|
||||
GroovyScriptEngine groovyScriptEngine;
|
||||
UserServiceImpl userServiceImpl;
|
||||
|
||||
@Test
|
||||
public void testexecute() {
|
||||
Map params = new HashMap();
|
||||
params.put("prince","2000");
|
||||
groovyScriptEngine.execute(
|
||||
"return Integer.parseInt(prince)<1000", params);
|
||||
}
|
||||
@Test
|
||||
public void testexecutes() {
|
||||
Map params = new HashMap();
|
||||
params.put("prince","2000");
|
||||
System.out.println(groovyScriptEngine.executeString(
|
||||
"return true;", params));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testexecute1() {
|
||||
Map params = new HashMap();
|
||||
params.put("wf_sender", "gaof0709");
|
||||
System.out.println(groovyScriptEngine.executeBoolean(
|
||||
"return wf_sender=='gaof0709'", params));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testexecute4() {
|
||||
Map params = new HashMap();
|
||||
params.put("a","4");
|
||||
System.out.println(groovyScriptEngine.executeBoolean(
|
||||
"return Integer.parseInt(a)<7", params));
|
||||
}
|
||||
@Test
|
||||
public void testexecute2() {
|
||||
List<ProcessInputModel> processInputModels = new ArrayList<ProcessInputModel>();
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_appId("STDD_SYS");
|
||||
communicate
|
||||
.setWf_procTitle("自动化模拟测试流程:test_wait_task20150714-11:08:23");
|
||||
communicate.setWf_procInstId("986162a3-29d5-11e5-b8f3-68f72803f161");
|
||||
communicate
|
||||
.setWf_curActDefId("sid-393FB09C-32D8-4FAA-97B0-8BF779BFCFDB");
|
||||
communicate
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_SIGNAL_RECEIVE_ACTIVITY);
|
||||
BusinessDataObject businessDataObject = new BusinessDataObject();
|
||||
businessDataObject.setBizData("2");
|
||||
businessDataObject.setObjectType("aa");
|
||||
communicate.setWf_businessDataObject(businessDataObject);
|
||||
|
||||
Map fieldsMap = new HashMap();
|
||||
fieldsMap.put("leaveDay", "2");
|
||||
communicate.setFields(fieldsMap);
|
||||
ProcessInputModel communicate2 = new ProcessInputModel();
|
||||
// communicate.setFields(fieldsMap);
|
||||
communicate2.setWf_procDefId("my-leave-manual:2:19004");
|
||||
communicate2.setWf_procTitle("1");
|
||||
communicate2.setWf_procInstId("19101");
|
||||
communicate2.setWf_curActInstId("19905");
|
||||
communicate2.setWf_curActDefId("deptLeader_sp");
|
||||
BusinessDataObject businessDataObject2 = new BusinessDataObject();
|
||||
businessDataObject.setBizData("1");
|
||||
businessDataObject.setObjectType("aa");
|
||||
communicate2.setWf_businessDataObject(businessDataObject2);
|
||||
|
||||
Map fieldsMap2 = new HashMap();
|
||||
fieldsMap2.put("leaveDay", "1");
|
||||
communicate2.setFields(fieldsMap2);
|
||||
|
||||
ProcessInputModel communicate3 = new ProcessInputModel();
|
||||
// communicate.setFields(fieldsMap);
|
||||
communicate3.setWf_procDefId("my-leave-manual:2:19004");
|
||||
communicate3.setWf_procTitle("1");
|
||||
communicate3.setWf_procInstId("19101");
|
||||
communicate3.setWf_curActInstId("19905");
|
||||
communicate3.setWf_curActDefId("deptLeader_sp");
|
||||
BusinessDataObject businessDataObject3 = new BusinessDataObject();
|
||||
businessDataObject.setBizData("1");
|
||||
businessDataObject.setObjectType("aa");
|
||||
communicate3.setWf_businessDataObject(businessDataObject3);
|
||||
Map fieldsMap3 = new HashMap();
|
||||
fieldsMap3.put("leaveDay", "1");
|
||||
communicate3.setFields(fieldsMap2);
|
||||
processInputModels.add(communicate);
|
||||
processInputModels.add(communicate2);
|
||||
processInputModels.add(communicate3);
|
||||
Map<String, Object> filterVariables = new HashMap<String, Object>();
|
||||
filterVariables.put("processInputModels", processInputModels);
|
||||
String script = "int count=0;for(int i=0;i<processInputModels.size();i++)"
|
||||
+ "{"
|
||||
+ "com.blueland.bpm.engine.core.model.ProcessInputModel processInputModel=processInputModels.get(i);"
|
||||
+ "Map<String,Object> bizDataMap=processInputModel.getFields();"
|
||||
+ "String leaveDay=(String)bizDataMap.get('leaveDay');"
|
||||
+ "int day=Integer.parseInt(leaveDay);"
|
||||
+ "count+=day;"
|
||||
+ "System.out.println(day);"
|
||||
+ "};"
|
||||
+ "System.out.println(count);if(count>3){return true;}else{return false;}";
|
||||
boolean result = groovyScriptEngine.executeBoolean(script,
|
||||
filterVariables);
|
||||
System.out.println(script);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJuel() {
|
||||
Map<Object, Object> beans = new HashMap<Object, Object>();
|
||||
String[] beanNames = ApplicationContextHolder.getApplicationContext()
|
||||
.getBeanDefinitionNames();
|
||||
for (String beanName : beanNames) {
|
||||
beans.put(beanName, ApplicationContextHolder
|
||||
.getApplicationContext().getBean(beanName));
|
||||
}
|
||||
System.out.println(beans);
|
||||
String conditionText = "return startUser=='gaof0709'";
|
||||
Map conditionMap = new HashMap();
|
||||
conditionMap.put("startUser", "gaof0709");
|
||||
ExpressionManager expressionManager = new ExpressionManager(beans);
|
||||
|
||||
ActivityTranstionDelegateExecution atde = new ActivityTranstionDelegateExecution(
|
||||
conditionMap, null);
|
||||
ELContext elContext = expressionManager.getElContext(atde);
|
||||
ExpressionFactory expressionFactory = new ExpressionFactoryImpl();
|
||||
org.activiti.engine.impl.javax.el.ValueExpression valueExpression = expressionFactory
|
||||
.createValueExpression(elContext, conditionText.trim(),
|
||||
Object.class);
|
||||
Object obj = valueExpression.getValue(elContext);
|
||||
System.out.println(obj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.AutoRunOneProcess;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.util.JsonUtil;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class AutoRunOneProcessTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
AutoRunOneProcess autoRunOneProcess;
|
||||
@Autowired
|
||||
private ProcessExecuteService processExecuteService;
|
||||
// test_pt普通流程,test_expall 测试条件网关,testparentflow,测试父子流程,testParallelGateway:测试并行网关啊,test_neiqiansubflow内嵌子流程,testparentflow 测试父子流程
|
||||
String procDefKey = "testparentflow";
|
||||
|
||||
@Test
|
||||
public void testOneProcess() {
|
||||
//autoRunOneProcess.autoRunOneProcess(procDefKey);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByJson(){
|
||||
ProcessInputModel processInputModel=(com.blueland.bpm.engine.core.model.ProcessInputModel) JsonUtil.convertToBean("{\"wf_appId\":\"STDD_SYS\",\"wf_procTitle\":\"测试父子流程d3\",\"wf_actionType\":\"execute_activity\",\"wf_procDefId\":\"testsubhree:1:b979b544-ff82-11e4-9da0-68f72803f161\",\"wf_procDefKey\":\"testsubhree\",\"wf_procDefName\":\"三级子流程\",\"wf_procInstId\":\"e6556b13-7cc4-11e5-8ffd-68f72803f161\",\"wf_parentProcInstId\":null,\"wf_curActDefId\":\"sid-C07158C8-60A0-4EDA-B5B8-026857274885\",\"wf_curActDefType\":null,\"wf_curActDefName\":\"3级普通环节2\",\"wf_curActInstId\":\"44e38179-7cc5-11e5-9e91-68f72803f161\",\"wf_curActInstName\":null,\"wf_nextActDefId\":\"\",\"wf_nextActDefName\":\"\",\"wf_nextActDefType\":\"\",\"wf_preActSender\":\"huangj0222\",\"wf_sendUserId\":\"yangzhm0819\",\"wf_sender\":null,\"wf_sendUserName\":null,\"wf_sendUserOrgId\":\"2043000101\",\"wf_sendUserOrgName\":null,\"wf_sendUserCompanyId\":null,\"wf_receivers\":null,\"wf_receiver\":null,\"wf_pageDealTime\":null,\"wf_fields\":\"<fields><bizData>测试父子流程d3</bizData><createUserId></createUserId><createUserName></createUserName><isAgreeVal></isAgreeVal><leaveDay>测试父子流程d3</leaveDay><leaveReason>测试父子流程d3</leaveReason><leaveType>0</leaveType><startDate>测试父子流程d3</startDate><throughbizData>测试父子流程d3</throughbizData></fields>\",\"wf_variables\":{},\"fields\":{\"bizData\":\"测试父子流程d3\",\"createUserId\":\"\",\"createUserName\":\"\",\"isAgreeVal\":\"\",\"leaveDay\":\"测试父子流程d3\",\"leaveReason\":\"测试父子流程d3\",\"leaveType\":\"0\",\"startDate\":\"测试父子流程d3\",\"throughbizData\":\"测试父子流程d3\"},\"wf_attachments\":\"\",\"wf_curComment\":\"\",\"wf_batchId\":null,\"wf_commentDisplayArea\":\"\",\"wf_businessKey\":\"ba700491-9304-49c3-9e19-58bed2939b12\",\"wf_businessDataObject\":{\"objectType\":null,\"bizData\":\"测试父子流程d3\"},\"wf_throughBizDataObject\":{\"objectType\":null,\"bizData\":\"测试父子流程d3\"},\"wf_uniteworkUrl\":null,\"wf_actLimitTime\":0}", ProcessInputModel.class);
|
||||
processExecuteService.nextExecute(processInputModel);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.BizProcessHandlerFactory;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class BizProcessHandlerFactoryTest extends BaseWfServiceTest {
|
||||
|
||||
@Autowired
|
||||
BizProcessHandlerFactory bizProcessHandlerFactory;
|
||||
@Test
|
||||
public void test() {
|
||||
bizProcessHandlerFactory.buildBussinessProcessHandler("contract_talks_sp:3:24604");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeTest() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterTest() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class LeaveTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
private ProcessExecuteService processExecuteService;
|
||||
|
||||
@Test
|
||||
public void testLeve(){
|
||||
ProcessInputModel wfCommunicate1=getStrartMap();
|
||||
processExecuteService.nextExecute(wfCommunicate1);
|
||||
|
||||
/*ProcessInputModel wfCommunicate2=getDeptLeaderSpMap();
|
||||
wfCommunicate2.setWf_procInstId("21301");
|
||||
wfCommunicate2.setWf_curActInstId("21310");
|
||||
processExecuteService.nextExecute(wfCommunicate2);*/
|
||||
|
||||
|
||||
}
|
||||
private ProcessInputModel getStrartMap(){
|
||||
Map fieldsMap=new HashMap();
|
||||
fieldsMap.put("userId", "1w");
|
||||
fieldsMap.put("userName", "龙文");
|
||||
ProcessInputModel communicate=new ProcessInputModel();
|
||||
communicate.setWf_procTitle("测试请假流程1");
|
||||
communicate.setWf_procDefId("my-leave-manual:3:21104");
|
||||
communicate.setWf_procDefKey("my-leave");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
communicate.setWf_nextActDefId("zgLeader_sp");
|
||||
communicate.setWf_sender("longwen");
|
||||
communicate.setWf_receiver("zhuguanlingdao");
|
||||
communicate.setFields(fieldsMap);
|
||||
return communicate;
|
||||
}
|
||||
|
||||
private ProcessInputModel getDeptLeaderSpMap(){
|
||||
ProcessInputModel communicate=new ProcessInputModel();
|
||||
communicate.setWf_procTitle("测试请假流程1");
|
||||
communicate.setWf_procDefId("my-leave-manual:3:21104");
|
||||
communicate.setWf_procDefKey("my-leave");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY);
|
||||
communicate.setWf_curActDefId("zgLeader_sp");
|
||||
communicate.setWf_nextActDefId("sg_dept_nb_sp");
|
||||
communicate.setWf_sender("zhuguanlingdao");
|
||||
communicate.setWf_receiver("longwen");
|
||||
return communicate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ManualTransitionTest extends BaseWfServiceTest {
|
||||
|
||||
//@Deployment(resources = { "com/xsl/oa/com.blueland.bpm.engine/list/service/manual_transition.bpmn20.xml" })
|
||||
@Test
|
||||
public void testProcess() {
|
||||
this.identityService.setAuthenticatedUserId("longwen");
|
||||
ProcessInstance processInstance = this.runtimeService
|
||||
.startProcessInstanceByKey("process");
|
||||
|
||||
Assert.assertNotNull(processInstance);
|
||||
List<Task> task = this.taskService.createTaskQuery()
|
||||
.taskAssignee("kermit").list();
|
||||
this.taskService.complete(task.get(0).getId());
|
||||
List<Task> tas1 = this.taskService.createTaskQuery().taskAssignee("lw")
|
||||
.list();
|
||||
Map params = new HashMap();
|
||||
params.put("select", "act1");
|
||||
this.taskService.complete(tas1.get(0).getId(), "",params);
|
||||
/*
|
||||
* try { turnTransition(tas1.get(0).getId(),"act1",null); } catch
|
||||
* (Exception e) { // TODO Auto-generated catch block
|
||||
* e.printStackTrace(); }
|
||||
*/
|
||||
List<Task> task2 = this.taskService.createTaskQuery()
|
||||
.taskAssignee("kermit").list();
|
||||
if (task2 == null || task2.isEmpty()) {
|
||||
task2 = this.taskService.createTaskQuery().taskAssignee("fozzie")
|
||||
.list();
|
||||
Assert.assertEquals("act2", task2.get(0).getTaskDefinitionKey());
|
||||
} else {
|
||||
Assert.assertEquals("act1", task2.get(0).getTaskDefinitionKey());
|
||||
}
|
||||
this.taskService.complete(task2.get(0).getId());
|
||||
List<HistoricProcessInstance> historicProcessInstance = this.historyService
|
||||
.createHistoricProcessInstanceQuery().startedBy("longwen").finished().orderByProcessInstanceStartTime().desc().list();
|
||||
Assert.assertEquals(1, historicProcessInstance.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcess1() {
|
||||
Task task = this.taskService.createTaskQuery().taskId("").includeProcessVariables().singleResult();
|
||||
this.taskService.complete(task.getId(),"",task.getProcessVariables());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeTest() throws Exception {
|
||||
/* Deployment deployment = repositoryService.createDeployment().addClasspathResource("com/xsl/oa/com.blueland.bpm.engine/list/service/manual_transition.bpmn20.xml").deploy();
|
||||
deploymentId = deployment.getId(); */
|
||||
|
||||
/*if (identityService.createUserQuery().userId("fozzie").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("fozzie"));
|
||||
}
|
||||
if (identityService.createUserQuery().userId("kermit").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("kermit"));
|
||||
}
|
||||
if (identityService.createUserQuery().userId("gonzo").singleResult() == null) {
|
||||
identityService.saveUser(identityService.newUser("gonzo"));
|
||||
}
|
||||
|
||||
if (identityService.createGroupQuery().groupId("accountancy")
|
||||
.singleResult() == null) {
|
||||
identityService.saveGroup(identityService.newGroup("accountancy"));
|
||||
}
|
||||
if (identityService.createGroupQuery().groupId("management")
|
||||
.singleResult() == null) {
|
||||
identityService.saveGroup(identityService.newGroup("management"));
|
||||
}*/
|
||||
/*
|
||||
UserEntity user1 = identityService.createUserQuery()
|
||||
.memberOfGroup("management").singleResult();
|
||||
if (user1 == null || !"kermit".equals(user1.getId())) {
|
||||
identityService.createMembership("kermit", "management");
|
||||
}
|
||||
UserEntity user2 = identityService.createUserQuery()
|
||||
.memberOfGroup("accountancy").singleResult();
|
||||
if (user2 == null || !"fozzie".equals(user2.getId())) {
|
||||
identityService.createMembership("fozzie", "accountancy");
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterTest() throws Exception {
|
||||
//repositoryService.deleteDeployment(deploymentId, true);
|
||||
/*identityService.deleteUser("fozzie");
|
||||
identityService.deleteUser("kermit");
|
||||
identityService.deleteUser("gonzo");
|
||||
identityService.deleteGroup("accountancy");
|
||||
identityService.deleteGroup("management");*/
|
||||
//identityService.deleteMembership("fozzie", "accountancy");
|
||||
//identityService.deleteMembership("kermit", "management");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.Depute;
|
||||
import com.blueland.bpm.engine.config.service.DeputeManager;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class OtherOperateTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
DeputeManager deputeManager;
|
||||
|
||||
@Test
|
||||
public void testUserProcessDepute() {
|
||||
Depute depute=deputeManager.getUserProcessDepute("czadmin", "", "DEMO_SYS");
|
||||
System.out.println(depute);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessConfigService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* 流程管理配置Service
|
||||
* @version: 1.0
|
||||
* @author lw
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessConfigServiceTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
ProcessConfigService processConfigServiceImpl;
|
||||
@Test
|
||||
public void getWorkflowPage(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void findProcessInfoConfigs(){
|
||||
|
||||
}
|
||||
@Test
|
||||
public void exportAllRoleData() {
|
||||
ByteArrayOutputStream byteArrayOutputStream=processConfigServiceImpl.exportAllRoleData("DEMO_SYS");
|
||||
System.out.println(new String(byteArrayOutputStream.toByteArray()));
|
||||
processConfigServiceImpl.importAllRoleData(new String(byteArrayOutputStream.toByteArray()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getActivityInfoConfig() {
|
||||
ActivityInfoConfig activityInfoConfig=processConfigServiceImpl.getActivityInfoConfig("cbCompanySend:1:26616", "usertask2", "2",new HashMap());
|
||||
System.out.println(activityInfoConfig);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
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.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessDefinitionResourceTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
protected ProcessDefinitionService processDefinitionService;
|
||||
@Test
|
||||
public void testGetActivityUserTree() {
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testGetNextActivity() {
|
||||
|
||||
}
|
||||
|
||||
public void testGetPrevActivity(){
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testGetResource() {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMultiActivity() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.engine.impl.context.Context;
|
||||
import org.activiti.engine.impl.interceptor.CommandContextFactory;
|
||||
import org.activiti.engine.impl.persistence.deploy.DeploymentManager;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.util.io.InputStreamSource;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityResourceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessDefinitionServiceTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
protected ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Test
|
||||
public void getProcessDefBykey() {
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDefBykey("Process_09UZD436");
|
||||
System.out.println(processDefinition);
|
||||
}
|
||||
|
||||
|
||||
//@Test
|
||||
public void getStartActivity() {
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDefBykey("PROCESS_1");
|
||||
ActivityDefinitionModel pvmActivity=processDefinitionService.getStartActivity(processDefinition.getProcDefId());
|
||||
System.out.println(processDefinition);
|
||||
}
|
||||
@Test
|
||||
public void getNextActivity() {
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDef("test2:1:f59e5263-862e-11e6-a6eb-005056b607a7");
|
||||
Map conditionMap=new HashMap();
|
||||
conditionMap.put("ACCESSORY_TYPE", "21201");
|
||||
List pvmActivity=processDefinitionService.getNextActivity(null,processDefinition.getProcDefId(),"sid-136B5934-839E-4E3A-ADB8-B9D6A7FA7C80",conditionMap);
|
||||
System.out.println(pvmActivity);
|
||||
}
|
||||
@Test
|
||||
public void getActivityUserTree() {
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDef("my-leave-manual:3:21104");
|
||||
List<ActivityResourceModel> treeNode=processDefinitionService.getActivityUserTree("",processDefinition.getProcDefId(),null,"zgLeader_sp","sg_deptLeader_hq","","",null,null);
|
||||
System.out.println(treeNode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deploySingleProcess() throws Exception{
|
||||
processDefinitionService.deployFromClasspath("","cb_workdoc_file");
|
||||
|
||||
}
|
||||
//@Test
|
||||
public void updateDeploymentResource(){
|
||||
processDefinitionService.updateDeploymentResource("17201","process1:1:17204","<a>1</a><b>2</b>".getBytes(),false);
|
||||
}
|
||||
@Test
|
||||
public void immediateUpdateBpmnFile() throws IOException{
|
||||
ProcessDefinitionModel processDefinition=processDefinitionService.getProcessDefBykey("cbCompanySend");
|
||||
DeploymentManager deploymentManager=this.processEngineConfiguration
|
||||
.getDeploymentManager();
|
||||
|
||||
Context.setProcessEngineConfiguration(processEngineConfiguration);
|
||||
CommandContextFactory factory=new CommandContextFactory();
|
||||
factory.setProcessEngineConfiguration(processEngineConfiguration);
|
||||
Context.setCommandContext(factory.createCommandContext(null));
|
||||
ProcessDefinitionEntity pdfE=deploymentManager.findDeployedProcessDefinitionById(processDefinition.getProcDefId());
|
||||
|
||||
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("deployments/cbCompanySend.bpmn");
|
||||
byte[] updateBpmnByte=IOUtils.toByteArray(in);
|
||||
|
||||
ProcessDefinitionEntity pdfEntity=this.processEngineConfiguration
|
||||
.getDeploymentManager()
|
||||
.getProcessDefinitionCache().get(processDefinition.getProcDefId());
|
||||
processDefinitionService.updateDeploymentResource(processDefinition.getDeploymentId(),processDefinition.getProcDefId(),updateBpmnByte,false);
|
||||
this.processEngineConfiguration
|
||||
.getDeploymentManager()
|
||||
.getProcessDefinitionCache().remove(processDefinition.getProcDefId());
|
||||
}
|
||||
@Test
|
||||
public void testBpmnModel(){
|
||||
|
||||
InputStream in = processDefinitionService.loadProcessResource("my-leave-manual:7:25809", "xml");
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
|
||||
boolean enableSafeBpmnXml = false;
|
||||
if (Context.getProcessEngineConfiguration() != null) {
|
||||
enableSafeBpmnXml = Context.getProcessEngineConfiguration()
|
||||
.isEnableSafeBpmnXml();
|
||||
}
|
||||
BpmnModel bpmnModel = converter.convertToBpmnModel(
|
||||
new InputStreamSource(in), true, enableSafeBpmnXml);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void beforeTest() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterTest() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import org.junit.Assert;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.common.util.DateUtil;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ActivityReceiverModel;
|
||||
import com.blueland.bpm.engine.core.model.BusinessDataObject;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessExecuteServiceTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
private ProcessExecuteService processExecuteService;
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
public void addedProcessInputModel(ProcessInputModel communicate){
|
||||
ProcessDefinitionModel processDefinitionModel=processDefinitionService.getProcessDefBykey(communicate.getWf_procDefKey());
|
||||
communicate.setWf_appId(processDefinitionModel.getTenantId());
|
||||
communicate.setWf_procDefId(processDefinitionModel.getProcDefId());
|
||||
}
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void startProcess() {
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procDefKey("test_pt");
|
||||
communicate.setWf_curActDefId("nigao");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
communicate.setWf_uniteworkUrl("http");
|
||||
communicate.setWf_sendUserId("gaof0709");
|
||||
communicate.setWf_sendUserOrgId("204300015350");
|
||||
|
||||
ProcessDefinitionModel processDefinitionModel=processDefinitionService.getProcessDefBykey(communicate.getWf_procDefKey());
|
||||
communicate.setWf_procTitle("单元测试["+processDefinitionModel.getProcDefName()+"]"+DateUtil.getNowDate());
|
||||
communicate.setWf_appId(processDefinitionModel.getTenantId());
|
||||
communicate.setWf_procDefId(processDefinitionModel.getProcDefId());
|
||||
Map<String,Object> result=processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void startSubProcess() {
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procTitle("测试子流程传bizkey2");
|
||||
communicate.setWf_procDefId("testparentflow:1:83de1070-ff81-11e4-9da0-68f72803f161");
|
||||
communicate.setWf_procDefKey("testparentflow");
|
||||
communicate.setWf_curActDefId("sid-19F5D9E3-BBAD-4F8E-A0E7-5E74991EB19C");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
communicate.setWf_uniteworkUrl("http");
|
||||
communicate.setWf_sendUserId("gaof0709");
|
||||
communicate.setWf_sendUserOrgId("204300015350");
|
||||
List<ActivityReceiverModel> acts=new ArrayList<ActivityReceiverModel>();
|
||||
ActivityReceiverModel act1=new ActivityReceiverModel();
|
||||
act1.setReceiveUserId("gaof0709");
|
||||
act1.setReceiveUserOrgId("204300015350");
|
||||
act1.setSubBusinessKey("1");
|
||||
ActivityReceiverModel act2=new ActivityReceiverModel();
|
||||
act2.setReceiveUserId("zhangshl0215");
|
||||
act2.setReceiveUserOrgId("204300015552");
|
||||
act2.setSubBusinessKey("2");
|
||||
acts.add(act1);
|
||||
acts.add(act2);
|
||||
communicate.setWf_receivers(acts);
|
||||
|
||||
Map<String,Object> result=processExecuteService.nextExecute(communicate);
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
// @Test
|
||||
/**
|
||||
* 运行时暂存任务
|
||||
*/
|
||||
public void tempSaveTask() {
|
||||
Map fieldsMap = new HashMap();
|
||||
fieldsMap.put("userId", "1w111");
|
||||
fieldsMap.put("userName", "龙文1221");
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setFields(fieldsMap);
|
||||
communicate.setWf_curComment("我测试下暂存啊8999");
|
||||
communicate
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_SAVE_ACTIVITY);
|
||||
communicate.setWf_curActInstId("7710");
|
||||
communicate.setWf_sender("zhuguanlingdao");
|
||||
processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
|
||||
// @Test
|
||||
/**
|
||||
* 起草流程-直接暂存任务
|
||||
*/
|
||||
public void lauchTempSaveTask() {
|
||||
Map fieldsMap = new HashMap();
|
||||
fieldsMap.put("userId", "1w111");
|
||||
fieldsMap.put("userName", "龙文1221");
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procTitle("测试请假流程1");
|
||||
communicate.setWf_procDefId("my-leave-manual:1:15904");
|
||||
communicate.setWf_procDefKey("my-leave");
|
||||
communicate.setWf_sender("longwen");
|
||||
communicate.setFields(fieldsMap);
|
||||
communicate.setWf_curComment("我测试下新建暂存啊");
|
||||
communicate
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_SAVE_ACTIVITY);
|
||||
processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
|
||||
// @Test
|
||||
/**
|
||||
* 作废流程
|
||||
*/
|
||||
public void cancelProcess() {
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procTitle("测试请假流程1");
|
||||
communicate.setWf_procInstId("11901");
|
||||
communicate.setWf_curActInstId("11905");
|
||||
communicate
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_CANCEL_PROCESS);
|
||||
communicate.setWf_sender("longwen");
|
||||
processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 回撤流程
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void recallActivity() throws Exception {
|
||||
Map fieldsMap = new HashMap();
|
||||
fieldsMap.put("userId", "1w111");
|
||||
fieldsMap.put("userName", "龙文1221");
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setFields(fieldsMap);
|
||||
|
||||
communicate.setWf_procTitle("3df");
|
||||
communicate.setWf_procDefId("DEMO_SYS_MULTI:1:6fde0967-25ec-11e5-b07a-68f72803f161");
|
||||
communicate.setWf_procInstId("c185143e-b9a3-11e5-bc59-005056c00001");
|
||||
communicate.setWf_curActInstId("e682e026-b9a4-11e5-bc59-005056c00001");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_CALLBACK_PREV_ACTIVITY);
|
||||
communicate.setWf_sendUserOrgId("wugf1202");
|
||||
communicate.setWf_sendUserOrgId("204300012599");
|
||||
processExecuteService.nextExecute(communicate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 跳转任一没有连线的环节(必须是流程定义中存在的环节,当前环节与目标环节可以不存在连线)
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void rejectActivityExecutor() throws Exception {
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procDefId("test_pt:3:f20a5056-f9e0-11e4-9e7c-68f72803f161");
|
||||
communicate.setWf_procTitle("46ggg");
|
||||
communicate.setWf_procInstId("329b8702-23be-11e5-a759-68f72803f161");
|
||||
communicate.setWf_curActInstId("5ddbf4f7-23bf-11e5-a759-68f72803f161");
|
||||
communicate.setWf_curActDefId("deptsh");
|
||||
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_REJECT_ACTIVITY);
|
||||
communicate.setWf_nextActDefId("fgldsp");
|
||||
communicate.setWf_sendUserId("lidy0731");
|
||||
communicate.setWf_sendUserOrgId("204300015350");
|
||||
List activityReceiverModels=new ArrayList();
|
||||
ActivityReceiverModel activityReceiverModel=new ActivityReceiverModel();
|
||||
activityReceiverModel.setReceiveUserId("gaof0709");
|
||||
activityReceiverModel.setReceiveUserOrgId("204300015350");
|
||||
activityReceiverModels.add(activityReceiverModel);
|
||||
communicate.setWf_receivers(activityReceiverModels);
|
||||
processExecuteService.nextExecute(communicate);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 测试条件网关
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testConditionActivity() throws Exception {
|
||||
Map<String,Object> fieldsMap = new HashMap<String,Object>();
|
||||
fieldsMap.put("prince",2000);
|
||||
Map<String, Object> resultMap=start("test_expall",fieldsMap);
|
||||
ProcessInstanceModel processInstanceModel=(ProcessInstanceModel) resultMap.get("processInstanceModel");
|
||||
Assert.assertNotNull(processInstanceModel);
|
||||
Assert.assertEquals("分管领导审批", processInstanceModel.getNextActivity().get(0).getActDefName());
|
||||
resultMap=next(processInstanceModel.getNextActivity().get(0).getActInstId());
|
||||
processInstanceModel=(ProcessInstanceModel) resultMap.get("processInstanceModel");
|
||||
Assert.assertNotNull(processInstanceModel);
|
||||
Assert.assertNotNull(processInstanceModel.getFinishTime());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 测试等待任务
|
||||
*/
|
||||
public void testSignalReceiveTask() {
|
||||
Map<String, Object> resultMap=start("test_wait_task",null);
|
||||
ProcessInstanceModel processInstanceModel=(ProcessInstanceModel) resultMap.get("processInstanceModel");
|
||||
Assert.assertNotNull(processInstanceModel);
|
||||
|
||||
Map fieldsMap = new HashMap();
|
||||
fieldsMap.put("userId", "1w");
|
||||
fieldsMap.put("userName", "龙文");
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procTitle(processInstanceModel.getProcTitle());
|
||||
communicate.setWf_procInstId(processInstanceModel.getProcInstId());
|
||||
communicate.setWf_curActDefId("sid-393FB09C-32D8-4FAA-97B0-8BF779BFCFDB");
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_SIGNAL_RECEIVE_ACTIVITY);
|
||||
|
||||
communicate.setFields(fieldsMap);
|
||||
BusinessDataObject businessDataObject=new BusinessDataObject();
|
||||
businessDataObject.setBizData("123");
|
||||
businessDataObject.setObjectType("aa");
|
||||
communicate.setWf_businessDataObject(businessDataObject);
|
||||
List<ActivityReceiverModel> a=new ArrayList<ActivityReceiverModel>();
|
||||
ActivityReceiverModel activityReceiverModel=new ActivityReceiverModel();
|
||||
activityReceiverModel.setReceiveUserId("zhangshl0215");
|
||||
activityReceiverModel.setReceiveUserOrgId("204300015552");
|
||||
a.add(activityReceiverModel);
|
||||
communicate.setWf_receivers(a);
|
||||
resultMap=processExecuteService.nextExecute(communicate);
|
||||
List<ActivityInstanceModel> tasks = processInstanceService.getTopProcessAllTasks(communicate.getWf_procInstId());
|
||||
Assert.assertEquals(1, tasks.size());
|
||||
resultMap=next(tasks.get(0).getActInstId());
|
||||
processInstanceModel=(ProcessInstanceModel) resultMap.get("processInstanceModel");
|
||||
Assert.assertNotNull(processInstanceModel);
|
||||
Assert.assertNotNull(processInstanceModel.getFinishTime());
|
||||
}
|
||||
@Test
|
||||
/**
|
||||
* 跳转任一没有连线的环节(必须是流程定义中存在的环节,当前环节与目标环节可以不存在连线)
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void executeAnyNextActivity() throws Exception {
|
||||
next("6f4a4ed2-5073-11e5-90a0-68f72803f161");
|
||||
}
|
||||
|
||||
private Map<String, Object> next(String taskId) {
|
||||
ActivityInstanceModel task = processInstanceService.getTask(taskId);
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procTitle(task.getProcTitle());
|
||||
communicate.setWf_procInstId(task.getProcInstId());
|
||||
communicate.setWf_procDefId(task.getProcDefId());
|
||||
communicate.setWf_curActInstId(task.getActInstId());
|
||||
communicate.setWf_curActDefId(task.getActDefId());
|
||||
communicate.setWf_uniteworkUrl("http");
|
||||
communicate.setWf_sendUserId(task.getReceiverUserId());
|
||||
communicate.setWf_sendUserOrgId(task.getReceiverOrgId());
|
||||
communicate
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY);
|
||||
communicate.setWf_curComment("测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见测试超长意见");
|
||||
return processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> start(String procDefKey,Map fieldMap){
|
||||
ProcessInputModel communicate = new ProcessInputModel();
|
||||
communicate.setWf_procDefKey(procDefKey);
|
||||
communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
|
||||
communicate.setWf_uniteworkUrl("http");
|
||||
communicate.setWf_sendUserId("gaof0709");
|
||||
communicate.setWf_sendUserOrgId("204300015350");
|
||||
|
||||
ProcessDefinitionModel processDefinitionModel=processDefinitionService.getProcessDefBykey(communicate.getWf_procDefKey());
|
||||
ActivityDefinitionModel startAct=processDefinitionService.getStartActivity(processDefinitionModel.getProcDefId());
|
||||
communicate.setWf_curActDefId(startAct.getActDefId());
|
||||
|
||||
communicate.setWf_procTitle("单元测试["+processDefinitionModel.getProcDefName()+"]"+DateUtil.convertDateToString("yyyyMMddHHmmss", new Date()));
|
||||
communicate.setWf_appId(processDefinitionModel.getTenantId());
|
||||
communicate.setWf_procDefId(processDefinitionModel.getProcDefId());
|
||||
communicate.setFields(fieldMap);
|
||||
return processExecuteService.nextExecute(communicate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.Execution;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessInstanceServiceTest extends BaseWfServiceTest {
|
||||
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getThroughBizAppProcess() {
|
||||
List<ProcessInstanceModel> processInstanceModels=processInstanceService.getThroughBizAppProcess("ebae6f07-0e83-11e5-99a8-68f72803f161");
|
||||
System.out.println(processInstanceModels);
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getAllThroughBizAppProcess() {
|
||||
List<ProcessInstanceModel> processInstanceModels=processInstanceService.getAllThroughBizAppProcess("STDD_SYS");
|
||||
System.out.println(processInstanceModels);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getProcessTasksByTopId() {
|
||||
List<Task> processInstanceModels=processInstanceService.getProcessTasksByTopId("8a1cb8f9-0050-11e5-88fe-68f72803f161", "gaof0709", "");
|
||||
System.out.println(processInstanceModels);
|
||||
}
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void signal() {
|
||||
Execution execution = runtimeService.createExecutionQuery()
|
||||
.processInstanceId("e7f6fdee-1587-11e5-8d5a-68f72803f161")
|
||||
.activityId("sid-393FB09C-32D8-4FAA-97B0-8BF779BFCFDB")
|
||||
.singleResult();
|
||||
runtimeService.signal(execution.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getTaskEntity() {
|
||||
ActivityInstanceModel taskEntity=processInstanceService.getTask("d69af11d-aa8a-11ec-aba6-0242ac11000a");
|
||||
ProcessInstance processInstance=processInstanceService.getRuntimeService().createProcessInstanceQuery().processInstanceId(taskEntity.getProcInstId()).singleResult();
|
||||
ProcessDefinition processDefinition=this.repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getProcessFieldVariable() {
|
||||
processInstanceService.getProcessFieldVariable("4747152f-1b12-11e5-9846-68f72803f161");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getBusinessDataObject() {
|
||||
processInstanceService.getBusinessDataObject("deafce2f-10d5-11e5-9f50-68f72803f161");
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void getProcessFieldVariableByFinished() {
|
||||
processInstanceService.getProcessFieldVariableByFinished("0bd06a5d-1590-11e5-8a3c-68f72803f161");
|
||||
}
|
||||
|
||||
@Test
|
||||
/**
|
||||
* 起草流程
|
||||
*/
|
||||
public void findBackAvtivity() {
|
||||
System.out.println(processInstanceService.findBackAvtivity("00ec2015-a456-11ec-9d9e-e2d464bea7a3"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessListServiceTest extends BaseManagerTestCase {
|
||||
/*
|
||||
* @Autowired private ProcessListService processListService;
|
||||
*
|
||||
* @Autowired protected ProcessDefinitionService processDefinitionService;
|
||||
*
|
||||
* @Test public void queryNewList() { String userId="bumenlingdao1"; //
|
||||
* List<ProcessDefinitionModel>
|
||||
* pdfs=processListService.queryNewList(userId,null); // for
|
||||
* (ProcessDefinitionModel pdf : pdfs) { ProcessDefinitionEntity
|
||||
* pdfe=(ProcessDefinitionEntity) pdf; System.out.println(pdfe);
|
||||
* List<ActivityImpl>
|
||||
* wfActivitys=processDefinitionService.getProcessActivitys(pdfe.getId());
|
||||
* System.out.println(wfActivitys); ActivityImpl startActivity=(ActivityImpl)
|
||||
* processDefinitionService.getStartActivity(pdfe.getId()); List
|
||||
* nextActivityJson=processDefinitionService.getActivityUserTree("",pdfe.getId()
|
||||
* , startActivity.getId(),"","");
|
||||
*
|
||||
* //System.out.println(nextActivityJson); //} // BpmnModel
|
||||
* bpmnModel=repositoryService.getBpmnModel("PROCESS_1"); //
|
||||
* System.out.println(bpmnModel);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* @Test public void queryTodoList() {
|
||||
*
|
||||
* String userId="longwen"; SearchProcessListDTO pageRequest=new
|
||||
* SearchProcessListDTO(); pageRequest.setPageNumber(1);
|
||||
* pageRequest.setPageSize(10); pageRequest.setUserId("zhuguanlingdao");
|
||||
* Page<ActivityInstanceModel>
|
||||
* taskPage=processListService.queryTodoList(pageRequest);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* @Test public void queryTodoListCount() {
|
||||
*
|
||||
* String userId="longwen"; SearchProcessListDTO pageRequest=new
|
||||
* SearchProcessListDTO(); pageRequest.setPageNumber(1);
|
||||
* pageRequest.setPageSize(10); pageRequest.setUserId("zhuguanlingdao"); int
|
||||
* count= processListService.queryTodoListCount(pageRequest);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* public void queryZaibanList() {
|
||||
*
|
||||
* String userId="longwen"; }
|
||||
*
|
||||
* @Test public void queryFinishList() { String userId="longwen";
|
||||
* SearchProcessListDTO pageRequest=new SearchProcessListDTO();
|
||||
* pageRequest.setPageNumber(1); pageRequest.setPageSize(10);
|
||||
* pageRequest.setUserId("zhuguanlingdao"); Page<ProcessInstanceModel>
|
||||
* historicProcessInstance = processListService.queryFinishList(pageRequest);
|
||||
*
|
||||
* }
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.validation.ProcessValidator;
|
||||
import org.activiti.validation.ProcessValidatorFactory;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.SearchProcessListDTO;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessModelServiceTest extends BaseWfServiceTest {
|
||||
@Autowired
|
||||
protected ProcessModelService processModelService;
|
||||
@Autowired
|
||||
protected ProcessDefinitionService processDefinitionService;
|
||||
|
||||
@Test
|
||||
public void syncBpmnModelToDb() {
|
||||
ProcessDefinitionModel processDefinitionModel = processDefinitionService
|
||||
.getProcessDef("cbCompanySend:1:27620");
|
||||
System.out.println(processModelService
|
||||
.syncBpmnModelToDb(processDefinitionModel));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findProcessDefsByResource() {
|
||||
String resourceType = "role";
|
||||
String resourceVal = "JZSP_FLOW_CBMLD";
|
||||
String tenantId = "JZSP_SYS";
|
||||
String procDefKey = "";
|
||||
//map返回结果,tenantId、procDefName、activityId、activityName
|
||||
List<Map<String,String>> inProcess = processDefinitionService.findProcessDefsByResource(tenantId,procDefKey,resourceType,resourceVal);
|
||||
System.out.println("查询到出的流程定义列表:"+inProcess);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findProcessDefsByTenantId() {
|
||||
String tenantId="DEMO_SYS";
|
||||
SearchProcessListDTO searchProcessListDTO = new SearchProcessListDTO();
|
||||
searchProcessListDTO.setTenantId(tenantId);
|
||||
//查询符合条件的流程定义列表
|
||||
List<ProcessDefinitionModel> processDefinitions = processDefinitionService
|
||||
.findProcessDefsNotCascide(searchProcessListDTO);
|
||||
System.out.println("查询到出的流程定义列表:"+processDefinitions.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void validateBpmnModel() throws Exception {
|
||||
String bpmnFile = "D:\\工作\\学习工程\\工作流\\myBpms\\代码\\ebpm-project5-14-newstyle\\ebpm-process-manage\\src\\main\\resources\\2bpmn2__.bpmn";
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.convertFileToBpmnModel(new java.io.FileInputStream(new File(
|
||||
bpmnFile)));
|
||||
ProcessValidator processValidator = new ProcessValidatorFactory()
|
||||
.createDefaultProcessValidator();
|
||||
System.out.println(processValidator.validate(bpmnModel));
|
||||
// System.out.println(processModelService.syncBpmnModelToDb(processDefinitionModel));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseManagerTestCase;
|
||||
import junit.framework.Assert;
|
||||
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* 工作流跟踪相关Service
|
||||
*
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessTraceServiceTest extends BaseManagerTestCase {
|
||||
@Autowired
|
||||
ProcessTraceService processTraceService;
|
||||
@Test
|
||||
public void traceProcess(){
|
||||
List<Map<String, Object>> activityInfos=null;
|
||||
try {
|
||||
activityInfos = processTraceService.traceProcess("4315");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
Assert.assertEquals(true, activityInfos.size()>0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.blueland.ebpm.engine.core.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.blueland.bpm.engine.core.service.ProcessTransitionFreeService;
|
||||
import org.activiti.engine.ProcessEngineConfiguration;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
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.ContextConfiguration;
|
||||
|
||||
import com.blueland.ebpm.engine.BaseWfServiceTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ProcessTransitionFreeServiceTest extends BaseWfServiceTest{
|
||||
@Autowired
|
||||
protected ProcessEngineConfiguration processEngineConfiguration;
|
||||
@Test
|
||||
public void findBackAvtivity() {
|
||||
ProcessTransitionFreeService baseWfService = new ProcessTransitionFreeService(
|
||||
processEngineConfiguration);
|
||||
List<ActivityImpl> activityImpls=baseWfService.findBackAvtivity("d69af11d-aa8a-11ec-aba6-0242ac11000a");
|
||||
for (ActivityImpl activityImpl : activityImpls) {
|
||||
System.out.println("返回值:"+activityImpl.getProperty("name"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
|
||||
<process id="process" name="process1" isExecutable="true">
|
||||
<startEvent id="start" name="开始"></startEvent>
|
||||
<endEvent id="end" name="结束"></endEvent>
|
||||
<userTask id="act1" name="环节1" activiti:assignee="kermit"></userTask>
|
||||
<userTask id="act2" name="环节2" activiti:assignee="fozzie"></userTask>
|
||||
<userTask id="act_back3" name="回撤环节" activiti:assignee="lw"></userTask>
|
||||
<sequenceFlow id="sid-C99CB46B-91C7-43ED-B0D1-6CD1651A2A05" sourceRef="act2" targetRef="end"></sequenceFlow>
|
||||
<sequenceFlow id="sid-06A61A6A-4C63-4E55-85BB-9D7554A65192" sourceRef="start" targetRef="act1"></sequenceFlow>
|
||||
<sequenceFlow id="send_huiche" name="送回撤环节" sourceRef="act1" targetRef="act_back3"></sequenceFlow>
|
||||
<sequenceFlow id="send_act2" name="送环节2" sourceRef="act_back3" targetRef="act2">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${select == 'act2'}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="back_act1" name="回撤环节返回环节1" sourceRef="act_back3" targetRef="act1">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${select == 'act1'}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="back_2" name="环节2返回回撤环节" sourceRef="act2" targetRef="act_back3"></sequenceFlow>
|
||||
<scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy" activiti:autoStoreVariables="true"></scriptTask>
|
||||
<serviceTask id="servicetask1" name="Service Task"></serviceTask>
|
||||
</process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_process">
|
||||
<bpmndi:BPMNPlane bpmnElement="process" id="BPMNPlane_process">
|
||||
<bpmndi:BPMNShape bpmnElement="act_back3" id="BPMNShape_act_back3">
|
||||
<omgdc:Bounds height="80.0" width="100.0" x="200.0" y="288.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="act1" id="BPMNShape_act1">
|
||||
<omgdc:Bounds height="80.0" width="100.0" x="170.0" y="51.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="60.0" y="96.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="act2" id="BPMNShape_act2">
|
||||
<omgdc:Bounds height="80.0" width="100.0" x="442.0" y="96.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="390.0" y="30.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
|
||||
<omgdc:Bounds height="55.0" width="105.0" x="299.0" y="86.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
|
||||
<omgdc:Bounds height="55.0" width="105.0" x="580.0" y="200.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-06A61A6A-4C63-4E55-85BB-9D7554A65192" id="BPMNEdge_sid-06A61A6A-4C63-4E55-85BB-9D7554A65192">
|
||||
<omgdi:waypoint x="95.0" y="113.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="170.0" y="91.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="send_huiche" id="BPMNEdge_send_huiche">
|
||||
<omgdi:waypoint x="220.0" y="131.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="281.0" y="211.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="250.0" y="288.0"></omgdi:waypoint>
|
||||
<bpmndi:BPMNLabel>
|
||||
<omgdc:Bounds height="14.0" width="60.0" x="10.0" y="0.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="sid-C99CB46B-91C7-43ED-B0D1-6CD1651A2A05" id="BPMNEdge_sid-C99CB46B-91C7-43ED-B0D1-6CD1651A2A05">
|
||||
<omgdi:waypoint x="492.0" y="96.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="407.0" y="65.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="back_2" id="BPMNEdge_back_2">
|
||||
<omgdi:waypoint x="492.0" y="176.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="470.0" y="325.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="300.0" y="328.0"></omgdi:waypoint>
|
||||
<bpmndi:BPMNLabel>
|
||||
<omgdc:Bounds height="42.0" width="100.0" x="10.0" y="0.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="send_act2" id="BPMNEdge_send_act2">
|
||||
<omgdi:waypoint x="250.0" y="288.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="492.0" y="176.0"></omgdi:waypoint>
|
||||
<bpmndi:BPMNLabel>
|
||||
<omgdc:Bounds height="14.0" width="42.0" x="10.0" y="0.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="back_act1" id="BPMNEdge_back_act1">
|
||||
<omgdi:waypoint x="250.0" y="288.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="64.0" y="244.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="220.0" y="131.0"></omgdi:waypoint>
|
||||
<bpmndi:BPMNLabel>
|
||||
<omgdc:Bounds height="42.0" width="100.0" x="10.0" y="0.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
||||
13
ebpm-process-rest/src/main/test/resources/configuration.xml
Normal file
13
ebpm-process-rest/src/main/test/resources/configuration.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="GBK"?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN"
|
||||
"http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
|
||||
<configuration>
|
||||
<plugins>
|
||||
<!-- ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>Dialect, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:OracleDialect,SQLServerDialect,SybaseDialect,DB2Dialect,PostgreSQLDialect,MySQLDialect,DerbyDialect,HSQLDialect-->
|
||||
<plugin interceptor="com.blueland.bpm.common.ibatis3.plugin.OffsetLimitInterceptor">
|
||||
<property name="dialectClass" value="com.blueland.bpm.common.jdbc.dialect.DB2Dialect"/>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</configuration>
|
||||
36
ebpm-process-rest/src/main/test/resources/log4j.properties
Normal file
36
ebpm-process-rest/src/main/test/resources/log4j.properties
Normal file
@@ -0,0 +1,36 @@
|
||||
# This is the configuring for logging displayed in the Application Server
|
||||
log4j.rootCategory=INFO, stdout,web
|
||||
|
||||
################################
|
||||
# common appenders
|
||||
################################
|
||||
#stdout configure
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
|
||||
|
||||
#web file appender
|
||||
log4j.appender.web=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.web.file=../logs/jex_oa.log
|
||||
log4j.appender.web.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.web.layout.conversionPattern= %d [%X{loginUserId}/%X{req.remoteAddr}/%X{req.id} - %X{entranceMethod} - %X{req.requestURIWithQueryString}] %-5p %c - %m%n
|
||||
|
||||
################################
|
||||
# open source framework loggers
|
||||
################################
|
||||
#spring
|
||||
log4j.logger.org.springframework=INFO
|
||||
log4j.logger.org.springframework.jdbc.core.JdbcTemplate=INFO
|
||||
log4j.logger.org.activiti=DEBUG
|
||||
#log4jdbc,
|
||||
log4j.logger.jdbc.sqlonly=OFF
|
||||
log4j.logger.jdbc.sqltiming=ON
|
||||
log4j.logger.jdbc.audit=OFF
|
||||
log4j.logger.jdbc.resultset=OFF
|
||||
log4j.logger.jdbc.connection=OFF
|
||||
|
||||
################################
|
||||
# project loggers
|
||||
################################
|
||||
log4j.logger.cn.org.rapid_framework=ERROR
|
||||
log4j.logger.org.directwebremoting = ERROR
|
||||
@@ -0,0 +1,40 @@
|
||||
#全局变量 配置文件
|
||||
MAX_COOKIE=36000000
|
||||
MAX_SESSION=8640000
|
||||
bpm_process_modeler_path=/ebpm-process-modeler/service/editor
|
||||
#顶层组织ID
|
||||
TOP_ORG_ID=0
|
||||
|
||||
IS_OPEN_TENANT=true
|
||||
ARIS_URL=http://tam.hngytobacco.com/ebpm/test/test.do?ebpm=flow/flowDetail.do&posTestGuid=null&testType=1&ebpmModelName=%20Z80_02_01-A-01&processGuid=
|
||||
CTX=
|
||||
cache_config_file=process-ehcache-manage.xml
|
||||
|
||||
#IMServiceUrl=
|
||||
#统一待办MQ 配置
|
||||
#hostName=
|
||||
qManager=HN_DATAINTEGRATOR_QM
|
||||
qNameSend=BZ.ZYEBPMP.SEND
|
||||
qNameReceive=BZ.ZYEBPMP.RECEIVER
|
||||
channel=ZYEBPMP_CONN_TO_ESB
|
||||
userID=ZYEBPMP
|
||||
password=password
|
||||
port=1416
|
||||
CCSID=1208
|
||||
|
||||
|
||||
servicecode=ZYEBPMTOCPORTAL0001
|
||||
sender=ZYEBPMP
|
||||
from=ZYEBPMP
|
||||
ip=10.158.133.172
|
||||
|
||||
#配置邮件地址
|
||||
SMS_EMAIL_URL=
|
||||
#SMS_EMAIL_URL=http://localhost:8080/ebpm-common-rest/sms/sendEmail.do
|
||||
#流程执行地址
|
||||
EBPM_URL=https://tam.hngytobacco.com/ebpmp/ebpm-process-manage
|
||||
#短信发送地址
|
||||
SEND_SMS_URL=
|
||||
|
||||
|
||||
EBPM_UNITEWORK_MANAGE_PATH=https://tam.hngytobacco.com/unite/ebpm-unite-manage/pages/user/ssologin.do
|
||||
Reference in New Issue
Block a user