update
This commit is contained in:
7
ebpm-process-manage/Dockerfile
Normal file
7
ebpm-process-manage/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM tomcat:8.5.42-jdk8-corretto
|
||||
ENV SPRING_PROFILES_ACTIVE=dev
|
||||
|
||||
ADD ./target/ebpm-process-manage.war /usr/local/tomcat/webapps/
|
||||
WORKDIR /usr/local/tomcat
|
||||
EXPOSE 8080
|
||||
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]
|
||||
7
ebpm-process-manage/Dockerfile_prod
Normal file
7
ebpm-process-manage/Dockerfile_prod
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM cr.registry.res.zgs.yun/dzy/dzy-tomcat:8.5.81-jdk8-corretto
|
||||
ENV SPRING_PROFILES_ACTIVE=prod
|
||||
|
||||
ADD ./target/ebpm-process-manage.war /usr/local/tomcat/webapps/
|
||||
WORKDIR /usr/local/tomcat
|
||||
EXPOSE 8080
|
||||
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]
|
||||
7
ebpm-process-manage/Dockerfile_test
Normal file
7
ebpm-process-manage/Dockerfile_test
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM tomcat:8.5.42-jdk8-corretto
|
||||
ENV SPRING_PROFILES_ACTIVE=test
|
||||
|
||||
ADD ./target/ebpm-process-manage.war /usr/local/tomcat/webapps/
|
||||
WORKDIR /usr/local/tomcat
|
||||
EXPOSE 8080
|
||||
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]
|
||||
320
ebpm-process-manage/pom.xml
Normal file
320
ebpm-process-manage/pom.xml
Normal file
@@ -0,0 +1,320 @@
|
||||
<?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-manage</artifactId>
|
||||
<name>ebpm-process-manage</name>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>5.2.5.RELEASE</spring.version>
|
||||
<aspectjweaver.version>1.9.0</aspectjweaver.version>
|
||||
<druid.version>1.1.24</druid.version>
|
||||
<servlet-api.version>3.1.0</servlet-api.version>
|
||||
<commons-lang3.version>3.10</commons-lang3.version>
|
||||
<gson.version>2.8.8</gson.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<poi.version>4.1.1</poi.version>
|
||||
<lombok.version>1.18.18</lombok.version>
|
||||
<json-lib.version>2.4</json-lib.version>
|
||||
<javax.servlet.jsp.jstl.version>1.2</javax.servlet.jsp.jstl.version>
|
||||
<groovy.version>2.5.14</groovy.version>
|
||||
<commons-io.version>2.4</commons-io.version>
|
||||
<hutool.version>5.1.0</hutool.version>
|
||||
<httpclient.version>4.5.13</httpclient.version>
|
||||
<mybatis.version>3.5.6</mybatis.version>
|
||||
<mybatis-spring.version>2.0.4</mybatis-spring.version>
|
||||
<jackson.version>2.2.3</jackson.version>
|
||||
<jstl.version>1.2</jstl.version>
|
||||
<standard.version>1.1.2</standard.version>
|
||||
<uuid-generator.version>3.1.4</uuid-generator.version>
|
||||
<joda-time.version>2.2</joda-time.version>
|
||||
<javaGeom.version>0.11.1</javaGeom.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.rzdata</groupId>
|
||||
<artifactId>ebpm-process-code</artifactId>
|
||||
<version>${bpmc.code}</version>
|
||||
</dependency>
|
||||
<!-- Spring管理 start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<!-- Spring管理 end -->
|
||||
<!-- aspectjweaver(aop切入点表达式) -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>${aspectjweaver.version}</version>
|
||||
</dependency>
|
||||
<!-- druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<!-- mybaits -->
|
||||
<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>
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
<version>${springDataRedis-verson}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>${jedis-verson}</version>
|
||||
</dependency>
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<!-- groovy -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>${groovy.version}</version>
|
||||
</dependency>
|
||||
<!-- hutool -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!-- httpclient -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
</dependency>
|
||||
<!-- 数据处理工具(Java Json解析器) -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!-- javaGeom -->
|
||||
<dependency>
|
||||
<groupId>math.geom2d</groupId>
|
||||
<artifactId>javaGeom</artifactId>
|
||||
<version>${javaGeom.version}</version>
|
||||
</dependency>
|
||||
<!-- jstl -->
|
||||
<dependency>
|
||||
<groupId>jstl</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
<!-- 文件上传组件 -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<!-- uuid -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.uuid</groupId>
|
||||
<artifactId>java-uuid-generator</artifactId>
|
||||
<version>${uuid-generator.version}</version>
|
||||
</dependency>
|
||||
<!-- 日期时间工具 -->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${joda-time.version}</version>
|
||||
</dependency>
|
||||
<!-- gson(序列化/反序列化) -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
<!-- json库 -->
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>${json-lib.version}</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<!-- log4j -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
<!-- hibernate.validator -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>${hibernate-validator.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- xstream -->
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>${xstream.version}</version>
|
||||
</dependency>
|
||||
<!-- 其他工具 start -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<version>${javaee-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- 其他工具 end -->
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>ebpm-process-manage</finalName>
|
||||
<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>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<!-- 指定web.xml的路径 -->
|
||||
<webXml>webapp\WEB-INF\web.xml</webXml>
|
||||
<!-- 指定jsp、js、css的路径 -->
|
||||
<warSourceDirectory>webapp</warSourceDirectory>
|
||||
<webResources>
|
||||
<resource>
|
||||
<directory>../ebpm-process-code/lib</directory>
|
||||
<targetPath>WEB-INF/lib</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>**/bpmc-*.jar</include>
|
||||
<include>**/bizworks-*.jar</include>
|
||||
<include>**/unitework-*.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</webResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.blueland.bpm.manage.config.model;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseEntity;
|
||||
|
||||
public class SearchProcessResource extends BaseEntity implements java.io.Serializable{
|
||||
|
||||
private static final long serialVersionUID = 5454155825314635342L;
|
||||
//资源编码
|
||||
private String resourceId;
|
||||
//资源类型:role角色、org组织、user人员
|
||||
private String resourceType;
|
||||
//系统ID
|
||||
private String applicationId;
|
||||
//流程定义KEY
|
||||
private String proceDefKey;
|
||||
public String getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
public void setResourceId(String resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
public String getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
public String getApplicationId() {
|
||||
return applicationId;
|
||||
}
|
||||
public void setApplicationId(String applicationId) {
|
||||
this.applicationId = applicationId;
|
||||
}
|
||||
public String getProceDefKey() {
|
||||
return proceDefKey;
|
||||
}
|
||||
public void setProceDefKey(String proceDefKey) {
|
||||
this.proceDefKey = proceDefKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.ActivityRule;
|
||||
import com.blueland.bpm.engine.config.service.ActivityRuleManager;
|
||||
import com.blueland.bpm.engine.core.service.ActivityRuleService;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/activityFinishRule")
|
||||
public class ActivityFinishRuleController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityRuleService activityRuleService;
|
||||
@Autowired
|
||||
private ActivityRuleManager activityRuleManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/actInfo/activityFinishRule/list.do";
|
||||
|
||||
public ActivityFinishRuleController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ActivityRule query) {
|
||||
query.setRuleType(ActivityRule.RULE_TYPE_ACT_FINISH);
|
||||
Page page = this.activityRuleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityFinishRule/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "getActivityRule")
|
||||
@ResponseBody
|
||||
public ActivityRule getActivityRule(HttpServletRequest request,String ruleId) {
|
||||
ActivityRule activityRule=activityRuleManager.getById(ruleId);
|
||||
return activityRule;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ActivityRule activityRule) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_FINISH);
|
||||
return new ModelAndView("/actInfo/activityFinishRule/create","activityRule",activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleId("");
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_FINISH);
|
||||
activityRuleManager.save(activityRule);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
activityRule.clear();
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_FINISH);
|
||||
if(StringUtils.isNotEmpty(activityRule.getRuleId())){
|
||||
activityRuleManager.update(activityRule);
|
||||
}
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(String ruleId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
activityRuleManager.removeById(ruleId);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION+"?"+this.getQueryParams(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*验证规则
|
||||
**/
|
||||
@RequestMapping(value = "validate")
|
||||
public ModelAndView validate(String ruleScript,HttpServletRequest request) {
|
||||
String validateMsg="";
|
||||
String ruleScriptValueType="";
|
||||
Object ruleScriptValue=null;
|
||||
try{
|
||||
ruleScriptValue=activityRuleService.validateActivityRule(ruleScript);
|
||||
if(ruleScriptValue!=null){
|
||||
ruleScriptValueType=ruleScriptValue.getClass().toString();
|
||||
}
|
||||
validateMsg="脚本验证成功!";
|
||||
}catch(Exception e){
|
||||
String errorMsg=e.getMessage();
|
||||
validateMsg="脚本验证失败:"+(StringUtils.isNotEmpty(errorMsg)?errorMsg:e.getCause().getMessage());
|
||||
}
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityFinishRule/showValidate");
|
||||
result.addObject("validateMsg",validateMsg);
|
||||
result.addObject("ruleScriptValue",ruleScriptValue);
|
||||
result.addObject("ruleScriptValueType",ruleScriptValueType);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.MultiInstanceLoopCharacteristics;
|
||||
import org.activiti.bpmn.model.SubProcess;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
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.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import com.blueland.bpm.engine.util.ProcessModelUtils;
|
||||
import com.blueland.bpm.manage.web.BaseProcessController;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/activityInfo")
|
||||
public class ActivityInfoConfigController extends BaseProcessController {
|
||||
// 默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
private final String LIST_ACTION = "redirect:/activityInfo/list.do";
|
||||
|
||||
public ActivityInfoConfigController() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,
|
||||
ActivityInfoConfig query,String sys) {
|
||||
query.setPageSize(20);
|
||||
Page page = this.activityInfoConfigManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "main")
|
||||
public ModelAndView main(ActivityInfoConfig activityInfoConfig,
|
||||
HttpServletRequest request) {
|
||||
|
||||
return new ModelAndView("/actInfo/main", "activityInfoConfig",
|
||||
activityInfoConfig);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request,
|
||||
ActivityInfoConfig params,String sys,String mAppId) {
|
||||
boolean isStartTask = false;
|
||||
BpmnModel bpmnModel = processModelService.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
UserTask userTask = ProcessModelUtils.findStartUserTask(bpmnModel);
|
||||
if(null!=userTask){
|
||||
if(userTask.getId().equals(params.getActivityDefId())){//当前环节是开始环节
|
||||
isStartTask = true;
|
||||
}
|
||||
}
|
||||
ActivityInfoConfig activityInfoConfig = (ActivityInfoConfig) activityInfoConfigManager
|
||||
.getByEntity(params);
|
||||
ModelAndView result = new ModelAndView("/actInfo/edit", "activityInfoConfig",
|
||||
activityInfoConfig);
|
||||
result.addObject("isStartTask", isStartTask);
|
||||
result.addObject("sys", sys);
|
||||
result.addObject("mAppId", mAppId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request, ActivityInfoConfig params,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
UserTask userTask = ProcessModelUtils.findUserTask(bpmnModel, params.getActivityDefId());
|
||||
SubProcess subProcess = ProcessModelUtils.isSubProcessStartAct(bpmnModel,
|
||||
userTask.getId());
|
||||
boolean isUpdate = false;
|
||||
if (params.isMulti()) {
|
||||
if(params.getActivityDefDealType().equals("multi")){
|
||||
if (subProcess != null && subProcess.getLoopCharacteristics() == null) {
|
||||
userTask.setAssignee("${assignee}");
|
||||
MultiInstanceLoopCharacteristics multiInstance = new MultiInstanceLoopCharacteristics();
|
||||
multiInstance.setElementVariable("assignee");
|
||||
multiInstance.setInputDataItem("${assigneeList}");
|
||||
multiInstance.setSequential(false);
|
||||
subProcess.setLoopCharacteristics(multiInstance);
|
||||
isUpdate = true;
|
||||
} else if (subProcess==null && (userTask.getLoopCharacteristics() == null||userTask.getLoopCharacteristics().isSequential())) {
|
||||
userTask.setAssignee("${assignee}");
|
||||
MultiInstanceLoopCharacteristics multiInstance = new MultiInstanceLoopCharacteristics();
|
||||
multiInstance.setElementVariable("assignee");
|
||||
multiInstance.setInputDataItem("${assigneeList}");
|
||||
multiInstance.setSequential(false);
|
||||
userTask.setLoopCharacteristics(multiInstance);
|
||||
isUpdate = true;
|
||||
}
|
||||
}else if(params.getActivityDefDealType().equals("multi-x")){
|
||||
//多实例串行
|
||||
if (subProcess==null && (userTask.getLoopCharacteristics() == null||!userTask.getLoopCharacteristics().isSequential())) {
|
||||
userTask.setAssignee("${assignee}");
|
||||
MultiInstanceLoopCharacteristics multiInstance = new MultiInstanceLoopCharacteristics();
|
||||
multiInstance.setElementVariable("assignee");
|
||||
multiInstance.setInputDataItem("${assigneeList}");
|
||||
multiInstance.setSequential(true);
|
||||
userTask.setLoopCharacteristics(multiInstance);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
}else if (subProcess != null && subProcess.getLoopCharacteristics() != null) {
|
||||
subProcess.setLoopCharacteristics(null);
|
||||
userTask.setAssignee("");
|
||||
isUpdate = true;
|
||||
} else if (userTask.getLoopCharacteristics() != null) {
|
||||
userTask.setLoopCharacteristics(null);
|
||||
userTask.setAssignee("");
|
||||
isUpdate = true;
|
||||
}
|
||||
if (isUpdate) {
|
||||
updateBpmnModel(bpmnModel, params.getProcessDefId(), true);
|
||||
}
|
||||
activityInfoConfigManager.update(params);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "actOperatePowerList")
|
||||
public ModelAndView actOperatePowerList(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/actOperatePowerList");
|
||||
List<ActivityOperatePower> activityOperatePowerList = activityInfoConfigManager
|
||||
.findActivityOperatePower(params.getProcessDefId(),
|
||||
params.getActivityDefId());
|
||||
modelAndView.addObject("activityOperatePowerList",
|
||||
activityOperatePowerList);
|
||||
modelAndView.addObject("query", params);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "addActOperatePower")
|
||||
@ResponseBody
|
||||
public String addActOperatePower(String[] opIds, String processDefId,
|
||||
String activityDefId) {
|
||||
if (opIds == null || opIds.length <= 0) {
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
boolean isAdd = activityInfoConfigManager.addActivityOperatePower(
|
||||
new ArrayList(Arrays.asList(opIds)), processDefId,
|
||||
activityDefId);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "removeActOperatePower")
|
||||
@ResponseBody
|
||||
public String removeActiOperatePower(String[] opIds, String processDefId,
|
||||
String activityDefId) {
|
||||
if (opIds == null || opIds.length <= 0) {
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
boolean isRemove = activityInfoConfigManager
|
||||
.removeActivityOperatePower(
|
||||
new ArrayList(Arrays.asList(opIds)), processDefId,
|
||||
activityDefId);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 环节配置
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "actSet")
|
||||
public ModelAndView actSet(HttpServletRequest request,
|
||||
ActivityInfoConfig query,String appId,String formId,String modelId,String procDefKey,String formCode,String mAppId) {
|
||||
ModelAndView result = new ModelAndView("/actInfo/actSet");
|
||||
if(StringUtils.isEmpty(query.getProcessDefId())) {
|
||||
return new ModelAndView("/procDefModelMgr/info");
|
||||
}
|
||||
result.addObject("query", query);
|
||||
result.addObject("appId", appId);
|
||||
result.addObject("formId", formId);
|
||||
result.addObject("modelId", modelId);
|
||||
result.addObject("procDefKey", procDefKey);
|
||||
result.addObject("formCode", formCode);
|
||||
result.addObject("mAppId", mAppId);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 环节配置_v1
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "actSet_v1")
|
||||
public ModelAndView actSetV1(HttpServletRequest request,
|
||||
ActivityInfoConfig query,String appId,String formId,String modelId,String procDefKey,String formCode,String mAppId) {
|
||||
ModelAndView result = new ModelAndView("/actInfo/actSet_v1");
|
||||
if(StringUtils.isEmpty(query.getProcessDefId())) {
|
||||
return new ModelAndView("/procDefModelMgr/info");
|
||||
}
|
||||
String processDefinitionDiv =null;
|
||||
try {
|
||||
processDefinitionDiv=processTraceService.getProcessDefinitionDiv(query.getProcessDefId());
|
||||
String[] size = processTraceService.getProcessDiagramSize(query.getProcessDefId());
|
||||
result.addObject("imageWidth",size[0]);
|
||||
result.addObject("imageHeight",size[1]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
result.addObject("query", query);
|
||||
result.addObject("appId", appId);
|
||||
result.addObject("formId", formId);
|
||||
result.addObject("modelId", modelId);
|
||||
result.addObject("procDefKey", procDefKey);
|
||||
result.addObject("formCode", formCode);
|
||||
result.addObject("mAppId", mAppId);
|
||||
result.addObject("processDefinitionDiv", processDefinitionDiv);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 环节配置
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "actConfig")
|
||||
public ModelAndView actConfig(HttpServletRequest request,
|
||||
ActivityInfoConfig query,String sys) {
|
||||
ModelAndView result = new ModelAndView("/actInfo/actConfig");
|
||||
ActivityInfoConfig activity =new ActivityInfoConfig();
|
||||
if(StringUtils.isEmpty(query.getActivityDefId())||StringUtils.isEmpty(query.getProcessDefId())) {
|
||||
activity =new ActivityInfoConfig();
|
||||
}
|
||||
activity = (ActivityInfoConfig) activityInfoConfigManager
|
||||
.getByEntity(query);
|
||||
result.addObject("activity", activity);
|
||||
result.addObject("sys", sys);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前环节绑定的表单
|
||||
* @param request
|
||||
* @param params
|
||||
* @param sys
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "getActForm")
|
||||
@ResponseBody
|
||||
public Map<String,Object> getActForm(HttpServletRequest request,
|
||||
@RequestBody Map<String,Object> params) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
ActivityInfoConfig act = new ActivityInfoConfig();
|
||||
if(StringUtils.isNotEmpty(params.get("processDefId").toString()) && StringUtils.isNotEmpty(params.get("activityDefId").toString())){
|
||||
act.setProcessDefId(params.get("processDefId").toString());
|
||||
act.setActivityDefId(params.get("activityDefId").toString());
|
||||
ActivityInfoConfig activityInfoConfig = (ActivityInfoConfig) activityInfoConfigManager
|
||||
.getByEntity(act);
|
||||
|
||||
result.put("flag", "success");
|
||||
result.put("msg", "操作成功");
|
||||
result.put("activityInfoConfig",activityInfoConfig);
|
||||
return result;
|
||||
}else{
|
||||
result.put("flag", "fail");
|
||||
result.put("msg", "参数异常");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
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.service.ActivityOperatePowerManager;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/activityOperatePower")
|
||||
public class ActivityOperatePowerController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityOperatePowerManager activityOperatePowerManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/actInfo/activityOperatePower/list.do";
|
||||
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
|
||||
public ActivityOperatePowerController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ActivityOperatePower query,ActivityInfoConfig params) {
|
||||
query.setTenantId((String)request.getSession().getAttribute(MyContants.APP_ID_KEY));
|
||||
Page page = this.activityOperatePowerManager.findTenantOperatePower(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/actOperatePower/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
result.addObject("activityInfoConfig",params);
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("opId"));
|
||||
ActivityOperatePower activityOperatePower = (ActivityOperatePower)activityOperatePowerManager.getById(id);
|
||||
return new ModelAndView("/actInfo/actOperatePower/show","activityOperatePower",activityOperatePower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ActivityOperatePower activityOperatePower) {
|
||||
return new ModelAndView("/actInfo/actOperatePower/create","activityOperatePower",activityOperatePower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(HttpServletRequest request,ActivityOperatePower activityOperatePower,RedirectAttributes redirectAttributes) {
|
||||
ActivityOperatePower power = activityOperatePowerManager.getById(activityOperatePower.getOpId());
|
||||
if(power != null) {
|
||||
ApplicationEntity application = (ApplicationEntity)applicationManager.getById(power.getTenantId());//通过从power里面得到的系统ID得到系统对象
|
||||
String appName = application.getAppName();//获取系统名称
|
||||
return "环节权限ID已被"+appName+"系统占用,请您重新输入!";
|
||||
}else {
|
||||
activityOperatePower.setTenantId((String)request.getSession().getAttribute(MyContants.APP_ID_KEY));
|
||||
activityOperatePowerManager.save(activityOperatePower);
|
||||
return CREATED_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("opId"));
|
||||
ActivityOperatePower activityOperatePower = (ActivityOperatePower)activityOperatePowerManager.getById(id);
|
||||
return new ModelAndView("/actInfo/actOperatePower/edit","activityOperatePower",activityOperatePower);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,ActivityOperatePower activityOperatePower,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("opId"));
|
||||
activityOperatePower.setTenantId((String)request.getSession().getAttribute(MyContants.APP_ID_KEY));
|
||||
activityOperatePowerManager.update(activityOperatePower);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] opIds = request.getParameterValues("opIds");
|
||||
for(int i = 0; i < opIds.length; i++) {
|
||||
if(StringUtils.isNotEmpty(opIds[i])){
|
||||
activityOperatePowerManager.removeById(opIds[i]);
|
||||
}
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.ActivityRule;
|
||||
import com.blueland.bpm.engine.config.service.ActivityRuleManager;
|
||||
import com.blueland.bpm.engine.core.service.ActivityRuleService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/activityResourceRule")
|
||||
public class ActivityResourceRuleController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityRuleManager activityRuleManager;
|
||||
@Autowired
|
||||
private ActivityRuleService activityRuleService;
|
||||
private final String LIST_ACTION = "redirect:/actInfo/activityResourceRule/list.do";
|
||||
|
||||
public ActivityResourceRuleController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ActivityRule query) {
|
||||
query.setRuleType(ActivityRule.RULE_TYPE_ACT_RES);
|
||||
Page page = this.activityRuleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityResourceRule/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "getActivityRule")
|
||||
@ResponseBody
|
||||
public ActivityRule getActivityRule(HttpServletRequest request,String ruleId) {
|
||||
ActivityRule activityRule=activityRuleManager.getById(ruleId);
|
||||
return activityRule;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ActivityRule activityRule) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_RES);
|
||||
return new ModelAndView("/actInfo/activityResourceRule/create","activityRule",activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleId("");
|
||||
//activityRule.setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_RES);
|
||||
activityRuleManager.save(activityRule);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
activityRule.clear();
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT_RES);
|
||||
if(StringUtils.isNotEmpty(activityRule.getRuleId())){
|
||||
activityRuleManager.update(activityRule);
|
||||
}
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(String ruleId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
activityRuleManager.removeById(ruleId);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION+"?"+this.getQueryParams(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*验证规则
|
||||
**/
|
||||
@RequestMapping(value = "validate")
|
||||
public ModelAndView validate(String ruleScript,HttpServletRequest request) {
|
||||
String validateMsg="";
|
||||
String ruleScriptValueType="";
|
||||
Object ruleScriptValue=null;
|
||||
try{
|
||||
ruleScriptValue=activityRuleService.validateActivityRule(ruleScript);
|
||||
if(ruleScriptValue!=null){
|
||||
ruleScriptValueType=ruleScriptValue.getClass().toString();
|
||||
}
|
||||
validateMsg="脚本验证成功!";
|
||||
}catch(Exception e){
|
||||
String errorMsg=e.getMessage();
|
||||
validateMsg="脚本验证失败:"+(StringUtils.isNotEmpty(errorMsg)?errorMsg:e.getCause().getMessage());
|
||||
}
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityResourceRule/showValidate");
|
||||
result.addObject("validateMsg",validateMsg);
|
||||
result.addObject("ruleScriptValue",ruleScriptValue);
|
||||
result.addObject("ruleScriptValueType",ruleScriptValueType);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.ActivityRule;
|
||||
import com.blueland.bpm.engine.config.service.ActivityRuleManager;
|
||||
import com.blueland.bpm.engine.core.service.ActivityRuleService;
|
||||
import com.blueland.bpm.engine.util.cache.MyProcessDefinitionCache;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/activityRule")
|
||||
public class ActivityRuleController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityRuleManager activityRuleManager;
|
||||
@Autowired
|
||||
private ActivityRuleService activityRuleService;
|
||||
private final String LIST_ACTION = "redirect:/actInfo/activityRule/list.do";
|
||||
|
||||
public ActivityRuleController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "appList")
|
||||
public ModelAndView appList(HttpServletRequest request,ActivityRule query) {
|
||||
Page page = this.activityRuleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityRule/appList");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ActivityRule query) {
|
||||
query.setRuleType(ActivityRule.RULE_TYPE_ACT);
|
||||
Page page = this.activityRuleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityRule/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "getActivityRule")
|
||||
@ResponseBody
|
||||
public ActivityRule getActivityRule(HttpServletRequest request,String ruleId) {
|
||||
ActivityRule activityRule=activityRuleManager.getById(ruleId);
|
||||
return activityRule;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ActivityRule activityRule) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT);
|
||||
return new ModelAndView("/actInfo/activityRule/create","activityRule",activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleId("");
|
||||
//activityRule.setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT);
|
||||
activityRuleManager.save(activityRule);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
activityRule.clear();
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,ActivityRule activityRule,RedirectAttributes redirectAttributes) {
|
||||
activityRule.setRuleType(ActivityRule.RULE_TYPE_ACT);
|
||||
if(StringUtils.isNotEmpty(activityRule.getRuleId())){
|
||||
activityRuleManager.update(activityRule);
|
||||
}
|
||||
return create(request,activityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(String ruleId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
activityRuleManager.removeById(ruleId);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION+"?"+this.getQueryParams(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*验证规则
|
||||
**/
|
||||
@RequestMapping(value = "validate")
|
||||
public ModelAndView validate(String ruleScript,HttpServletRequest request) {
|
||||
String validateMsg="";
|
||||
String ruleScriptValueType="";
|
||||
Object ruleScriptValue=null;
|
||||
try{
|
||||
ruleScriptValue=activityRuleService.validateActivityRule(ruleScript);
|
||||
if(ruleScriptValue!=null){
|
||||
ruleScriptValueType=ruleScriptValue.getClass().toString();
|
||||
}
|
||||
validateMsg="脚本验证成功!";
|
||||
}catch(Exception e){
|
||||
String errorMsg=e.getMessage();
|
||||
validateMsg="脚本验证失败:"+(StringUtils.isNotEmpty(errorMsg)?errorMsg:e.getCause().getMessage());
|
||||
}
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityRule/showValidate");
|
||||
result.addObject("validateMsg",validateMsg);
|
||||
result.addObject("ruleScriptValue",ruleScriptValue);
|
||||
result.addObject("ruleScriptValueType",ruleScriptValueType);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索-管理
|
||||
**/
|
||||
@RequestMapping(value = "listMgr")
|
||||
public ModelAndView listMgr(HttpServletRequest request,ActivityRule query) {
|
||||
//query.setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
Page page = this.activityRuleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/actInfo/activityRuleMgr/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
*删除对象-管理
|
||||
**/
|
||||
@RequestMapping(value = "deleteMgr")
|
||||
public ModelAndView deleteMgr(String ruleId,RedirectAttributes redirectAttributes,HttpServletRequest request) {
|
||||
activityRuleManager.removeById(ruleId);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION+"?"+this.getQueryParams(request));
|
||||
}
|
||||
@RequestMapping(value = "editMgr")
|
||||
public ModelAndView editMgr(HttpServletRequest request,String ruleId) {
|
||||
ActivityRule activityRule=activityRuleManager.getById(ruleId);
|
||||
return new ModelAndView("/actInfo/activityRuleMgr/edit","activityRule",activityRule);
|
||||
}
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "updateMgr")
|
||||
@ResponseBody
|
||||
public String updateMgr(HttpServletRequest request,ActivityRule activityRule) {
|
||||
if(StringUtils.isNotEmpty(activityRule.getRuleId())){
|
||||
activityRuleManager.update(activityRule);
|
||||
}
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
import com.blueland.bpm.engine.config.model.DataObject;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectManager;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "dataObject")
|
||||
public class DataObjectController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private DataObjectManager dataObjectManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/dataObject/list.do";
|
||||
|
||||
public DataObjectController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,DataObject query) {
|
||||
Page page = this.dataObjectManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/dataObject/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("objId"));
|
||||
DataObject dataObject = (DataObject)dataObjectManager.getById(id);
|
||||
return new ModelAndView("/dataObject/show","dataObject",dataObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,DataObject dataObject) {
|
||||
return new ModelAndView("/dataObject/create","dataObject",dataObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,DataObject dataObject,RedirectAttributes redirectAttributes) {
|
||||
dataObject.setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
dataObjectManager.save(dataObject);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("objId"));
|
||||
DataObject dataObject = (DataObject)dataObjectManager.getById(id);
|
||||
return new ModelAndView("/dataObject/edit","dataObject",dataObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,DataObject dataObject,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("objId"));
|
||||
dataObjectManager.update(dataObject);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("objId"));
|
||||
|
||||
dataObjectManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.*;
|
||||
import com.blueland.bpm.engine.config.dao.*;
|
||||
import com.blueland.bpm.engine.config.service.*;
|
||||
import com.blueland.bpm.engine.core.model.ActivityDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.manage.service.AgainSaveSessionService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "dataObjectRelation")
|
||||
public class DataObjectRelationController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private DataObjectRelationManager dataObjectRelationManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private AgainSaveSessionService againSaveSessionService;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/dataObjectRelation/list.do";
|
||||
|
||||
public DataObjectRelationController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "sequenceFlowList")
|
||||
public ModelAndView sequenceFlowList(HttpServletRequest request,DataObjectRelation query) {
|
||||
List<DataObjectRelation> dataObjectRelations = this.dataObjectRelationManager.findDataObjectRelationsBySequenceFlow(query.getProcessDefId(), query.getActivityDefId(),query.getTargetActId());
|
||||
ModelAndView result = new ModelAndView("/dataObjectRelation/sequenceFlowList");
|
||||
result.addObject("dataObjectRelations",dataObjectRelations);
|
||||
result.addObject("query",query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "processList")
|
||||
public ModelAndView processList(HttpServletRequest request,DataObjectRelation query) {
|
||||
List<DataObjectRelation> dataObjectRelations = this.dataObjectRelationManager.findDataObjectRelationsByProcessDefId(query.getProcessDefId());
|
||||
ModelAndView result = new ModelAndView("/dataObjectRelation/processList");
|
||||
result.addObject("dataObjectRelations",dataObjectRelations);
|
||||
result.addObject("query",query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "activityList")
|
||||
public ModelAndView activityList(HttpServletRequest request,DataObjectRelation query) {
|
||||
List<DataObjectRelation> dataObjectRelations = this.dataObjectRelationManager.findDataObjectRelationsByActivityDefId(query.getProcessDefId(), query.getActivityDefId());
|
||||
ModelAndView result = new ModelAndView("/dataObjectRelation/activityList");
|
||||
result.addObject("dataObjectRelations",dataObjectRelations);
|
||||
result.addObject("query",query);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("dorId"));
|
||||
DataObjectRelation dataObjectRelation = (DataObjectRelation)dataObjectRelationManager.getById(id);
|
||||
return new ModelAndView("/dataObjectRelation/show","dataObjectRelation",dataObjectRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,DataObjectRelation dataObjectRelation) {
|
||||
ProcessDefinitionModel processDef =processDefinitionService.getProcessDef(dataObjectRelation.getProcessDefId());
|
||||
|
||||
dataObjectRelation.setProcessDefName(processDef.getProcDefName());
|
||||
if(!StringUtils.isEmpty(dataObjectRelation.getActivityDefId())) {
|
||||
ActivityDefinitionModel actDef =processDefinitionService.getActivity(processDef.getProcDefId(), dataObjectRelation.getActivityDefId());
|
||||
dataObjectRelation.setActivityDefName(actDef.getActDefName());
|
||||
if(!StringUtils.isEmpty(dataObjectRelation.getTargetActId())) {
|
||||
ActivityDefinitionModel destActDef =processDefinitionService.getActivity(processDef.getProcDefId(), dataObjectRelation.getTargetActId());
|
||||
dataObjectRelation.setTargetActName(destActDef.getActDefName());
|
||||
}
|
||||
}
|
||||
return new ModelAndView("/dataObjectRelation/create","dataObjectRelation",dataObjectRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(HttpServletRequest request,DataObjectRelation dataObjectRelation) {
|
||||
dataObjectRelation.getDataObject().setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
dataObjectRelationManager.save(dataObjectRelation);
|
||||
return CREATED_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("dorId"));
|
||||
DataObjectRelation dataObjectRelation = (DataObjectRelation)dataObjectRelationManager.getById(id);
|
||||
return new ModelAndView("/dataObjectRelation/edit","dataObjectRelation",dataObjectRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request,DataObjectRelation dataObjectRelation) {
|
||||
String id = new String(request.getParameter("dorId"));
|
||||
dataObjectRelationManager.update(dataObjectRelation);
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(HttpServletRequest request) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
String id = new String((String)params.get("dorId"));
|
||||
dataObjectRelationManager.removeById(id);
|
||||
}
|
||||
return DELETE_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.log.model.LogSysRuntime;
|
||||
import com.blueland.bpm.log.service.LogSysRuntimeManager;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "logSysRuntime")
|
||||
public class LogSysRuntimeController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private LogSysRuntimeManager logSysRuntimeManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/logSysRuntime/list.do";
|
||||
|
||||
public LogSysRuntimeController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,LogSysRuntime query) {
|
||||
ModelAndView result = new ModelAndView("/logSysRuntime/list");
|
||||
result.addAllObjects(toModelMap(logSysRuntimeManager.findPage(query), query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("logId"));
|
||||
LogSysRuntime logSysRuntime = (LogSysRuntime)logSysRuntimeManager.getById(id);
|
||||
return new ModelAndView("/logSysRuntime/show","logSysRuntime",logSysRuntime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,LogSysRuntime logSysRuntime,RedirectAttributes redirectAttributes) {
|
||||
logSysRuntimeManager.save(logSysRuntime);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("logId"));
|
||||
|
||||
logSysRuntimeManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.*;
|
||||
import com.blueland.bpm.engine.config.service.*;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "msgRemind")
|
||||
public class MsgRemindController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private MsgRemindManager msgRemindManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/msgRemind/list.do";
|
||||
|
||||
public MsgRemindController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,MsgRemind query) {
|
||||
ModelAndView result = new ModelAndView("/msgRemind/list");
|
||||
|
||||
try {
|
||||
User user = BaseUser.getInstance().getSessionUser(request);
|
||||
List<ApplicationEntity> apps = applicationManager.selectByUserId(user.getUserId());
|
||||
result.addObject("apps", apps);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Page page = this.msgRemindManager.findPage(query);
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
ModelAndView result = new ModelAndView("/msgRemind/show");
|
||||
String id = new String(request.getParameter("remindId"));
|
||||
MsgRemind msgRemind = (MsgRemind)msgRemindManager.getById(id);
|
||||
if(null!=msgRemind){
|
||||
if(null!=msgRemind.getRemindProcessDefKey()){
|
||||
ProcessDefinitionModel processDefinition =
|
||||
processDefinitionService.getProcessDef("DEMO_SYS_SUB:1:033d25ef-d1f1-11e4-9ddb-28d24474b3a8");
|
||||
result.addObject("procdefname", processDefinition.getProcDefName());
|
||||
}
|
||||
if(null!=msgRemind.getRemindAppId()){
|
||||
// ApplicationEntity app = applicationManager.getById(msgRemind.getRemindAppId());
|
||||
// System.out.println(app.getAppName());
|
||||
}
|
||||
|
||||
}
|
||||
result.addObject("msgRemind",msgRemind);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,MsgRemind msgRemind) {
|
||||
ModelAndView result = new ModelAndView("/msgRemind/create");
|
||||
try {
|
||||
User user = BaseUser.getInstance().getSessionUser(request);
|
||||
List<ApplicationEntity> apps = applicationManager.selectByUserId(user.getUserId());
|
||||
result.addObject("apps", apps);
|
||||
result.addObject("msgRemind", msgRemind);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,MsgRemind msgRemind,RedirectAttributes redirectAttributes) {
|
||||
HttpSession session=request.getSession(false);
|
||||
User user = (User)session.getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
if(null!=user){
|
||||
msgRemind.setRemindUserId(user.getUserId());
|
||||
}
|
||||
//msgRemind.setRemindAppId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
msgRemindManager.save(msgRemind);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "saveMsgRemind")
|
||||
@ResponseBody
|
||||
public String saveMsgRemind(HttpServletRequest request,MsgRemind msgRemind,RedirectAttributes redirectAttributes) {
|
||||
HttpSession session=request.getSession(false);
|
||||
User user = (User)session.getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
if(null!=user){
|
||||
msgRemind.setRemindUserId(user.getUserId());
|
||||
}
|
||||
//msgRemind.setRemindAppId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
msgRemindManager.save(msgRemind);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
ModelAndView result = new ModelAndView("/msgRemind/edit");
|
||||
String id = new String(request.getParameter("remindId"));
|
||||
MsgRemind msgRemind = (MsgRemind)msgRemindManager.getById(id);
|
||||
if(null!=msgRemind){
|
||||
if(null!=msgRemind.getRemindProcessDefKey()){
|
||||
ProcessDefinitionModel processDefinition =
|
||||
processDefinitionService.getProcessDef(
|
||||
msgRemind.getRemindProcessDefKey());
|
||||
result.addObject("procDefName", processDefinition.getProcDefName());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
User user = BaseUser.getInstance().getSessionUser(request);
|
||||
List<ApplicationEntity> apps = applicationManager.selectByUserId(user.getUserId());
|
||||
result.addObject("apps", apps);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
result.addObject("msgRemind", msgRemind);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,MsgRemind msgRemind,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("remindId"));
|
||||
msgRemindManager.update(msgRemind);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "updateMsgRemind")
|
||||
@ResponseBody
|
||||
public String updateMsgRemind(HttpServletRequest request,MsgRemind msgRemind,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("remindId"));
|
||||
msgRemindManager.update(msgRemind);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("remindId"));
|
||||
|
||||
msgRemindManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.model.NoticeRemindConfig;
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.config.service.NoticeRemindConfigService;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
/**
|
||||
* @author ly
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "noticeRemindConfig")
|
||||
public class NoticeRemindConfigController extends BaseSpringController {
|
||||
|
||||
@Resource(name = "noticeRemindConfigService")
|
||||
private NoticeRemindConfigService noticeRemindConfigService;
|
||||
@Autowired
|
||||
private ProcessInfoConfigManager processInfoConfigManager;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request, String procDefId) {
|
||||
NoticeRemindConfig noticeRemindConfig = null;
|
||||
if (StringUtils.isNotEmpty(procDefId)) {
|
||||
ProcessInfoConfig processInfoConfig = (ProcessInfoConfig) processInfoConfigManager.getById(procDefId);
|
||||
noticeRemindConfig = noticeRemindConfigService.getById(procDefId);
|
||||
if (null == noticeRemindConfig) {
|
||||
noticeRemindConfig = new NoticeRemindConfig();
|
||||
noticeRemindConfig.setProcDefId(procDefId);
|
||||
}
|
||||
noticeRemindConfig.setProcDefKey(processInfoConfig.getProcessDefKey());
|
||||
}
|
||||
return new ModelAndView("/procDefMgr/noticeRemindConfig/edit", "noticeRemindConfig", noticeRemindConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request, NoticeRemindConfig noticeRemindConfig,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
if (null == noticeRemindConfig || StringUtils.isEmpty(noticeRemindConfig.getProcDefId())) {
|
||||
return ACTION_ERROR;
|
||||
}
|
||||
User user = null;
|
||||
try {
|
||||
user = BaseUser.getInstance().getSessionUser(request);
|
||||
} catch (Exception e) {
|
||||
return ACTION_ERROR;
|
||||
}
|
||||
noticeRemindConfig.setCretaeUserId(user.getUserId());
|
||||
noticeRemindConfig.setUpdateUserId(user.getUserId());
|
||||
NoticeRemindConfig old = noticeRemindConfigService.getById(noticeRemindConfig.getProcDefId());
|
||||
if (old == null) {
|
||||
noticeRemindConfigService.save(noticeRemindConfig);
|
||||
} else {
|
||||
noticeRemindConfigService.update(noticeRemindConfig);
|
||||
}
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
*
|
||||
* @param processDefId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "selectActInfoConfigs")
|
||||
public ModelAndView selectActInfoConfigs(String processDefId) {
|
||||
ModelAndView modelAndView = new ModelAndView("/procDefMgr/noticeRemindConfig/selectActInfoConfigs");
|
||||
List<ActivityInfoConfig> actInfoConfigs = activityInfoConfigManager.findActivityInfoConfigs(processDefId);
|
||||
modelAndView.addObject("actInfoConfigs", actInfoConfigs);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(HttpServletRequest request, String procDefId, RedirectAttributes redirectAttributes) {
|
||||
NoticeRemindConfig noticeRemindConfig = noticeRemindConfigService.getById(procDefId);
|
||||
if(null == noticeRemindConfig){
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
try {
|
||||
noticeRemindConfigService.removeById(procDefId);
|
||||
} catch (Exception e) {
|
||||
return ACTION_ERROR;
|
||||
}
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.application.dao.ApplicationDao;
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.common.util.StringUtils;
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
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.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.TreeNode;
|
||||
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class ProcDefTreeManager {
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessInfoConfigManager processInfoConfigManager;
|
||||
@Autowired
|
||||
private ApplicationDao applicationDao;
|
||||
|
||||
|
||||
public List<TreeNode> getProcDefTree(String typeId,String userId,String selectType) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
if(null == typeId){//初始化树
|
||||
boolean isParent = true;
|
||||
//selectType不为空时,是代表委托界面获取流程节点,不需要展示顶层节点和二级以下的节点,isParent=false是不展示二级节点用的
|
||||
if(!StringUtils.isEmpty(selectType)){
|
||||
isParent = false;
|
||||
//自定义顶级节点
|
||||
TreeNode treeNode = new TreeNode("1",
|
||||
"-1", "可视化流程平台", true,
|
||||
true, true, "TOP", "false",0);
|
||||
treeNodeList.add(treeNode);
|
||||
}else{
|
||||
//自定义顶级节点
|
||||
TreeNode treeNode = new TreeNode("1",
|
||||
"-1", "所有流程", true,
|
||||
true, true, "TOP", "false",0);
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
|
||||
|
||||
//获取当前登录用户有权限查看的业务系统列表
|
||||
List<ApplicationEntity> applications = applicationDao.selectByUserId(userId);
|
||||
|
||||
//添加业务系统节点
|
||||
for (ApplicationEntity application : applications) {
|
||||
TreeNode tempnode = new TreeNode(application.getAppId(),
|
||||
"1",application.getAppName(), true,
|
||||
true,isParent, "SYS", "false",1);
|
||||
treeNodeList.add(tempnode);
|
||||
}
|
||||
}else{//选中某个节点展开
|
||||
ApplicationEntity application = applicationDao.getById(typeId);
|
||||
if(null!=application){//点击的是业务系统节点
|
||||
//根据业务系统id查询该系统下对应的流程定义数据
|
||||
ProcessInfoConfig query = new ProcessInfoConfig();
|
||||
query.setTenantId(application.getAppId());
|
||||
query.setProcessMgrIsshow(ProcessInfoConfig.PROCESS_MGR_ISSHOW_Y);
|
||||
|
||||
List<ProcessInfoConfig> processInfoConfigs = processInfoConfigManager.findByExample(query);
|
||||
for (ProcessInfoConfig processInfoConfig : processInfoConfigs) {
|
||||
TreeNode processInfoConfignode = new TreeNode(
|
||||
processInfoConfig.getProcessDefId(),
|
||||
application.getAppId(),
|
||||
processInfoConfig.getProcessDefName(), false,
|
||||
false, false, "TYPE", "false",2);
|
||||
treeNodeList.add(processInfoConfignode);
|
||||
}
|
||||
}else{//如果不是业务系统节点
|
||||
|
||||
}
|
||||
}
|
||||
return treeNodeList;
|
||||
|
||||
}
|
||||
public List<TreeNode> getProcDefTree_bak(SearchProcessListDTO searchProcessListDTO) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
List<ProcessDefinitionModel> list = null;
|
||||
TreeNode treeNode = new TreeNode("1",
|
||||
"-1", "所有流程", true,
|
||||
true, true, "TOP", "false",0);
|
||||
treeNodeList.add(treeNode);
|
||||
if (StringUtils.isEmpty(searchProcessListDTO.getFlowType())){
|
||||
list = processDefinitionService.findProcessDefs(searchProcessListDTO);
|
||||
}
|
||||
for (ProcessDefinitionModel processDefinitionModel : list) {
|
||||
addTreeNode(treeNodeList, processDefinitionModel, false,"true");
|
||||
}
|
||||
return treeNodeList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据menu组装TreeNode对象并添加到treeNodeList中
|
||||
*
|
||||
* @param treeNodeList
|
||||
* treeNodeList
|
||||
* @param menu
|
||||
* 菜单对象
|
||||
* @param isOpenMenu
|
||||
* 是否打开菜单
|
||||
*/
|
||||
private void addTreeNode(List<TreeNode> treeNodeList, ProcessDefinitionModel processDefinitionModel, boolean isOpenNode,String isAccessTopNode) {
|
||||
|
||||
TreeNode treeNode = new TreeNode(processDefinitionModel.getProcDefId(),
|
||||
"1", processDefinitionModel.getProcDefName(), true,
|
||||
isOpenNode, false, "TYPE", isAccessTopNode,0);
|
||||
treeNodeList.add(treeNode);
|
||||
|
||||
}
|
||||
/*private boolean isChildNode(SysGlType sysGlType){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId(sysGlType.getTypeId());
|
||||
long totalCount = sysGlTypeDao.findEntityCount(param);
|
||||
*//**
|
||||
* 判断当前菜单是否有子菜单
|
||||
*//*
|
||||
boolean isChildNode = true;
|
||||
if (totalCount <= 0) {
|
||||
isChildNode = false;
|
||||
}
|
||||
return isChildNode;
|
||||
}*/
|
||||
/*private boolean isTopNode(SysGlType sysGlType){
|
||||
if ("".equals(sysGlType.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
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.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.web.SequenceFlowController;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/processInfo")
|
||||
public class ProcessInfoConfigController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessInfoConfigManager processInfoConfigManager;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
@Autowired
|
||||
SequenceFlowController sequenceFlowController;
|
||||
@Autowired
|
||||
ProcessConfigService processConfigService;
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final String LIST_ACTION = "redirect:/procDefMgr/procInfo/list.do";
|
||||
|
||||
public ProcessInfoConfigController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ProcessInfoConfig query) {
|
||||
Page page = this.processInfoConfigManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/procDefMgr/procInfo/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("processDefId"));
|
||||
ProcessInfoConfig processInfoConfig = (ProcessInfoConfig)processInfoConfigManager.getById(id);
|
||||
return new ModelAndView("/procDefMgr/procInfo/show","processInfoConfig",processInfoConfig);
|
||||
}
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ProcessInfoConfig processInfoConfig) {
|
||||
return new ModelAndView("/procDefMgr/procInfo/create","processInfoConfig",processInfoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,ProcessInfoConfig processInfoConfig,RedirectAttributes redirectAttributes) {
|
||||
processInfoConfigManager.save(processInfoConfig);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request,String procDefId) {
|
||||
if(StringUtils.isEmpty(procDefId)) {
|
||||
return new ModelAndView("/procDefModelMgr/info");
|
||||
}
|
||||
ProcessInfoConfig processInfoConfig =null;
|
||||
if(StringUtils.isNotEmpty(procDefId)){
|
||||
processInfoConfig = (ProcessInfoConfig)processInfoConfigManager.getById(procDefId);
|
||||
}
|
||||
return new ModelAndView("/procDefMgr/procInfo/edit","processInfoConfig",processInfoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editTable")
|
||||
public ModelAndView editTable(HttpServletRequest request,String procDefId) {
|
||||
ProcessInfoConfig processInfoConfig =null;
|
||||
if(StringUtils.isNotEmpty(procDefId)){
|
||||
processInfoConfig = (ProcessInfoConfig)processInfoConfigManager.getById(procDefId);
|
||||
}
|
||||
return new ModelAndView("/procDefMgr/procInfo/editTable","processInfoConfig",processInfoConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request,ProcessInfoConfig processInfoConfig,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("processDefId"));
|
||||
processInfoConfigManager.saveOrUpdate(processInfoConfig);
|
||||
if(StringUtils.isNotEmpty(processInfoConfig.getProcessStartAuth())){
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(processInfoConfig.getProcessDefId());
|
||||
String[] processStartAuths=processInfoConfig.getProcessStartAuth().split(";");
|
||||
for (String processStartAuth : processStartAuths) {
|
||||
String[] auths=processStartAuth.split(":");
|
||||
if("ROLE".equals(auths[0])){
|
||||
bpmnModel.getMainProcess().getCandidateStarterGroups().add(auths[1]);
|
||||
}else if("USERS".equals(auths[0])){
|
||||
bpmnModel.getMainProcess().getCandidateStarterUsers().add(auths[1]);
|
||||
}
|
||||
}
|
||||
sequenceFlowController.updateBpmnModel(bpmnModel, processInfoConfig.getProcessDefId(),false);
|
||||
}
|
||||
return UPDATE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当流程定义为更新状态时,需要将流程定义与模型进行同步
|
||||
**/
|
||||
@RequestMapping(value = "syncProcessDefToModel")
|
||||
@ResponseBody
|
||||
public void syncProcessDefToModel(HttpServletRequest request, String modelKey) {
|
||||
ProcessInfoConfig processInfoConfig = null;
|
||||
try {
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDefBykey(modelKey);
|
||||
if (processDefinition == null) {
|
||||
return;
|
||||
}
|
||||
processInfoConfig = (ProcessInfoConfig) processInfoConfigManager
|
||||
.getById(processDefinition.getProcDefId());
|
||||
if (processInfoConfig != null && processInfoConfig.isUpdate()&&ProcessInfoConfig.PROCESS_MODEL_SYNC_STATE_N.equals(processInfoConfig.getProcessModelSyncState())) {
|
||||
processInfoConfig.setProcessModelSyncState(ProcessInfoConfig.PROCESS_MODEL_SYNC_STATE_Y);
|
||||
boolean isSync=processModelService.syncProcessModelToJsonModel(processInfoConfig
|
||||
.getProcessDefId());
|
||||
if(isSync){
|
||||
processInfoConfigManager.update(processInfoConfig);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("processDefId"));
|
||||
|
||||
processInfoConfigManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.SysGlType;
|
||||
import com.blueland.bpm.engine.config.service.SysGlTypeManager;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.blueland.bpm.manage.util.TreeNode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "sysGlType")
|
||||
public class SysGlTypeController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private SysGlTypeManager sysGlTypeManager;
|
||||
@Autowired
|
||||
SysGlTypeTreeManager sysGlTypeTreeManager;
|
||||
private final String LIST_ACTION = "redirect:/sysGlType/list.do";
|
||||
|
||||
public SysGlTypeController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,SysGlType query) {
|
||||
Page page = this.sysGlTypeManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/sysGlType/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,SysGlType sysGlType) {
|
||||
SysGlType parentSysGlType =null;
|
||||
if (StringUtils.isNotEmpty(sysGlType.getTypeParentId())){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeId(sysGlType.getTypeParentId());;
|
||||
parentSysGlType = sysGlTypeManager.getByEntity(param);
|
||||
}
|
||||
if(parentSysGlType==null){
|
||||
parentSysGlType=sysGlType;
|
||||
}
|
||||
return new ModelAndView("/sysGlType/create","sysGlType",parentSysGlType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(HttpServletRequest request,SysGlType sysGlType,RedirectAttributes redirectAttributes) {
|
||||
if(null!=sysGlType && null!=sysGlType.getTypeId() && !"".equals(sysGlType.getTypeId())){
|
||||
SysGlType result = sysGlTypeManager.getById(sysGlType.getTypeId());
|
||||
if(result != null){
|
||||
return "["+sysGlType.getAppKey()+"]"+"应用系统已存在分类ID为["+sysGlType.getTypeId()+"]的分类,请您重新输入分类ID!";
|
||||
}
|
||||
}
|
||||
sysGlTypeManager.save(sysGlType);
|
||||
return this.ACTION_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request,String typeId) {
|
||||
SysGlType sysGlType =null;
|
||||
if (StringUtils.isEmpty(typeId)){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId("NONE");
|
||||
sysGlType = sysGlTypeManager.getByEntity(param);
|
||||
}else{
|
||||
sysGlType = sysGlTypeManager.getById(typeId);
|
||||
}
|
||||
return new ModelAndView("/sysGlType/edit","sysGlType",sysGlType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入详细页面
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request,String typeId) {
|
||||
SysGlType sysGlType =null;
|
||||
if (StringUtils.isEmpty(typeId)){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId("NONE");
|
||||
sysGlType = sysGlTypeManager.getByEntity(param);
|
||||
}else{
|
||||
sysGlType = sysGlTypeManager.getById(typeId);
|
||||
}
|
||||
return new ModelAndView("/sysGlType/show","sysGlType",sysGlType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request,SysGlType sysGlType,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("typeId"));
|
||||
sysGlTypeManager.update(sysGlType);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(HttpServletRequest request,String typeId) {
|
||||
|
||||
sysGlTypeManager.removeById(typeId);
|
||||
MyContants.saveUserOperate(request, "typeId", true, "删除分类成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
/**
|
||||
*获取流程类型树
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value="geWfTypeTree",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<TreeNode> geWfTypeTree(HttpServletRequest request,String filterNodeIdsStr) throws Exception {
|
||||
String typeId=request.getParameter("id");
|
||||
System.out.println(typeId);
|
||||
List<TreeNode> treeNodes=sysGlTypeTreeManager.getTypeTree(typeId, (String)request.getSession(false).getAttribute("app_id"));
|
||||
String[] filterNodeIds=null;
|
||||
if(StringUtils.isNotEmpty(filterNodeIdsStr)){
|
||||
if(filterNodeIdsStr.indexOf(",")!=-1){
|
||||
filterNodeIds=filterNodeIdsStr.split(",");
|
||||
}else{
|
||||
filterNodeIds=new String[]{filterNodeIdsStr};
|
||||
}
|
||||
for (String filterNodeId : filterNodeIds) {
|
||||
TreeNode treeNode=new TreeNode();
|
||||
treeNode.setId(filterNodeId);
|
||||
treeNodes.remove(treeNode);
|
||||
}
|
||||
}
|
||||
return treeNodes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.common.util.StringUtils;
|
||||
import com.blueland.bpm.engine.config.dao.SysGlTypeDao;
|
||||
import com.blueland.bpm.engine.config.model.SysGlType;
|
||||
import com.blueland.bpm.engine.config.service.SysGlTypeManager;
|
||||
import com.blueland.bpm.manage.util.TreeNode;
|
||||
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class SysGlTypeTreeManager {
|
||||
@Autowired
|
||||
private SysGlTypeDao sysGlTypeDao;
|
||||
@Autowired
|
||||
private SysGlTypeManager sysGlTypeManager;
|
||||
|
||||
public List<TreeNode> getTypeTree(String typeId,String appKey) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
//当前节点
|
||||
SysGlType curNode =null;
|
||||
if (StringUtils.isEmpty(typeId)){
|
||||
//处理多个顶级节点逻辑
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId("NONE");
|
||||
List<SysGlType> topNodes = sysGlTypeManager.findByExample(param);
|
||||
for (SysGlType sysGlType : topNodes) {
|
||||
TreeNode treeNode = new TreeNode(sysGlType.getTypeId(),
|
||||
sysGlType.getTypeParentId(), sysGlType.getTypeName(), true,
|
||||
true, isChildNode(sysGlType,appKey), "TYPE", "false",0);
|
||||
treeNodeList.add(treeNode);
|
||||
addSubTreeNode(sysGlType,treeNodeList,appKey);
|
||||
}
|
||||
return treeNodeList;
|
||||
}else{
|
||||
curNode = (SysGlType) sysGlTypeManager.getById(typeId);
|
||||
}
|
||||
//ajax处理单节点逻辑
|
||||
if (curNode==null)
|
||||
return treeNodeList;
|
||||
addSubTreeNode(curNode,treeNodeList,appKey);
|
||||
return treeNodeList;
|
||||
}
|
||||
private void addSubTreeNode(SysGlType topNode,List<TreeNode> treeNodeList,String appKey){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId(topNode.getTypeId());
|
||||
if(topNode.getAppKey().equals("BIZ_TYPE")){
|
||||
param.setAppKey(appKey);
|
||||
}
|
||||
param.setSortColumns("TYPE_SORT");
|
||||
List<SysGlType> list = sysGlTypeManager.findByExample(param);
|
||||
for (SysGlType data : list) {
|
||||
addTreeNode(treeNodeList, data, false,"true");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据menu组装TreeNode对象并添加到treeNodeList中
|
||||
*
|
||||
* @param treeNodeList
|
||||
* treeNodeList
|
||||
* @param menu
|
||||
* 菜单对象
|
||||
* @param isOpenMenu
|
||||
* 是否打开菜单
|
||||
*/
|
||||
private void addTreeNode(List<TreeNode> treeNodeList, SysGlType sysGlType, boolean isOpenNode,String isAccessTopNode) {
|
||||
TreeNode treeNode = new TreeNode(sysGlType.getTypeId(),
|
||||
sysGlType.getTypeParentId(), sysGlType.getTypeName(), true,
|
||||
isOpenNode, isChildNode(sysGlType,""), "TYPE", isAccessTopNode,0);
|
||||
treeNodeList.add(treeNode);
|
||||
|
||||
}
|
||||
private boolean isChildNode(SysGlType sysGlType,String appKey){
|
||||
SysGlType param = new SysGlType();
|
||||
param.setTypeParentId(sysGlType.getTypeId());
|
||||
if(sysGlType.getAppKey().equals("BIZ_TYPE")){
|
||||
param.setAppKey(appKey);
|
||||
}
|
||||
long totalCount = sysGlTypeDao.findEntityCount(param);
|
||||
/**
|
||||
* 判断当前菜单是否有子菜单
|
||||
*/
|
||||
boolean isChildNode = true;
|
||||
if (totalCount <= 0) {
|
||||
isChildNode = false;
|
||||
}
|
||||
return isChildNode;
|
||||
}
|
||||
private boolean isTopNode(SysGlType sysGlType){
|
||||
if ("".equals(sysGlType.getTypeId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
import com.blueland.bpm.engine.config.model.*;
|
||||
import com.blueland.bpm.engine.config.dao.*;
|
||||
import com.blueland.bpm.engine.config.service.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "sysScript")
|
||||
public class SysScriptController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private SysScriptManager sysScriptManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/sysScript/list.do";
|
||||
|
||||
public SysScriptController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,SysScript query) {
|
||||
Page page = this.sysScriptManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/sysScript/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("scriptId"));
|
||||
SysScript sysScript = (SysScript)sysScriptManager.getById(id);
|
||||
return new ModelAndView("/sysScript/show","sysScript",sysScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,SysScript sysScript) {
|
||||
return new ModelAndView("/sysScript/create","sysScript",sysScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,SysScript sysScript,RedirectAttributes redirectAttributes) {
|
||||
sysScriptManager.save(sysScript);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("scriptId"));
|
||||
SysScript sysScript = (SysScript)sysScriptManager.getById(id);
|
||||
return new ModelAndView("/sysScript/edit","sysScript",sysScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,SysScript sysScript,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("scriptId"));
|
||||
sysScriptManager.update(sysScript);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("scriptId"));
|
||||
|
||||
sysScriptManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.identity.OrgService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.blueland.bpm.manage.util.TreeNode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/pages/user")
|
||||
public class UserTreeController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = "USER_SORT";
|
||||
|
||||
@Autowired
|
||||
private UserTreeManager userTreeManager;
|
||||
@Autowired
|
||||
private OrgService orgService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
public UserTreeController() {
|
||||
}
|
||||
|
||||
|
||||
public void setOrgService(OrgService orgService) {
|
||||
this.orgService = orgService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取已选择的主送抄送部门
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="queryUserInfoByUserIdsAjax")
|
||||
@ResponseBody
|
||||
public List<Org> queryUserInfoByUserIdsAjax(HttpServletRequest request){
|
||||
String orgIds = request.getParameter("userIds");
|
||||
String[] org_ids = orgIds.split(";");
|
||||
List<String> orgIdsList = Arrays.asList(org_ids);
|
||||
if(orgIdsList.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
//List<Org> orgs = orgService.findOrgByOrgIds(orgIdsList);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取已选择的用户
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="getUserByUserIdsAjax")
|
||||
@ResponseBody
|
||||
public List<Map> getUserByUserIdsAjax(HttpServletRequest request){
|
||||
String userIds = request.getParameter("userIds");
|
||||
List<Map> users = new ArrayList<Map>();
|
||||
if(null!=userIds && !"".equals(userIds)){
|
||||
String[] user_ids = userIds.split(",");
|
||||
for (String user_id : user_ids) {
|
||||
User user = userService.getUserById(user_id);
|
||||
Org org = orgService.getOrgById(user.getOrgId());
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("userId", user.getUserId());
|
||||
map.put("userName", user.getUserName());
|
||||
map.put("deptName", org.getOrgName());
|
||||
|
||||
users.add(map);
|
||||
}
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userIds获取相对应的user对象
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="queryUserByUserIdsAjax")
|
||||
@ResponseBody
|
||||
public List<User> queryUserByUserIdsAjax(HttpServletRequest request){
|
||||
List<User> users = new ArrayList<User>();
|
||||
String userIds = request.getParameter("userIds");
|
||||
String[] user_ids = userIds.split(";");
|
||||
for (String userId : user_ids) {
|
||||
User user = userService.getUserById(userId);
|
||||
Org org = orgService.getOrgById(user.getOrgId());
|
||||
user.setOrgId(org.getOrgName());
|
||||
users.add(user);
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
*获取用户组织树
|
||||
**/
|
||||
@RequestMapping(value="getUserOrgTree")
|
||||
@ResponseBody
|
||||
public List<TreeNode> getUserOrgTree(HttpServletRequest request,String filterNodeIdsStr,String showTreeType) {
|
||||
String orgId=request.getParameter("id");
|
||||
String assignTreeId=request.getParameter("assignTreeId");
|
||||
String treeLevel=request.getParameter("treeLevel");
|
||||
String searchUserName = request.getParameter("queryVal");
|
||||
String checkStatus = request.getParameter("ischecked");
|
||||
String isCheckValue = request.getParameter("isCheckValue");
|
||||
//是否默认选中
|
||||
boolean isChecked= false;
|
||||
boolean isAssignTreeFlag=false;
|
||||
if(StringUtils.isEmpty(orgId)||orgId.equals("0")){
|
||||
if(StringUtils.isEmpty(assignTreeId)){
|
||||
orgId=MyContants.TOP_ORG_ID;
|
||||
}else{
|
||||
orgId=assignTreeId;
|
||||
isAssignTreeFlag=true;
|
||||
}
|
||||
}
|
||||
if(StringUtils.isEmpty(checkStatus)){
|
||||
isChecked = true;
|
||||
}
|
||||
List<TreeNode> treeNodes=userTreeManager.getUserOrgTree(orgId,isAssignTreeFlag,showTreeType,treeLevel,searchUserName,isChecked,isCheckValue);
|
||||
String[] filterNodeIds=null;
|
||||
if(StringUtils.isNotEmpty(filterNodeIdsStr)){
|
||||
if(filterNodeIdsStr.indexOf(",")!=-1){
|
||||
filterNodeIds=filterNodeIdsStr.split(",");
|
||||
}else{
|
||||
filterNodeIds=new String[]{filterNodeIdsStr};
|
||||
}
|
||||
for (String filterNodeId : filterNodeIds) {
|
||||
TreeNode treeNode=new TreeNode();
|
||||
treeNode.setId(filterNodeId);
|
||||
treeNodes.remove(treeNode);
|
||||
}
|
||||
}
|
||||
return treeNodes;
|
||||
}
|
||||
@RequestMapping(value="userOrgTree")
|
||||
public ModelAndView userOrgTree(HttpServletRequest request,String showTreeType,String selectNodeType,boolean isShowCheckBox,String filterNodeIdsStr) {
|
||||
ModelAndView modelAndView=new ModelAndView("/commons/userOrgTree");
|
||||
//Hashtable params = HttpUtils.parseQueryString(items);
|
||||
modelAndView.addObject("showTreeType",showTreeType);
|
||||
modelAndView.addObject("filterNodeIdsStr",filterNodeIdsStr);
|
||||
modelAndView.addObject("isShowCheckBox",isShowCheckBox);
|
||||
modelAndView.addObject("selectNodeType",selectNodeType);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
*获取角色树
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value="getRoleTree")
|
||||
@ResponseBody
|
||||
public List<TreeNode> getRoleTree(HttpServletRequest request,String filterNodeIdsStr,String showTreeType) throws Exception {
|
||||
String orgId=request.getParameter("id");
|
||||
String assignTreeId=request.getParameter("assignTreeId");
|
||||
String treeLevel=request.getParameter("treeLevel");
|
||||
User user = BaseUser.getInstance().getSessionUser(request);
|
||||
String currentAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
boolean isAssignTreeFlag=false;
|
||||
if(StringUtils.isEmpty(orgId)){
|
||||
if(StringUtils.isEmpty(assignTreeId)){
|
||||
orgId=MyContants.TOP_ORG_ID;
|
||||
}else{
|
||||
orgId=assignTreeId;
|
||||
isAssignTreeFlag=true;
|
||||
}
|
||||
}
|
||||
List<TreeNode> treeNodes=userTreeManager.getRoleTree(orgId,currentAppId,isAssignTreeFlag,showTreeType,treeLevel,user.getUserId());
|
||||
return treeNodes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.bpm.manage.config.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.common.util.StringUtils;
|
||||
import com.blueland.bpm.engine.config.model.Role;
|
||||
import com.blueland.bpm.engine.config.service.RoleManager;
|
||||
import com.blueland.bpm.identity.OrgService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.blueland.bpm.manage.util.TreeNode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UserTreeManager {
|
||||
@Autowired
|
||||
// User对应的DAO类,主要用于数据库的增删改查等操作
|
||||
UserService userService;
|
||||
@Autowired
|
||||
OrgService orgService;
|
||||
|
||||
// @Autowired
|
||||
// RoleService roleService;
|
||||
@Autowired
|
||||
private RoleManager roleService;
|
||||
|
||||
public List<TreeNode> getUserOrgTree(String orgId, boolean isAssignTreeFlag,String showTreeType,String treeLevelStr,String searchUserName,
|
||||
boolean isChecked,String isCheckValue) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
if (StringUtils.isEmpty(orgId))
|
||||
return treeNodeList;
|
||||
|
||||
Org topNode = (Org) orgService.getOrgById(orgId);
|
||||
List<TreeNode> queryNodes=queryNode( orgId, searchUserName, isChecked, isCheckValue) ;
|
||||
if(!queryNodes.isEmpty()){
|
||||
return queryNodes;
|
||||
}
|
||||
if (topNode == null||topNode.getOrgId()==null){//添加应用第一次选择供应商的逻辑
|
||||
/*Org params=new Org();
|
||||
params.setOrgLevel(0);
|
||||
List<Org> orgList=orgService.findOrgByEntityCriteria(params);
|
||||
for (Org org : orgList) {
|
||||
TreeNode treeNode =null;
|
||||
String type="ORG";
|
||||
if (isTopOrg(org)) {
|
||||
type="TOPORG";
|
||||
}
|
||||
treeNode = new TreeNode(String.valueOf(org.getOrgId()),
|
||||
String.valueOf(org.getOrgParentId()), org.getOrgName(), true,
|
||||
true, true, type, "true",org.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
topNode = (Org) orgService.getOrgById(MyContants.TOP_ORG_ID);
|
||||
}*/
|
||||
|
||||
topNode=(Org) orgService.getOrgById(MyContants.TOP_ORG_ID);
|
||||
String type="TOPORG";
|
||||
TreeNode treeNode = new TreeNode(String.valueOf(topNode.getOrgId()),
|
||||
String.valueOf(topNode.getOrgParentId()), topNode.getOrgName(), true,
|
||||
true, true, type, "true",topNode.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
//return treeNodeList;
|
||||
}
|
||||
/*if (isTopOrg(topNode)) {
|
||||
TreeNode treeNode=new TreeNode(
|
||||
String.valueOf(topNode.getOrgId()), String.valueOf(topNode
|
||||
.getOrgParentId()), topNode.getOrgName(), isChecked,
|
||||
true, true, "ORG", "true",topNode.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
}*/
|
||||
if(!isChecked){
|
||||
//自定义顶级节点
|
||||
TreeNode treeNode = new TreeNode(String.valueOf(topNode.getOrgId()),
|
||||
"-1", topNode.getOrgName(), isChecked,
|
||||
true, true, "ORG", "false",0,true);
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
|
||||
try {
|
||||
List<Org> orgList = orgService.findSubOrg(topNode.getOrgId());
|
||||
for (Org suborg : orgList) {
|
||||
treeNodeList.add(new TreeNode(
|
||||
String.valueOf(suborg.getOrgId()), String.valueOf(suborg
|
||||
.getOrgParentId()), suborg.getOrgName(), isChecked,
|
||||
true, true, "ORG", "true",suborg.getOrgLevel()));
|
||||
}
|
||||
|
||||
List<User> userList = userService.findUserByOrgId(orgId);
|
||||
if(userList!=null) {
|
||||
for (User user : userList) {
|
||||
//委托初始化选中已有的委托人
|
||||
isChecked = false;
|
||||
if(!StringUtils.isEmpty(isCheckValue)){
|
||||
if(isCheckValue.equals(user.getUserId())){
|
||||
isChecked = true;
|
||||
}
|
||||
}
|
||||
treeNodeList.add( new TreeNode(String.valueOf(user.getUserId()),
|
||||
String.valueOf(user.getOrgId()), user.getUserName(), isChecked,
|
||||
true, false, "USER", "true",0));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return treeNodeList;
|
||||
}
|
||||
|
||||
|
||||
public List<TreeNode> queryNode(String orgId,String searchUserName,boolean isChecked,String isCheckValue) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
Org topNode =null;
|
||||
if (StringUtils.isEmpty(orgId)||orgId.equals(MyContants.TOP_ORG_ID)){
|
||||
topNode = (Org) orgService.getOrgById(MyContants.TOP_ORG_ID);
|
||||
}
|
||||
|
||||
if(null != searchUserName && !"".equals(searchUserName.trim())){
|
||||
List<User> userList = new ArrayList<User>();
|
||||
User query = new User();
|
||||
query.setUserName(searchUserName);
|
||||
if(MyContants.TOP_ORG_ID.equals(orgId)){
|
||||
//by lw 20220119
|
||||
//userList = userService.findUserByEntitiyCriteria(query);
|
||||
}else{
|
||||
query.setOrgId(orgId);
|
||||
//userList = userService.findUserByEntitiyCriteria(query);
|
||||
}
|
||||
if (!userList.isEmpty()) {
|
||||
List<Org> orgList=new ArrayList<Org>();
|
||||
//去重
|
||||
Map<String,String> map = new HashMap<String,String>();
|
||||
if(isTopOrg(topNode)){
|
||||
map.put(topNode.getOrgId(), topNode.getOrgId());
|
||||
}
|
||||
for (User user : userList) {
|
||||
//排除非中烟的人员
|
||||
//if(user.getCompanyId().startsWith("2043")){
|
||||
Org org = orgService.getOrgById(user.getOrgId());
|
||||
if(null!=org){
|
||||
//委托初始化选中已有的委托人
|
||||
isChecked = false;
|
||||
if(!StringUtils.isEmpty(isCheckValue)){
|
||||
if(isCheckValue.equals(user.getUserId())){
|
||||
isChecked = true;
|
||||
}
|
||||
}
|
||||
|
||||
TreeNode userNode = new TreeNode(String.valueOf(user.getUserId()),
|
||||
String.valueOf(user.getOrgId()), user.getUserName(), isChecked,
|
||||
true, false, "USER", "true",0);
|
||||
treeNodeList.add(userNode);
|
||||
if(!map.containsKey(user.getOrgId())){
|
||||
// Org org = orgService.getOrgById(user.getOrgId());
|
||||
orgList.add(org);
|
||||
map.put(org.getOrgId(), org.getOrgId());
|
||||
|
||||
while(!map.containsKey(org.getOrgParentId()) && !MyContants.TOP_ORG_ID.equals( org.getOrgParentId())){
|
||||
org = orgService.getOrgById(org.getOrgParentId());
|
||||
orgList.add(org);
|
||||
map.put(org.getOrgId(), org.getOrgId());
|
||||
}
|
||||
// if(!map.containsKey(org.getOrgParentId())){
|
||||
// Org porg = orgService.getOrgById(org.getOrgParentId());
|
||||
// if(null!=porg){
|
||||
// orgList.add(porg);
|
||||
// map.put(porg.getOrgId(), porg.getOrgId());
|
||||
// }
|
||||
}
|
||||
// }
|
||||
}
|
||||
//}
|
||||
}
|
||||
//根据用户姓名或工号查询条件查询包含满足条件的用户所在的所有组织节点,并放入树中
|
||||
if(!orgList.isEmpty()){
|
||||
for(Org org:orgList){
|
||||
addTreeNode(treeNodeList, org, true);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
treeNodeList.clear();
|
||||
|
||||
TreeNode treeNode = new TreeNode(
|
||||
String.valueOf(topNode.getOrgId()), String.valueOf(topNode
|
||||
.getOrgParentId()), topNode.getOrgName(), isChecked,
|
||||
true, false, "TOPORG", "true",topNode.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
}
|
||||
return treeNodeList;
|
||||
}
|
||||
|
||||
|
||||
public List<TreeNode> getUserOrgTree_20150521bak(String orgId, boolean isAssignTreeFlag,String showTreeType,String treeLevelStr) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
if (StringUtils.isEmpty(orgId))
|
||||
return treeNodeList;
|
||||
try {
|
||||
Org topNode = (Org) orgService.getOrgById(orgId);
|
||||
if (isTopOrg(topNode)) {
|
||||
TreeNode treeNode=new TreeNode(
|
||||
String.valueOf(topNode.getOrgId()), String.valueOf(topNode
|
||||
.getOrgParentId()), topNode.getOrgName(), true,
|
||||
true, true, "ORG", "true",topNode.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
|
||||
List<Org> orgList = orgService.findSubOrg(topNode.getOrgId());
|
||||
for (Org suborg : orgList) {
|
||||
treeNodeList.add(new TreeNode(
|
||||
String.valueOf(suborg.getOrgId()), String.valueOf(suborg
|
||||
.getOrgParentId()), suborg.getOrgName(), true,
|
||||
true, true, "ORG", "true",suborg.getOrgLevel()));
|
||||
}
|
||||
|
||||
List<User> userList = userService.findUserByOrgId(orgId);
|
||||
for (User user : userList) {
|
||||
treeNodeList.add( new TreeNode(String.valueOf(user.getUserId()),
|
||||
String.valueOf(user.getOrgId()), user.getUserName(), true,
|
||||
true, false, "USER", "true",0));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return treeNodeList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据menu组装TreeNode对象并添加到treeNodeList中
|
||||
*
|
||||
* @param treeNodeList
|
||||
* treeNodeList
|
||||
* @param org
|
||||
* 组织对象
|
||||
* @param isOpenMenu
|
||||
* 是否打开节点
|
||||
*/
|
||||
private void addTreeNode(List treeNodeList, Org org, boolean isOpenNode) {
|
||||
|
||||
List<Org> orgList=orgService.findSubOrg(org.getOrgId());
|
||||
long totalCount = orgList!=null?orgList.size():0;
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
boolean isChildNode = true;
|
||||
if (totalCount <= 0) {
|
||||
isChildNode = false;
|
||||
}
|
||||
TreeNode treeNode = new TreeNode(String.valueOf(org.getOrgId()),
|
||||
String.valueOf(org.getOrgParentId()), org.getOrgName(), true,
|
||||
isOpenNode, isChildNode, "ORG", "true",org.getOrgLevel());
|
||||
treeNodeList.add(treeNode);
|
||||
|
||||
}
|
||||
|
||||
private void addUserTreeNode(List treeNodeList, Org org, boolean isOpenNode) {
|
||||
List<User> userList = userService.findUserByOrgId(org.getOrgId());
|
||||
for (User user : userList) {
|
||||
TreeNode treeNode = new TreeNode(String.valueOf(user.getUserId()),
|
||||
String.valueOf(user.getOrgId()), user.getUserName(), true,
|
||||
isOpenNode, false, "USER", "true",0);
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
|
||||
}
|
||||
private boolean isTopOrg(Org org){
|
||||
if (MyContants.TOP_ORG_ID.equals(org.getOrgId().toString())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public List<TreeNode> getRoleTree(String orgId,String currentAppId,boolean isAssignTreeFlag,String showTreeType,String treeLevelStr,String loginUserId) {
|
||||
List<TreeNode> treeNodeList = new ArrayList<TreeNode>();
|
||||
// List<Role> roleList = roleService.findAllRole();
|
||||
Role query = new Role();
|
||||
query.setLoginUserId(loginUserId);
|
||||
query.setSortColumns("role_sort");
|
||||
query.setRoleAppId(currentAppId);
|
||||
List<Role> roleList = roleService.findRolesByParam(query);
|
||||
|
||||
for (Role role : roleList) {
|
||||
TreeNode treeNode = new TreeNode(String.valueOf(role.getRoleId()),
|
||||
role.getRoleId(), role.getRoleName(), true,
|
||||
true, false, "ROLE", "true",0);
|
||||
treeNodeList.add(treeNode);
|
||||
|
||||
}
|
||||
return treeNodeList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.dao;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.blueland.bpm.identity.model.*;
|
||||
import com.blueland.bpm.identity.dao.*;
|
||||
import com.blueland.bpm.identity.service.*;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.page.PageRequest;
|
||||
|
||||
|
||||
|
||||
@Repository
|
||||
public class AnalysisDao extends BaseIbatis3Dao<Userrole,String>{
|
||||
public List<Map<String, Object>> getAppProcessRunIndex(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getAppProcessRunIndex", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAppProcessLogByYear(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getAppProcessLogByYear", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAppProcessLogByDay(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getAppProcessLogByDay", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProEfficiencyByLine(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getProEfficiencyByLine", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getActInstByProcInstId(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getActInstByProcInstId", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProcDefEfficiency(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getProcDefEfficiency", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getActDefEfficiency(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getActDefEfficiency", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getOrgEfficiencyLineByInst(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getOrgEfficiencyLineByInst", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getOrgEfficiencyByProInst(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getOrgEfficiencyByProInst", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProInstEfficiencyByOrg(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getProInstEfficiencyByOrg", params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProInstEfficiencyByOrgPage(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getProInstEfficiencyByOrgPage", params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.dao;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
* @version 1.0
|
||||
* @since 首页统计dao
|
||||
*/
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.bpm.identity.model.Userrole;
|
||||
|
||||
|
||||
|
||||
@Repository
|
||||
public class IndexDao extends BaseIbatis3Dao<Userrole,String>{
|
||||
public int getAppCount() {
|
||||
return (Integer)getSqlSessionTemplate().selectOne("getAppCount");
|
||||
}
|
||||
public int getProcDefKeyCount() {
|
||||
return (Integer)getSqlSessionTemplate().selectOne("getProcDefKeyCount");
|
||||
}
|
||||
public Map<String, Object> getProcessRunCount() {
|
||||
return getSqlSessionTemplate().selectOne("getProcessRunCount");
|
||||
}
|
||||
public Map<String, Object> getProcessLogCount() {
|
||||
return getSqlSessionTemplate().selectOne("getProcessLogCount");
|
||||
}
|
||||
public Map<String, Object> getProcessByTime(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectOne("getProcessByTime",params);
|
||||
}
|
||||
public List<Map<String, Object>> getAppTop() {
|
||||
return getSqlSessionTemplate().selectList("getAppTop");
|
||||
}
|
||||
public List<Map<String, Object>> getSysLoadData() {
|
||||
return getSqlSessionTemplate().selectList("getSysLoadData");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.dao;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
* @version 1.0
|
||||
* @since 首页统计dao
|
||||
*/
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseIbatis3Dao;
|
||||
import com.blueland.bpm.identity.model.Userrole;
|
||||
|
||||
|
||||
|
||||
@Repository
|
||||
public class ProcessMonitorDao extends BaseIbatis3Dao<Userrole,String>{
|
||||
/**
|
||||
* 待办最多流程
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,Object>> getDoProcesss(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getDoProcesss",params);
|
||||
}
|
||||
/**
|
||||
* 耗时最长的流程
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getUseTimeMaxProcess(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getUseTimeMaxProcess",params);
|
||||
}
|
||||
/**
|
||||
* 超时最多的流程
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getOutTimeProcess(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getOutTimeProcess",params);
|
||||
}
|
||||
/**
|
||||
* 创建最多的流程
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getCreateProcess() {
|
||||
return getSqlSessionTemplate().selectList("getCreateProcess");
|
||||
}
|
||||
/**
|
||||
* 节点平均耗时
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getActAvgUseTime(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getActAvgUseTime",params);
|
||||
}
|
||||
/**
|
||||
* 待办流程最多的节点
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getDoTaskMaxAct(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getDoTaskMaxAct",params);
|
||||
}
|
||||
/**
|
||||
* 人员分析详情
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getTopUserTask(Map<String, Object> params) {
|
||||
return getSqlSessionTemplate().selectList("getTopUserTask",params);
|
||||
}
|
||||
/**
|
||||
* 通过应用id获取应用信息
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getAppById(String appId) {
|
||||
return getSqlSessionTemplate().selectOne("getAppById",appId);
|
||||
}
|
||||
/**
|
||||
* 待办最多流程 统计人数和待办流程总数
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getDoTotalProcesss() {
|
||||
return getSqlSessionTemplate().selectOne("getDoTotalProcesss");
|
||||
}
|
||||
/**
|
||||
* 超时处理最多的流程 统计人数和超时流程总数
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getOutTimeProcessTotal() {
|
||||
return getSqlSessionTemplate().selectList("getOutTimeProcessTotal");
|
||||
}
|
||||
/**
|
||||
* 创建最多的流程统计
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getCreateProcessTotal() {
|
||||
return getSqlSessionTemplate().selectOne("getCreateProcessTotal");
|
||||
}
|
||||
/**
|
||||
* 平均耗时最长的流程-统计总数
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getUseTimeMaxProcessTotal() {
|
||||
return getSqlSessionTemplate().selectOne("getUseTimeMaxProcessTotal");
|
||||
}
|
||||
/**
|
||||
* 节点平均耗时统计
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getActAvgUseTimeTotal() {
|
||||
return getSqlSessionTemplate().selectOne("getActAvgUseTimeTotal");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
<?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">
|
||||
<!-- 不使用namespace的话sql搜索定位会比较方便 -->
|
||||
<mapper namespace="com.blueland.bpm.manage.countAnalysis.dao.AnalysisDao">
|
||||
<select id="getAppProcessRunIndex" resultType="java.util.Map">
|
||||
SELECT APP.APP_ID APPID, APP.APP_NAME APPNAME, A.RUNTASKNUM, B.PROCDEFNUM, C.PROCINSTONENUM, D.PROCINSTFIVENUM FROM T_PUB_APPLICATION APP LEFT JOIN
|
||||
(SELECT T.TENANT_ID TENANTID, COUNT(*) RUNTASKNUM FROM T_WF_PROCESS_INFO_CONFIG T LEFT JOIN T_SYS_GL_TYPE G ON T.PROCESS_TYPE_ID = G.TYPE_ID WHERE T.PROCESS_MGR_ISSHOW = 'Y' GROUP BY T.TENANT_ID) A
|
||||
ON APP.APP_ID =A.TENANTID LEFT JOIN
|
||||
(SELECT TENANT_ID_ TENANTID, COUNT(*) PROCDEFNUM FROM ACT_RU_TASK
|
||||
<where>
|
||||
<if test="@Ognl@isNotEmpty(startDate)">
|
||||
CREATE_TIME_ <![CDATA[ >= ]]> TO_DATE(#{startDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(endDate)">
|
||||
AND CREATE_TIME_ <![CDATA[ <= ]]> TO_DATE(#{endDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY TENANT_ID_) B
|
||||
ON APP.APP_ID =B.TENANTID LEFT JOIN
|
||||
(SELECT TENANT_ID_ TENANTID, COUNT(*) PROCINSTONENUM FROM ACT_HI_PROCINST
|
||||
<where>
|
||||
PROC_STATE=1
|
||||
<if test="@Ognl@isNotEmpty(startDate)">
|
||||
AND START_TIME_ <![CDATA[ >= ]]> TO_DATE(#{startDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(endDate)">
|
||||
AND START_TIME_ <![CDATA[ <= ]]> TO_DATE(#{endDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY TENANT_ID_) C
|
||||
ON APP.APP_ID =C.TENANTID LEFT JOIN
|
||||
(SELECT TENANT_ID_ TENANTID, COUNT(*) PROCINSTFIVENUM FROM ACT_HI_PROCINST
|
||||
<where>
|
||||
PROC_STATE=5
|
||||
<if test="@Ognl@isNotEmpty(startDate)">
|
||||
AND START_TIME_ <![CDATA[ >= ]]> TO_DATE(#{startDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(endDate)">
|
||||
AND START_TIME_ <![CDATA[ <= ]]> TO_DATE(#{endDate,jdbcType=TIMESTAMP} , 'yyyy-mm-dd')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY TENANT_ID_) D
|
||||
ON APP.APP_ID =D.TENANTID
|
||||
<where>
|
||||
APP.APP_TYPE = 'inner'
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND APP.APP_ID = #{appId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY APP.APP_CREATE_TIME
|
||||
</select>
|
||||
|
||||
<select id="getAppProcessLogByYear" resultType="java.util.Map">
|
||||
SELECT APP.APP_ID AS APPID, APP.APP_NAME AS APPNAME, COUNT(1) AS RUNCOUNT, TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM') AS MONTH
|
||||
FROM T_PUB_APPLICATION APP LEFT JOIN T_WF_PROCESS_ERROR_LOG PRO ON APP.APP_ID = PRO.APP_ID
|
||||
<where>
|
||||
PRO.PROCESS_LOG_LEVEL='info'
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND APP.APP_ID = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(searchYear)">
|
||||
AND TO_CHAR(PRO.PELOG_CREATE_TIME, 'yyyy') = #{searchYear}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY APP.APP_ID, APP.APP_NAME, TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM')
|
||||
ORDER BY RUNCOUNT DESC, MONTH
|
||||
</select>
|
||||
|
||||
<select id="getAppProcessLogByDay" resultType="java.util.Map">
|
||||
SELECT APP.APP_ID AS APPID, APP.APP_NAME AS APPNAME, COUNT(1) AS RUNCOUNT
|
||||
FROM T_PUB_APPLICATION APP LEFT JOIN T_WF_PROCESS_ERROR_LOG PRO ON APP.APP_ID = PRO.APP_ID
|
||||
<where>
|
||||
PRO.PROCESS_LOG_LEVEL='info'
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND APP.APP_ID = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(searchDay)">
|
||||
AND TO_CHAR(PRO.PELOG_CREATE_TIME, 'yyyy-MM-dd') = #{searchDay}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY APP.APP_ID, APP.APP_NAME
|
||||
ORDER BY RUNCOUNT DESC
|
||||
</select>
|
||||
|
||||
<select id="getProEfficiencyByLine" resultType="java.util.Map">
|
||||
SELECT
|
||||
PROC.TENANT_ID_ AS APPID,
|
||||
APP.APP_NAME AS APPNAME,
|
||||
AVG(PROC.DURATION_)/86400000 AS AVGNUM,
|
||||
MAX(PROC.DURATION_)/86400000 AS MAXNUM
|
||||
FROM ACT_HI_PROCINST PROC LEFT JOIN T_PUB_APPLICATION APP ON PROC.TENANT_ID_ = APP.APP_ID
|
||||
<where>
|
||||
PROC.END_TIME_ IS NOT NULL
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND PROC.TENANT_ID_ = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(searchYear)">
|
||||
AND TO_CHAR(PROC.START_TIME_, 'yyyy') = #{searchYear}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY PROC.TENANT_ID_, APP.APP_NAME
|
||||
</select>
|
||||
<select id="getActInstByProcInstId" resultType="java.util.Map">
|
||||
SELECT ACT.NAME_ AS ACTNAME,
|
||||
ACT.SEND_USER_NAME AS SENDUSERNAME,
|
||||
ACT.SENDER_ORG_NAME AS SENDORGNAME,
|
||||
TO_CHAR(ACT.START_TIME_ , 'yyyy-MM-dd HH:mm:ss') AS STARTTIME,
|
||||
TO_CHAR(ACT.END_TIME_ , 'yyyy-MM-dd HH:mm:ss') AS ENDTIME,
|
||||
ACT.DURATION_ AS TIMENUM
|
||||
FROM ACT_HI_TASKINST ACT
|
||||
<where>
|
||||
ACT.END_TIME_ IS NOT NULL
|
||||
<if test="@Ognl@isNotEmpty(procInstId)">
|
||||
AND ACT.PROC_INST_ID_ = #{procInstId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ACT.START_TIME_ DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getProcDefEfficiency" resultType="java.util.Map">
|
||||
SELECT PRODEF.PROCESS_DEF_ID AS PROCDEFID,
|
||||
PRODEF.PROCESS_DEF_NAME AS PROCDEFNAME ,
|
||||
COUNT(*) AS PROCINSTNUM ,
|
||||
SUM(PROINST.DURATION_)/COUNT(*) AS EFFICIENCY
|
||||
FROM T_WF_PROCESS_INFO_CONFIG PRODEF LEFT JOIN ACT_HI_PROCINST PROINST ON PRODEF.PROCESS_DEF_ID = PROINST.PROC_DEF_ID_
|
||||
<where>
|
||||
PRODEF.PROCESS_MGR_ISSHOW = 'Y' AND PRODEF.PROCESS_MGR_STATE = 'RELEASE' AND PROINST.END_TIME_ IS NOT NULL
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND PRODEF.TENANT_ID = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(searchYear)">
|
||||
AND TO_CHAR(PROINST.START_TIME_, 'yyyy') = #{searchYear}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY PRODEF.PROCESS_DEF_ID, PRODEF.PROCESS_DEF_NAME
|
||||
</select>
|
||||
<select id="getActDefEfficiency" resultType="java.util.Map">
|
||||
sELECT ACTDEF.ACTIVITY_DEF_ID AS ACTDEFID,
|
||||
ACTDEF.ACTIVITY_DEF_NAME AS ACTDEFNAME,
|
||||
SUM(ACTINST.DURATION_)/COUNT(*) AS EFFICIENCY
|
||||
FROM T_WF_ACTIVITY_INFO_CONFIG ACTDEF LEFT JOIN ACT_HI_TASKINST ACTINST ON ACTDEF.ACTIVITY_DEF_ID = ACTINST.TASK_DEF_KEY_
|
||||
<where>
|
||||
ACTINST.END_TIME_ IS NOT NULL
|
||||
<if test="@Ognl@isNotEmpty(procDefId)">
|
||||
AND ACTDEF.PROCESS_DEF_ID = #{procDefId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(searchYear)">
|
||||
AND TO_CHAR(ACTINST.START_TIME_, 'yyyy') = #{searchYear}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY ACTDEF.ACTIVITY_DEF_ID, ACTDEF.ACTIVITY_DEF_NAME
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getOrgEfficiencyLineByInst" resultType="java.util.Map">
|
||||
SELECT
|
||||
PROC.TENANT_ID_ AS APPID,
|
||||
APP.APP_NAME AS APPNAME,
|
||||
AVG(PROC.DURATION_)/86400000 AS AVGNUM,
|
||||
MAX(PROC.DURATION_)/86400000 AS MAXNUM
|
||||
FROM ACT_HI_PROCINST PROC LEFT JOIN T_PUB_APPLICATION APP ON PROC.TENANT_ID_ = APP.APP_ID
|
||||
<where>
|
||||
PROC.END_TIME_ IS NOT NULL
|
||||
AND PROC.PROC_STATE = 5
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND PROC.TENANT_ID_ = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
AND PROC.STARTER_ORG_ID = #{orgId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY PROC.TENANT_ID_, APP.APP_NAME
|
||||
</select>
|
||||
<select id="getOrgEfficiencyByProInst" resultType="java.util.Map">
|
||||
SELECT ORG.ORG_ID AS ORGID,
|
||||
ORG.ORG_NAME AS ORGNAME,
|
||||
COUNT(*) AS PROINSTNUM,
|
||||
SUM(ACTINST.DURATION_)/COUNT(*) AS EFFICIENCY
|
||||
FROM T_PUB_ORG ORG LEFT JOIN ACT_HI_TASKINST ACTINST ON ORG.ORG_ID = ACTINST.ASSIGNEE_ORG_ID
|
||||
LEFT JOIN ACT_HI_PROCINST PROC ON PROC.PROC_INST_ID_ = ACTINST.PROC_INST_ID_
|
||||
<where>
|
||||
ORG.ORG_LEVEL = '1'
|
||||
AND ACTINST.END_TIME_ IS NOT NULL
|
||||
AND PROC.PROC_STATE = 5
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
AND ORG.ORG_ID = #{orgId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND ACTINST.TENANT_ID_ = #{appId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY ORG.ORG_ID, ORG.ORG_NAME
|
||||
</select>
|
||||
<select id="getProInstEfficiencyByOrg" resultType="java.util.Map">
|
||||
SELECT ACTINST.PROC_DEF_NAME AS PROCDEFNAME,
|
||||
ACTINST.PROC_TITLE AS PROCTITLE,
|
||||
ACTINST.NAME_ AS ACTINSTNAME,
|
||||
ACTINST.ASSIGNEE_USER_NAME AS USERNAME,
|
||||
ACTINST.START_TIME_ AS STARTTIME,
|
||||
ACTINST.END_TIME_ AS ENDTIME,
|
||||
ACTINST.DURATION_ AS EFFICIENCY
|
||||
FROM ACT_HI_TASKINST ACTINST LEFT JOIN ACT_HI_PROCINST PROC ON ACTINST.PROC_INST_ID_ = PROC.PROC_INST_ID_
|
||||
<where>
|
||||
ACTINST.END_TIME_ IS NOT NULL
|
||||
AND PROC.PROC_STATE = 5
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
AND ACTINST.ASSIGNEE_ORG_ID = #{orgId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND ACTINST.TENANT_ID_ = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(procDefName)">
|
||||
AND ACTINST.PROC_DEF_NAME like '%${procDefName}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(procTitle)">
|
||||
AND ACTINST.PROC_TITLE like '%${procTitle}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(actInstName)">
|
||||
AND ACTINST.NAME_ like '%${actInstName}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userName)">
|
||||
AND ACTINST.ASSIGNEE_USER_NAME like '%${userName}%'
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ACTINST.DURATION_ DESC
|
||||
</select>
|
||||
<select id="getProInstEfficiencyByOrgPage" resultType="java.util.Map">
|
||||
SELECT * FROM (
|
||||
SELECT A.*, ROWNUM RNUM FROM (
|
||||
SELECT ACTINST.PROC_DEF_NAME AS PROCDEFNAME,
|
||||
ACTINST.PROC_TITLE AS PROCTITLE,
|
||||
ACTINST.NAME_ AS ACTINSTNAME,
|
||||
ACTINST.ASSIGNEE_USER_NAME AS USERNAME,
|
||||
ACTINST.START_TIME_ AS STARTTIME,
|
||||
ACTINST.END_TIME_ AS ENDTIME,
|
||||
ACTINST.DURATION_ AS EFFICIENCY
|
||||
FROM ACT_HI_TASKINST ACTINST LEFT JOIN ACT_HI_PROCINST PROC ON ACTINST.PROC_INST_ID_ = PROC.PROC_INST_ID_
|
||||
<where>
|
||||
ACTINST.END_TIME_ IS NOT NULL
|
||||
AND PROC.PROC_STATE = 5
|
||||
<if test="@Ognl@isNotEmpty(orgId)">
|
||||
AND ACTINST.ASSIGNEE_ORG_ID = #{orgId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(appId)">
|
||||
AND ACTINST.TENANT_ID_ = #{appId}
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(procDefName)">
|
||||
AND ACTINST.PROC_DEF_NAME like '%${procDefName}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(procTitle)">
|
||||
AND ACTINST.PROC_TITLE like '%${procTitle}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(actInstName)">
|
||||
AND ACTINST.NAME_ like '%${actInstName}%'
|
||||
</if>
|
||||
<if test="@Ognl@isNotEmpty(userName)">
|
||||
AND ACTINST.ASSIGNEE_USER_NAME like '%${userName}%'
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ACTINST.DURATION_ DESC
|
||||
) A
|
||||
<where>
|
||||
<if test="@Ognl@isNotEmpty(endRow)">
|
||||
ROWNUM <![CDATA[ < ]]> #{endRow}
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
<where>
|
||||
<if test="@Ognl@isNotEmpty(startRow)">
|
||||
RNUM <![CDATA[ >= ]]> #{startRow}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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">
|
||||
<!-- 不使用namespace的话sql搜索定位会比较方便 -->
|
||||
<mapper namespace="com.blueland.bpm.manage.countAnalysis.dao.IndexDao">
|
||||
<!-- 流程应用总数 -->
|
||||
<select id="getAppCount" resultType="java.lang.Integer">
|
||||
SELECT count(1) as count FROM T_PUB_APPLICATION WHERE APP_TYPE !='task'
|
||||
</select>
|
||||
<!-- 流程定义总数 -->
|
||||
<select id="getProcDefKeyCount" resultType="java.lang.Integer">
|
||||
SELECT count(1) as count FROM T_WF_PROCESS_INFO_CONFIG t WHERE t.PROCESS_MGR_ISSHOW = 'Y'
|
||||
</select>
|
||||
<!-- 流程运行情况 -->
|
||||
<select id="getProcessRunCount" resultType="java.util.Map">
|
||||
SELECT count(1) AS total, count(CASE WHEN res.PROC_STATE =1 THEN 'un_deal' END) un_deal,
|
||||
count(CASE WHEN res.PROC_STATE =5 THEN 'deal' END) deal,
|
||||
count(CASE WHEN res.PROC_STATE =3 THEN 'cancle' END) cancle from ACT_HI_PROCINST RES
|
||||
</select>
|
||||
<!-- 流程执行情况 -->
|
||||
<select id="getProcessLogCount" resultType="java.util.Map">
|
||||
SELECT count(CASE WHEN PROCESS_LOG_LEVEL ='info' THEN 'info' END) info,
|
||||
count(CASE WHEN PROCESS_LOG_LEVEL ='error' THEN 'error' END) error
|
||||
FROM T_WF_PROCESS_ERROR_LOG
|
||||
</select>
|
||||
<!-- 近一年、一月、一周流程 -->
|
||||
<select id="getProcessByTime" resultType="java.util.Map">
|
||||
SELECT * FROM
|
||||
(SELECT count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(add_months(sysdate,-12),'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'year' END) YEAR,
|
||||
count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(sysdate-30,'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'month' END) month,
|
||||
count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(sysdate-7,'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'week' END) week from ACT_HI_PROCINST PRO WHERE pro.proc_state = 1 ),
|
||||
(SELECT count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(add_months(sysdate,-12),'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'year' END) finish_YEAR,
|
||||
count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(sysdate-30,'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'month' END) finish_month,
|
||||
count(CASE WHEN PRO.START_TIME_ >= to_date(to_char(sysdate-7,'yyyy-mm-dd'),'yyyy-mm-dd') THEN 'week' END) finish_week from ACT_HI_PROCINST PRO WHERE pro.proc_state = 5)
|
||||
</select>
|
||||
<!-- 应用监控TOP -->
|
||||
<select id="getAppTop" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(1) AS RUNCOUNT, TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM') AS MONTH,APP.APP_ID AS APPID, APP.APP_NAME AS APPNAME
|
||||
FROM
|
||||
T_PUB_APPLICATION APP
|
||||
LEFT JOIN
|
||||
T_WF_PROCESS_ERROR_LOG PRO
|
||||
ON APP.APP_ID = PRO.APP_ID
|
||||
WHERE
|
||||
PRO.PROCESS_LOG_LEVEL='info'
|
||||
AND TO_CHAR(PRO.PELOG_CREATE_TIME, 'yyyy') = to_char(sysdate,'yyyy')
|
||||
GROUP BY
|
||||
TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM'),APP.APP_ID,APP.APP_NAME
|
||||
ORDER BY
|
||||
RUNCOUNT DESC, MONTH
|
||||
</select>
|
||||
<!-- 系统负载数据 -->
|
||||
<select id="getSysLoadData" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(1) AS RUNCOUNT, TO_CHAR(PRO.PELOG_CREATE_TIME, 'DD') AS DAY,TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM') AS MONTH
|
||||
FROM
|
||||
T_PUB_APPLICATION APP
|
||||
LEFT JOIN
|
||||
T_WF_PROCESS_ERROR_LOG PRO
|
||||
ON APP.APP_ID = PRO.APP_ID
|
||||
WHERE
|
||||
PRO.PROCESS_LOG_LEVEL='info'
|
||||
AND to_date(TO_CHAR(PRO.PELOG_CREATE_TIME, 'yyyy-MM-DD'),'yyyy-MM-DD') >= to_date(to_char(sysdate-10,'yyyy-MM-DD'),'yyyy-MM-DD')
|
||||
GROUP BY
|
||||
TO_CHAR(PRO.PELOG_CREATE_TIME, 'DD') ,TO_CHAR(PRO.PELOG_CREATE_TIME, 'MM')
|
||||
ORDER BY
|
||||
MONTH, DAY
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
<?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">
|
||||
<!-- 不使用namespace的话sql搜索定位会比较方便 -->
|
||||
<mapper namespace="com.blueland.bpm.manage.countAnalysis.dao.ProcessMonitorDao">
|
||||
<!-- 待办最多的流程 -->
|
||||
<select id="getDoProcesss" resultType="java.util.Map">
|
||||
select * from (select
|
||||
COUNT(*) COUNT,RES.TENANT_ID_ as APP_ID,RES.PROC_DEF_ID_ AS PROC_DEF_ID ,RES.PROC_DEF_NAME AS NAME
|
||||
<!-- 如果有租户就统计该应用的待办人员 -->
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
,COUNT(DISTINCT RES.ASSIGNEE_USER_ID) STAFFCOUNT
|
||||
</if> -->
|
||||
FROM ACT_RU_TASK RES WHERE 1=1
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND RES.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY RES.TENANT_ID_,RES.PROC_DEF_ID_,RES.PROC_DEF_NAME
|
||||
ORDER BY COUNT DESC) WHERE 1 =1
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 待办最多的流程 统计总人数和总流程数 -->
|
||||
<select id="getDoTotalProcesss" resultType="java.util.Map">
|
||||
select
|
||||
COUNT(*) COUNT,COUNT(DISTINCT RES.ASSIGNEE_USER_ID) STAFFCOUNT
|
||||
FROM
|
||||
ACT_RU_TASK RES
|
||||
</select>
|
||||
<!-- 超时处理最多的流程 -->
|
||||
<select id="getOutTimeProcess" resultType="java.util.Map">
|
||||
SELECT * FROM (
|
||||
SELECT
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
COUNT(*) AS TOTAL,
|
||||
</if> -->
|
||||
PRO.PROC_DEF_ID_ as PROC_DEF_ID,PRO.PROC_DEF_NAME,PRO.TENANT_ID_ AS APP_ID,ROUND(MAX (CASE WHEN PRO.PROC_STATE = 5 THEN (cast(PRO.END_TIME_ AS DATE)-cast(PRO.START_TIME_ AS DATE))* 24 END),2) FINISH_OVER_TIME,
|
||||
ROUND(MAX (CASE WHEN PRO.PROC_STATE = 1 THEN (SYSDATE-cast(PRO.START_TIME_ AS DATE))* 24 END),2) RUN_OVER_TIME
|
||||
FROM ACT_HI_PROCINST PRO WHERE PRO.PROC_STATE != 3
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND PRO.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY PRO.PROC_DEF_ID_,PRO.PROC_DEF_NAME,PRO.TENANT_ID_ ORDER BY FINISH_OVER_TIME DESC ) TT
|
||||
WHERE TT.FINISH_OVER_TIME IS NOT NULL
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 超时处理最多的流程 统计人数和超时流程总数 -->
|
||||
<select id="getOutTimeProcessTotal" resultType="java.util.Map">
|
||||
SELECT
|
||||
(COUNT(CASE WHEN PRO.PROC_STATE =5 THEN 'DEAL' END) + COUNT(CASE WHEN PRO.PROC_STATE =1 THEN 'UN_DEAL' END)) COUNT
|
||||
FROM
|
||||
ACT_HI_PROCINST PRO WHERE PRO.PROC_STATE != 3
|
||||
UNION ALL
|
||||
SELECT COUNT(DISTINCT t.START_USER_ID_) COUNT FROM ACT_HI_PROCINST t WHERE t.PROC_STATE != 3
|
||||
</select>
|
||||
<!-- 创建最高的流程 -->
|
||||
<select id="getCreateProcess" resultType="java.util.Map">
|
||||
SELECT * FROM (SELECT COUNT(*) CREATECOUNT,POR.TENANT_ID_ AS APP_ID,count(CASE WHEN POR.PROC_STATE =1 THEN 'un_deal' END) un_deal,
|
||||
count(CASE WHEN POR.PROC_STATE =5 THEN 'deal' END) deal,
|
||||
count(CASE WHEN POR.PROC_STATE =3 THEN 'cancle' END) cancle,
|
||||
POR.PROC_DEF_ID_ AS PROC_DEF_ID, POR.PROC_DEF_NAME
|
||||
FROM ACT_HI_PROCINST POR WHERE 1=1
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND POR.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY POR.TENANT_ID_,POR.PROC_DEF_ID_, POR.PROC_DEF_NAME ORDER BY CREATECOUNT DESC
|
||||
)
|
||||
WHERE 1 =1
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 创建最高的流程 -->
|
||||
<select id="getCreateProcessTotal" resultType="java.util.Map">
|
||||
SELECT COUNT(*) CREATECOUNT,count(CASE WHEN POR.PROC_STATE =1 THEN 'un_deal' END) un_deal,
|
||||
count(CASE WHEN POR.PROC_STATE =5 THEN 'deal' END) deal,
|
||||
count(CASE WHEN POR.PROC_STATE =3 THEN 'cancle' END) cancle
|
||||
FROM ACT_HI_PROCINST POR
|
||||
</select>
|
||||
<!-- 消耗最长的的流程 -->
|
||||
<select id="getUseTimeMaxProcess" resultType="java.util.Map">
|
||||
select * from (SELECT
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
COUNT(*) AS TOTAL,
|
||||
</if> -->
|
||||
PRO.TENANT_ID_ AS APP_ID,PRO.PROC_DEF_NAME AS NAME,PROC_DEF_ID_ AS PROC_DEF_ID,ROUND(AVG((cast(PRO.END_TIME_ AS DATE)-cast(PRO.START_TIME_ AS DATE))* 24),2) COUNT
|
||||
from
|
||||
ACT_HI_PROCINST PRO WHERE PRO.PROC_STATE = 5
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND PRO.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY PRO.TENANT_ID_,PRO.PROC_DEF_NAME,PRO.PROC_DEF_ID_
|
||||
ORDER BY COUNT DESC) WHERE 1 =1
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 消耗最长的的流程统计 -->
|
||||
<select id="getUseTimeMaxProcessTotal" resultType="java.util.Map">
|
||||
SELECT COUNT(*) AS MODELTOTAL,SUM(TOTAL) AS TOTAL FROM (
|
||||
SELECT
|
||||
COUNT(*) AS TOTAL
|
||||
from
|
||||
ACT_HI_PROCINST PRO
|
||||
WHERE
|
||||
PRO.PROC_STATE = 5
|
||||
GROUP BY
|
||||
PRO.TENANT_ID_,PRO.PROC_DEF_NAME,PRO.PROC_DEF_ID_ )
|
||||
</select>
|
||||
<!-- 节点平均耗时 -->
|
||||
<select id="getActAvgUseTime" resultType="java.util.Map">
|
||||
SELECT * FROM (SELECT
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
COUNT(*) AS TOTAL,
|
||||
</if> -->
|
||||
t.TASK_DEF_KEY_ as TASK_DEF_KEY,t.NAME_ AS NAME,t.TENANT_ID_ AS APP_ID, ROUND(avg((cast(t.END_TIME_ AS DATE)-cast(t.START_TIME_ AS DATE)) * 24),2) AS COUNT
|
||||
from ACT_HI_TASKINST t
|
||||
WHERE t.NAME_ IS NOT NULL AND t.END_TIME_ IS NOT NULL
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND t.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY t.TASK_DEF_KEY_,t.NAME_,t.TENANT_ID_
|
||||
ORDER BY COUNT desc) TT
|
||||
WHERE 1=1
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 节点平均耗时统计 -->
|
||||
<select id="getActAvgUseTimeTotal" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(*) AS TOTAL, COUNT(DISTINCT t.SEND_USER_ID) STAFFCOUNT
|
||||
from
|
||||
ACT_HI_TASKINST t
|
||||
WHERE
|
||||
t.NAME_ IS NOT NULL
|
||||
AND t.END_TIME_ IS NOT NULL
|
||||
</select>
|
||||
<!-- 待办流程最多的节点 -->
|
||||
<select id="getDoTaskMaxAct" resultType="java.util.Map">
|
||||
SELECT * FROM (SELECT COUNT(*) AS COUNT, RES.TENANT_ID_ AS APP_ID,RES.NAME_ AS NAME,RES.TASK_DEF_KEY_ AS TASK_DEF_KEY
|
||||
FROM
|
||||
ACT_RU_TASK RES
|
||||
WHERE 1=1
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND RES.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY RES.TENANT_ID_,RES.NAME_,RES.TASK_DEF_KEY_
|
||||
ORDER BY COUNT DESC)
|
||||
WHERE 1 =1
|
||||
<!-- <if test="@Ognl@isEmpty(appId)"> -->
|
||||
<![CDATA[and ROWNUM<=10]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
<!-- 员工top50-->
|
||||
<select id="getTopUserTask" resultType="java.util.Map">
|
||||
SELECT * FROM (SELECT RES.TENANT_ID_ AS APP_ID,RES.ASSIGNEE_USER_ID,RES.ASSIGNEE_USER_NAME AS NAME,COUNT(*) COUNT
|
||||
FROM ACT_RU_TASK RES
|
||||
WHERE 1=1
|
||||
<!-- <if test="@Ognl@isNotEmpty(appId)">
|
||||
AND RES.TENANT_ID_ = #{appId}
|
||||
</if> -->
|
||||
GROUP BY RES.TENANT_ID_,RES.ASSIGNEE_USER_ID,RES.ASSIGNEE_USER_NAME
|
||||
ORDER BY COUNT DESC)
|
||||
WHERE 1 =1
|
||||
<!-- <if test="@Ognl@isEmpty(all)"> -->
|
||||
<![CDATA[and ROWNUM<=20]]>
|
||||
<!-- </if> -->
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 该类主要负责系统主要业务逻辑的实现,如多表处理的事务操作、权限控制等
|
||||
* 该类根据具体的业务逻辑来调用该实体对应的Dao或者多个Dao来实现数据库操作
|
||||
* 实际的数据库操作在对应的Dao或其他Dao中实现
|
||||
*/
|
||||
|
||||
package com.blueland.bpm.manage.countAnalysis.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.identity.RoleService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.dao.UserQueryDao;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.Role;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.identity.util.IdentityException;
|
||||
import com.blueland.bpm.manage.countAnalysis.dao.AnalysisDao;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
@Service
|
||||
public class AnalysisService{
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AnalysisService.class);
|
||||
@Autowired
|
||||
private AnalysisDao analysisDao;
|
||||
|
||||
public List<Map<String, Object>> getAppProcessRunIndex(Map<String, Object> params) {
|
||||
return analysisDao.getAppProcessRunIndex(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAppProcessLogByYear(Map<String, Object> params) {
|
||||
return analysisDao.getAppProcessLogByYear(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAppProcessLogByDay(Map<String, Object> params) {
|
||||
return analysisDao.getAppProcessLogByDay(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProEfficiencyByLine(Map<String, Object> params) {
|
||||
return analysisDao.getProEfficiencyByLine(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getActInstByProcInstId(Map<String, Object> params) {
|
||||
return analysisDao.getActInstByProcInstId(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProcDefEfficiency(Map<String, Object> params) {
|
||||
return analysisDao.getProcDefEfficiency(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getActDefEfficiency(Map<String, Object> params) {
|
||||
return analysisDao.getActDefEfficiency(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getOrgEfficiencyLineByInst(Map<String, Object> params) {
|
||||
return analysisDao.getOrgEfficiencyLineByInst(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getOrgEfficiencyByProInst(Map<String, Object> params) {
|
||||
return analysisDao.getOrgEfficiencyByProInst(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProInstEfficiencyByOrg(Map<String, Object> params) {
|
||||
return analysisDao.getProInstEfficiencyByOrg(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getProInstEfficiencyByOrgPage(Map<String, Object> params) {
|
||||
return analysisDao.getProInstEfficiencyByOrgPage(params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.manage.countAnalysis.dao.IndexDao;
|
||||
|
||||
import groovy.util.logging.Slf4j;
|
||||
|
||||
/**
|
||||
* @作者 dsl
|
||||
* @创建时间 2020年2月5日
|
||||
* @说明 首页统计
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class IndexService{
|
||||
@Autowired
|
||||
private IndexDao indexDao;
|
||||
/**
|
||||
* 所有流程
|
||||
* @return
|
||||
*/
|
||||
public int getAppCount() {
|
||||
return indexDao.getAppCount();
|
||||
}
|
||||
/**
|
||||
* 流程定义总数
|
||||
* @return
|
||||
*/
|
||||
public int getProcDefKeyCount() {
|
||||
return indexDao.getProcDefKeyCount();
|
||||
}
|
||||
/**
|
||||
* 流程运行情况总数
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getProcessRunCount() {
|
||||
return indexDao.getProcessRunCount();
|
||||
}
|
||||
/**
|
||||
* 流程执行情况
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getProcessLogCount() {
|
||||
return indexDao.getProcessLogCount();
|
||||
}
|
||||
/**
|
||||
* 近一年、一月、一周流程
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getProcessByTime(Map<String, Object> params) {
|
||||
return indexDao.getProcessByTime(params);
|
||||
}
|
||||
/**
|
||||
* 流程运行情况
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getAllFlowDatas() {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//流程运行情况总数
|
||||
Map<String,Object> precessRunCount = indexDao.getProcessRunCount();
|
||||
//近一年、一月、一周流程
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
Map<String,Object> runCount = indexDao.getProcessByTime(params);
|
||||
//所有流程
|
||||
int total = Integer.parseInt(precessRunCount.get("TOTAL").toString());
|
||||
int un_deal = Integer.parseInt(precessRunCount.get("UN_DEAL").toString());
|
||||
int deal = Integer.parseInt(precessRunCount.get("DEAL").toString());
|
||||
list.add(this.appendPie("allFlow","所有流程",un_deal,deal,total));
|
||||
//近一年流程
|
||||
int runYear = Integer.parseInt(runCount.get("YEAR").toString());
|
||||
int finishYear = Integer.parseInt(runCount.get("FINISH_YEAR").toString());
|
||||
int yearTotal = runYear+finishYear;
|
||||
list.add(this.appendPie("yearFlow","近一年流程",runYear,finishYear,yearTotal));
|
||||
//近一月流程
|
||||
int runMonth = Integer.parseInt(runCount.get("MONTH").toString());
|
||||
int finishMonth = Integer.parseInt(runCount.get("FINISH_MONTH").toString());
|
||||
int monthTotal = runMonth+finishMonth;
|
||||
list.add(this.appendPie("monthFlow","近一月流程",runMonth,finishMonth,monthTotal));
|
||||
//近一星期流程
|
||||
int runWeek = Integer.parseInt(runCount.get("WEEK").toString());
|
||||
int finishWeek = Integer.parseInt(runCount.get("FINISH_WEEK").toString());
|
||||
int weekTotal = runWeek+finishWeek;
|
||||
list.add(this.appendPie("weekFlow","近一星期流程",runWeek,finishWeek,weekTotal));
|
||||
//组装 总计、作废、已处理、未处理总数数据
|
||||
Map<String,Object> singleCount = new HashMap<String,Object>();
|
||||
singleCount.put("total", total);
|
||||
singleCount.put("cancle", precessRunCount.get("CANCLE"));
|
||||
singleCount.put("deal", deal);
|
||||
singleCount.put("un_deal", un_deal);
|
||||
singleCount.put("id", "singleCount");
|
||||
list.add(singleCount);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 拼装饼图需要的数据
|
||||
* @param id
|
||||
* @param name
|
||||
* @param run
|
||||
* @param finish
|
||||
* @param total
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> appendPie(String id, String name, int run, int finish, int total) {
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", id);
|
||||
obj.put("name", name);
|
||||
obj.put("allCount", "<br>("+total+")");
|
||||
obj.put("datas", this.getAppendDatas(run,finish));
|
||||
return obj;
|
||||
}
|
||||
/**
|
||||
* 拼装饼图数组
|
||||
* @param run
|
||||
* @param finish
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> getAppendDatas(int run, int finish) {
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> runData = new HashMap<String, Object>();
|
||||
runData.put("name", "运行中");
|
||||
runData.put("y", run);
|
||||
datas.add(runData);
|
||||
Map<String,Object> finishData = new HashMap<String, Object>();
|
||||
finishData.put("name", "已完成");
|
||||
finishData.put("y", finish);
|
||||
datas.add(finishData);
|
||||
return datas;
|
||||
}
|
||||
public Map<String, Object> getProcessMonitorTop() {
|
||||
String column = "";
|
||||
String row = "";
|
||||
//获取横坐标数据
|
||||
List<String> monthList = initMonth();
|
||||
for (String month : monthList) {
|
||||
row += "'" + month + "月',";
|
||||
}
|
||||
if (!StringUtils.isEmpty(row)) {
|
||||
row = row.substring(0, row.length() - 1);
|
||||
}
|
||||
List<Map<String, Object>> processLogResult = indexDao.getAppTop();
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
Map<String, List> resultMap = new LinkedHashMap<String, List>();
|
||||
for (Map<String , Object> obj : processLogResult) {
|
||||
if (resultMap.containsKey(obj.get("APPNAME"))) {
|
||||
List<Map> resultList = resultMap.get(obj.get("APPNAME"));
|
||||
resultList.add(obj);
|
||||
} else {
|
||||
List<Map> resultList = new ArrayList<Map>();
|
||||
resultList.add(obj);
|
||||
resultMap.put(obj.get("APPNAME").toString(), resultList);
|
||||
}
|
||||
int runCountInt = Integer.parseInt(obj.get("RUNCOUNT").toString());
|
||||
|
||||
}
|
||||
//获取纵坐标数据
|
||||
for (Map.Entry<String, List> entry : resultMap.entrySet()) {
|
||||
List<Map<String, List>> processLogResultList = entry.getValue();
|
||||
String data = "";
|
||||
column += "{name: '" + entry.getKey() + "',";
|
||||
for (String month : monthList) {
|
||||
boolean isContains = false;
|
||||
Map<String, List> processLog = null;
|
||||
for (Map<String, List> processLog1 : processLogResultList) {
|
||||
if (month.equals(processLog1.get("MONTH"))) {
|
||||
isContains = true;
|
||||
processLog = processLog1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isContains) {
|
||||
data += processLog.get("RUNCOUNT") + ",";
|
||||
} else {
|
||||
data += "0,";
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(data)) {
|
||||
data = data.substring(0, data.length() - 1);
|
||||
}
|
||||
column += "data: eval([" + data + "])},";
|
||||
}
|
||||
|
||||
result.put("row", row);
|
||||
result.put("column", column);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 系统负载数据
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getSysLoadData() {
|
||||
List<Map<String, Object>> list = indexDao.getSysLoadData();
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
ArrayList<ArrayList> datas =new ArrayList<ArrayList>();
|
||||
for (Map<String, Object> obj : list) {
|
||||
ArrayList<String> data=new ArrayList<String>();
|
||||
data.add("'"+Integer.parseInt(obj.get("MONTH").toString())+"-"+Integer.parseInt(obj.get("DAY").toString())+"'");
|
||||
data.add(obj.get("RUNCOUNT").toString());
|
||||
datas.add(data);
|
||||
}
|
||||
result.put("datas", "[{data:"+datas+"}]");
|
||||
return result;
|
||||
}
|
||||
private List<String> initMonth(){
|
||||
List<String> months=new ArrayList<String>();
|
||||
for (int i = 1; i <=12; i++) {
|
||||
if(i<10){
|
||||
months.add("0"+i);
|
||||
}else{
|
||||
months.add(""+i);
|
||||
}
|
||||
}
|
||||
return months;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.service;
|
||||
/**
|
||||
* @作者 lw
|
||||
* @创建时间 2020年2月11日
|
||||
* @说明
|
||||
*/
|
||||
import org.apache.commons.io.filefilter.FileFilterUtils;
|
||||
import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
|
||||
import org.apache.commons.io.monitor.FileAlterationMonitor;
|
||||
import org.apache.commons.io.monitor.FileAlterationObserver;
|
||||
|
||||
/***
|
||||
* 自定义文件监视器,可用来实现热更配置文件/监听文件场景
|
||||
*
|
||||
* @author Zane
|
||||
* @Time 2019年1月5日 上午10:41:12
|
||||
*/
|
||||
public class MyFileAlterationMonitor {
|
||||
|
||||
private String path; // 文件夹目录
|
||||
|
||||
private String fileSuffix; // 需要监听的文件名后缀
|
||||
|
||||
private long interval; // 监听间隔
|
||||
|
||||
private static final long DEFAULT_INTERVAL = 10 * 1000; // 默认监听间隔10s
|
||||
|
||||
private FileAlterationListenerAdaptor listener; // 事件处理类对象
|
||||
|
||||
public MyFileAlterationMonitor() {
|
||||
this.interval = DEFAULT_INTERVAL;
|
||||
}
|
||||
|
||||
public MyFileAlterationMonitor(String path, String fileSuffix, FileAlterationListenerAdaptor listenerAdaptor) {
|
||||
this.path = path;
|
||||
this.fileSuffix = fileSuffix;
|
||||
this.interval = DEFAULT_INTERVAL;
|
||||
this.listener = listenerAdaptor;
|
||||
}
|
||||
|
||||
public MyFileAlterationMonitor(String path, String fileSuffix, long interval,
|
||||
FileAlterationListenerAdaptor listenerAdaptor) {
|
||||
this.path = path;
|
||||
this.fileSuffix = fileSuffix;
|
||||
this.interval = interval;
|
||||
this.listener = listenerAdaptor;
|
||||
}
|
||||
|
||||
/***
|
||||
* 开启监听
|
||||
*/
|
||||
public void start() {
|
||||
if (path == null) {
|
||||
throw new IllegalStateException("Listen path must not be null");
|
||||
}
|
||||
if (listener == null) {
|
||||
throw new IllegalStateException("Listener must not be null");
|
||||
}
|
||||
|
||||
// 设定观察者,监听.properties文件
|
||||
FileAlterationObserver observer = new FileAlterationObserver(path,
|
||||
FileFilterUtils.suffixFileFilter(fileSuffix));
|
||||
|
||||
// 给观察者添加监听事件
|
||||
observer.addListener(listener);
|
||||
|
||||
// 开启一个监视器,监听频率是5s一次
|
||||
// FileAlterationMonitor本身实现了 Runnable,是单独的一个线程,按照设定的时间间隔运行,默认间隔是 10s
|
||||
FileAlterationMonitor monitor = new FileAlterationMonitor(interval);
|
||||
|
||||
monitor.addObserver(observer);
|
||||
|
||||
try {
|
||||
monitor.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public void setFileSuffix(String fileSuffix) {
|
||||
this.fileSuffix = fileSuffix;
|
||||
}
|
||||
|
||||
public void setAdaptor(FileAlterationListenerAdaptor listenerAdaptor) {
|
||||
this.listener = listenerAdaptor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.service;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
|
||||
import org.apache.commons.io.monitor.FileAlterationObserver;
|
||||
|
||||
/***
|
||||
* 文件变动事件处理器类
|
||||
* @author Zane
|
||||
* @Time 2019年1月5日 上午11:03:35
|
||||
*/
|
||||
public class MyFileListenerAdaptor extends FileAlterationListenerAdaptor{
|
||||
|
||||
@Override
|
||||
public void onFileCreate(File file) {
|
||||
System.out.println("file create.............:"+file.getAbsolutePath());
|
||||
super.onFileCreate(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileDelete(File file) {
|
||||
System.out.println("file delete.............:"+file.getAbsolutePath());
|
||||
super.onFileDelete(file);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart(FileAlterationObserver observer) {
|
||||
// System.out.println("start");
|
||||
super.onStart(observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(FileAlterationObserver observer) {
|
||||
// System.out.println("stop");
|
||||
super.onStop(observer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDirectoryCreate(File directory) {
|
||||
System.out.println("dir create........."+directory.getName());
|
||||
super.onDirectoryCreate(directory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDirectoryDelete(File directory) {
|
||||
System.out.println("dir delete........."+directory.getName());
|
||||
super.onDirectoryCreate(directory);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
MyFileAlterationMonitor monitor = new MyFileAlterationMonitor("C:\\Program Files (x86)\\FlowPortal BPM 6.x\\Attachments",
|
||||
"",
|
||||
new MyFileListenerAdaptor());
|
||||
monitor.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
package com.blueland.bpm.manage.countAnalysis.service;
|
||||
|
||||
import com.blueland.bpm.engine.util.BaseSpringJdbcDao;
|
||||
import com.blueland.bpm.manage.countAnalysis.dao.ProcessMonitorDao;
|
||||
import groovy.util.logging.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @作者 dsl
|
||||
* @创建时间 2020年2月5日
|
||||
* @说明 流程监控
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ProcessMonitorService{
|
||||
@Autowired
|
||||
private ProcessMonitorDao processMonitorDao;
|
||||
/**
|
||||
* 流程分析详情
|
||||
* 待办最多流程、超时处理最多流程、创建量最高流程、平均审批耗时最长流程
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> analysisDetail() {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//待办最多流程
|
||||
List<Map<String,Object>> daiBanList = processMonitorDao.getDoProcesss(null);
|
||||
list.add(this.appendData("daiBanTotal",daiBanList,"APP_ID"));
|
||||
//超时最多的流程
|
||||
List<Map<String,Object>> overTimeList = processMonitorDao.getOutTimeProcess(null);
|
||||
list.add(this.appendOverData("overTimeTotal",overTimeList,"APP_ID"));
|
||||
//创建最多的流程
|
||||
List<Map<String,Object>> createProcessList = processMonitorDao.getCreateProcess();
|
||||
list.add(this.appendCreateData("createProcessTotal",createProcessList));
|
||||
//耗时最长的流程
|
||||
List<Map<String,Object>> maxUserTimeList = processMonitorDao.getUseTimeMaxProcess(null);
|
||||
list.add(this.appendData("avgUserTimeTotal",maxUserTimeList,"APP_ID"));
|
||||
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("daiBan", daiBanList.size()>0?daiBanList.get(0).get("NAME"):0);
|
||||
obj.put("avgUserTimeprocess", maxUserTimeList.size()>0?maxUserTimeList.get(0).get("NAME"):0);
|
||||
obj.put("overTimeprocess", overTimeList.size()>0? overTimeList.get(0).get("PROC_DEF_NAME"):0);
|
||||
obj.put("createMostprocess", createProcessList.size()>0? createProcessList.get(0).get("PROC_DEF_NAME"):0);
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 组装创建最多的流程
|
||||
* @param createProcessList
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> appendCreateData(String id, List<Map<String, Object>> createProcessList) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
ArrayList list =new ArrayList();
|
||||
//总计
|
||||
List<Map<String,Object>> totalDatas = new ArrayList<Map<String,Object>>();
|
||||
//运行中
|
||||
List<Map<String,Object>> runDatas = new ArrayList<Map<String,Object>>();
|
||||
//已完成
|
||||
List<Map<String,Object>> finishDatas = new ArrayList<Map<String,Object>>();
|
||||
//作废
|
||||
List<Map<String,Object>> cancleDatas = new ArrayList<Map<String,Object>>();
|
||||
result.put("id", id);
|
||||
for (Map<String,Object> obj : createProcessList) {
|
||||
Map<String,Object> runData = new HashMap<String, Object>();
|
||||
Map<String,Object> finishData = new HashMap<String, Object>();
|
||||
Map<String,Object> cancleData = new HashMap<String, Object>();
|
||||
Integer cancle =Integer.parseInt(obj.get("CANCLE") != null?obj.get("CANCLE").toString():"0");
|
||||
Integer un_deal =Integer.parseInt(obj.get("UN_DEAL") != null?obj.get("UN_DEAL").toString():"0");
|
||||
Integer deal =Integer.parseInt(obj.get("DEAL") != null?obj.get("DEAL").toString():"0");
|
||||
String appId = obj.get("APP_ID").toString();
|
||||
cancleData.put("id", obj.get("PROC_DEF_NAME").toString());
|
||||
cancleData.put("y",cancle);
|
||||
cancleData.put("appId",appId);
|
||||
cancleData.put("title","已完成:"+deal+"(个)"
|
||||
+"<br>运行中:"+un_deal+"(个)"
|
||||
+"<br>已作废:"+cancle+"(个)");
|
||||
cancleDatas.add(cancleData);
|
||||
|
||||
runData.put("id", obj.get("PROC_DEF_NAME").toString());
|
||||
runData.put("y",un_deal);
|
||||
runData.put("appId",appId);
|
||||
runData.put("title","已完成:"+deal+"(个)"
|
||||
+"<br>运行中:"+un_deal+"(个)"
|
||||
+"<br>已作废:"+cancle+"(个)");
|
||||
runDatas.add(runData);
|
||||
|
||||
finishData.put("id", obj.get("PROC_DEF_NAME").toString());
|
||||
finishData.put("y",deal);
|
||||
finishData.put("appId",appId);
|
||||
finishData.put("title","已完成:"+deal+"(个)"
|
||||
+"<br>运行中:"+un_deal+"(个)"
|
||||
+"<br>已作废:"+cancle+"(个)");
|
||||
finishDatas.add(finishData);
|
||||
list.add(obj.get("PROC_DEF_NAME").toString());
|
||||
}
|
||||
result.put("datas", "["
|
||||
+ "{name:"+"'已作废',"+"data:"+JSONArray.fromObject(cancleDatas)+"},"
|
||||
+ "{name:"+"'运行中',"+"data:"+JSONArray.fromObject(runDatas)+"},"
|
||||
+ "{name:"+"'已完成',"+"data:"+JSONArray.fromObject(finishDatas)+"}]");
|
||||
result.put("list", list);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 组装超时最多的流程数据
|
||||
* @param overTimeList
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> appendOverData(String id, List<Map<String, Object>> overTimeList, String key) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
ArrayList list =new ArrayList();
|
||||
List<Map<String,Object>> runDatas = new ArrayList<Map<String,Object>>();
|
||||
List<Map<String,Object>> finishDatas = new ArrayList<Map<String,Object>>();
|
||||
result.put("id", id);
|
||||
for (Map<String,Object> obj : overTimeList) {
|
||||
Map<String,Object> runData = new HashMap<String, Object>();
|
||||
Map<String,Object> finishData = new HashMap<String, Object>();
|
||||
Double finish = Double.parseDouble(obj.get("FINISH_OVER_TIME") != null?obj.get("FINISH_OVER_TIME").toString():"0");
|
||||
Double run = Double.parseDouble(obj.get("RUN_OVER_TIME") != null?obj.get("RUN_OVER_TIME").toString():"0");
|
||||
runData.put("id", obj.get(key).toString());
|
||||
runData.put("y", run);
|
||||
runData.put("appId", obj.get("APP_ID").toString());
|
||||
runData.put("title", "<br>已完成:"+finish+"(小时)<br>运行中:"+run+"(小时)");
|
||||
runDatas.add(runData);
|
||||
finishData.put("id", obj.get(key).toString());
|
||||
finishData.put("y",finish);
|
||||
finishData.put("appId", obj.get("APP_ID").toString());
|
||||
finishData.put("title", "<br>已完成:"+finish+"(小时)<br>运行中:"+run+"(小时)");
|
||||
finishDatas.add(finishData);
|
||||
list.add(obj.get("PROC_DEF_NAME").toString());
|
||||
}
|
||||
result.put("datas", "[{name:"+"'运行中',"+"data:"+JSONArray.fromObject(runDatas)+"},{name:"+"'已完成',"+"data:"+JSONArray.fromObject(finishDatas)+"}]");
|
||||
result.put("list", list);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 组装待办流程最多的数据
|
||||
* @param daiBanList
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> appendData(String id, List<Map<String, Object>> daiBanList, String key) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
ArrayList list =new ArrayList();
|
||||
List<Map<String,Object>> datas = new ArrayList<Map<String,Object>>();
|
||||
result.put("id", id);
|
||||
for (Map<String,Object> obj : daiBanList) {
|
||||
Map<String,Object> data = new HashMap<String, Object>();
|
||||
data.put("name", obj.get("NAME").toString());
|
||||
data.put("y", Double.parseDouble(obj.get("COUNT").toString()));
|
||||
data.put("id", obj.get(key).toString());
|
||||
data.put("appId", obj.get("APP_ID").toString());
|
||||
datas.add(data);
|
||||
list.add(obj.get("NAME").toString());
|
||||
}
|
||||
result.put("datas", "[{name:"+"'',"+"data:"+JSONArray.fromObject(datas)+"}]");
|
||||
result.put("list", list);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* * 节点分析详情
|
||||
* 节点平均耗时、待办流程最多的节点
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> actAnalysisDetail() {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//节点平均耗时
|
||||
List<Map<String,Object>> actUserTimeList = processMonitorDao.getActAvgUseTime(null);
|
||||
list.add(this.appendData("actAvgUserTimeTotal",actUserTimeList,"APP_ID"));
|
||||
//待办流程最多的节点
|
||||
List<Map<String,Object>> doTaskActList = processMonitorDao.getDoTaskMaxAct(null);
|
||||
list.add(this.appendData("actUserTimeTotal",doTaskActList,"APP_ID"));
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("actUserTime", actUserTimeList.size()>0?actUserTimeList.get(0).get("NAME"):0);
|
||||
obj.put("doTaskAct", doTaskActList.size()>0?doTaskActList.get(0).get("NAME"):0);
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 人员分析详情
|
||||
* 待处理流程最多的员工
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> staffAnalysisDetail() {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//节点平均耗时
|
||||
List<Map<String,Object>> staffTopList = processMonitorDao.getTopUserTask(null);
|
||||
list.add(this.appendData("staffTopTotal",staffTopList,"APP_ID"));
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("staffTop", staffTopList.size()>0?staffTopList.get(0).get("NAME"):0);
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
public List<Map<String, Object>> appProcessDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//待办流程最多的节点
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", appId);
|
||||
List<Map<String,Object>> doTaskActList = processMonitorDao.getDoProcesss(params);
|
||||
list.add(this.appendData("doTaskActTotal",doTaskActList,"NAME"));
|
||||
Map<String,Object> totalData = processMonitorDao.getDoTotalProcesss();
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("doTaskAct", doTaskActList.size()>0?doTaskActList.get(0).get("NAME"):0);
|
||||
obj.put("processTotal", totalData.get("COUNT"));
|
||||
obj.put("staffTotal", totalData.get("STAFFCOUNT"));
|
||||
//this.appendTotal(doTaskActList,obj);
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 组装流程总数和人员总数数据
|
||||
* @param doTaskActList
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> appendTotal(List<Map<String, Object>> doTaskActList, Map<String, Object> obj) {
|
||||
int processTotal = 0;
|
||||
int staffTotal = 0;
|
||||
for (Map<String,Object> task : doTaskActList) {
|
||||
processTotal = processTotal+Integer.parseInt(task.get("COUNT").toString());
|
||||
staffTotal = staffTotal+Integer.parseInt(task.get("STAFFCOUNT").toString());
|
||||
}
|
||||
obj.put("processTotal", processTotal);
|
||||
obj.put("staffTotal", staffTotal);
|
||||
return obj;
|
||||
}
|
||||
/**
|
||||
* 平均耗时最长的流程统计详情
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> avgUserTimeDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", appId);
|
||||
//节点平均耗时
|
||||
List<Map<String,Object>> actUserTimeList = processMonitorDao.getUseTimeMaxProcess(params);
|
||||
list.add(this.appendData("actAvgUserTimeTotal",actUserTimeList,"NAME"));
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("actUserTime", actUserTimeList.size()>0?actUserTimeList.get(0).get("NAME"):0);
|
||||
Map<String,Object> actUserTimeTotal = processMonitorDao.getUseTimeMaxProcessTotal();
|
||||
obj.put("processTotal", actUserTimeTotal.get("TOTAL"));
|
||||
obj.put("modelTotal", actUserTimeTotal.get("MODELTOTAL"));
|
||||
//this.appendUserTimeTotal(actUserTimeList,obj,"TOTAL");
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 超时处理最多的流程详情
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> overTimeProcessDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", appId);
|
||||
//超时最多的流程
|
||||
List<Map<String,Object>> overTimeList = processMonitorDao.getOutTimeProcess(params);
|
||||
list.add(this.appendOverData("overTimeTotal",overTimeList,"PROC_DEF_NAME"));
|
||||
List<Map<String,Object>> overTimeTotal = processMonitorDao.getOutTimeProcessTotal();
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("actUserTime", overTimeList.size()>0?overTimeList.get(0).get("PROC_DEF_NAME"):0);
|
||||
obj.put("processTotal", overTimeTotal.get(0).get("COUNT"));
|
||||
obj.put("modelTotal", overTimeTotal.get(1).get("COUNT"));
|
||||
//this.appendUserTimeTotal(overTimeList,obj,"TOTAL");
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装平均耗时最长的数据
|
||||
* @param actUserTimeList
|
||||
* @param obj
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private Map<String,Object> appendUserTimeTotal(List<Map<String, Object>> actUserTimeList, Map<String, Object> obj, String key) {
|
||||
int processTotal = 0;
|
||||
for (Map<String,Object> task : actUserTimeList) {
|
||||
processTotal = processTotal+Integer.parseInt(task.get(key).toString());
|
||||
}
|
||||
obj.put("processTotal", processTotal);
|
||||
obj.put("modelTotal", actUserTimeList.size());
|
||||
return obj;
|
||||
|
||||
}
|
||||
/**
|
||||
* 节点平均耗时-下钻详情
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<Map<String, Object>> actAvgUserTimeDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", appId);
|
||||
//节点平均耗时
|
||||
List<Map<String,Object>> actUserTimeList = processMonitorDao.getActAvgUseTime(params);
|
||||
list.add(this.appendData("actAvgUserTimeTotal",actUserTimeList,"TASK_DEF_KEY"));
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("actUserTime", actUserTimeList.size()>0?actUserTimeList.get(0).get("NAME"):0);
|
||||
Map<String,Object> actUserTimeTotal = processMonitorDao.getActAvgUseTimeTotal();
|
||||
obj.put("processTotal", actUserTimeTotal.get("TOTAL"));
|
||||
obj.put("modelTotal", actUserTimeTotal.get("STAFFCOUNT"));
|
||||
//this.appendUserTimeTotal(actUserTimeList,obj,"TOTAL");
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 人员分析-下钻详情
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> staffTopDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//节点平均耗时
|
||||
Map<String,Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", appId);
|
||||
List<Map<String,Object>> staffTopList = processMonitorDao.getTopUserTask(params);
|
||||
list.add(this.appendData("staffTopTotal",staffTopList,"APP_ID"));
|
||||
Map<String,Object> totalData = processMonitorDao.getDoTotalProcesss();
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("staffTop", staffTopList.size()>0?staffTopList.get(0).get("NAME"):0);
|
||||
obj.put("processTotal", totalData.get("COUNT"));
|
||||
obj.put("staffTotal", totalData.get("STAFFCOUNT"));
|
||||
//this.appendUserTimeTotal(staffTopList,obj,"COUNT");
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 流程创建数量排名详情
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> createMaxProcessDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//创建最多的流程
|
||||
List<Map<String,Object>> createProcessList = processMonitorDao.getCreateProcess();
|
||||
list.add(this.appendCreateData("createProcessTotal",createProcessList));
|
||||
Map<String,Object> createMaxTotal = processMonitorDao.getCreateProcessTotal();
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("total", createMaxTotal.get("CREATECOUNT")!=null?createMaxTotal.get("CREATECOUNT"):0);
|
||||
obj.put("un_deal", createMaxTotal.get("UN_DEAL")!=null?createMaxTotal.get("UN_DEAL"):0);
|
||||
obj.put("deal", createMaxTotal.get("DEAL")!=null?createMaxTotal.get("DEAL"):0);
|
||||
obj.put("cancle", createMaxTotal.get("CANCLE")!=null?createMaxTotal.get("CANCLE"):0);
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 节点分析-待审流程最多的节点下钻详情
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> actDoProcessDetail(String appId) {
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
//待办流程最多的节点
|
||||
List<Map<String,Object>> doTaskActList = processMonitorDao.getDoTaskMaxAct(null);
|
||||
list.add(this.appendData("doTaskActTotal",doTaskActList,"TASK_DEF_KEY"));
|
||||
Map<String,Object> totalData = processMonitorDao.getDoTotalProcesss();
|
||||
Map<String,Object> obj = new HashMap<String, Object>();
|
||||
obj.put("id", "params");
|
||||
obj.put("doTaskAct", doTaskActList.size()>0?doTaskActList.get(0).get("NAME"):0);
|
||||
obj.put("processTotal", totalData.get("COUNT"));
|
||||
obj.put("staffTotal", totalData.get("STAFFCOUNT"));
|
||||
list.add(obj);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.blueland.bpm.manage.interceptor;
|
||||
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* @description token校验拦截器
|
||||
* @author hanj
|
||||
*/
|
||||
public class ProcessModelerUrlInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
String url = request.getRequestURL().toString();
|
||||
URI uri = URLUtil.toURI(url);
|
||||
if(uri.getHost().contains("222.244")){
|
||||
MyContants.resetBpmProcessModelerPath(uri.getScheme() + "://" + uri.getHost() + ":39082/bpmc-md/");
|
||||
} else {
|
||||
MyContants.resetBpmProcessModelerPath((String) SysConfig.getValue("bpm_process_modeler_path"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
package com.blueland.bpm.manage.log.web;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
import com.blueland.bpm.engine.util.JsonUtil;
|
||||
import com.blueland.bpm.engine.util.WorkFlowException;
|
||||
import com.blueland.bpm.log.model.ProcessErrorLog;
|
||||
import com.blueland.bpm.log.service.ProcessErrorLogManager;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.SmsEmailMsg;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "processErrorLog")
|
||||
public class ProcessExecuteLogController extends BaseSpringController {
|
||||
// 默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProcessExecuteLogController.class);
|
||||
|
||||
@Autowired
|
||||
private ProcessErrorLogManager processErrorLogManager;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
@Autowired
|
||||
ProcessExecuteService processExecuteService;
|
||||
private final String LIST_ACTION = "redirect:/processErrorLog/list.do";
|
||||
|
||||
public ProcessExecuteLogController() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
// model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "errorList")
|
||||
public ModelAndView list(HttpServletRequest request, ProcessErrorLog query,String flag) {
|
||||
try {
|
||||
if ((!BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request))
|
||||
|| StringUtils.isEmpty(query.getAppId())) && StringUtils.isEmpty(flag)) {
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
query.setAppId(loginUserAppId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("==list==", e);
|
||||
}
|
||||
if (query.getStartPelogTime() == null && StringUtils.isEmpty(flag)) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DATE, 1);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
query.setEndPelogTime(cal.getTime());
|
||||
cal.add(Calendar.DATE, -7);
|
||||
query.setStartPelogTime(cal.getTime());
|
||||
}
|
||||
query.setSortColumns("pelog_create_time desc");
|
||||
query.setProcessLogLevel("error");
|
||||
if (StringUtils.isEmpty(query.getRetryStatus())) {
|
||||
query.setRetryStatus("n");
|
||||
}
|
||||
Page page = this.processErrorLogManager.findPageNotMsg(query);
|
||||
ModelAndView result = new ModelAndView("/processErrorLog/errorList");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
result.addObject("flag", flag);
|
||||
// saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "infoList")
|
||||
public ModelAndView infoList(HttpServletRequest request, ProcessErrorLog query,String flag) {
|
||||
try {
|
||||
if ((!BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request))
|
||||
|| StringUtils.isEmpty(query.getAppId())) && StringUtils.isEmpty(flag)) {
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
query.setAppId(loginUserAppId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("==infoList==", e);
|
||||
}
|
||||
if (query.getStartPelogTime() == null && StringUtils.isEmpty(flag)) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
query.setStartPelogTime(cal.getTime());
|
||||
cal.add(Calendar.DATE, 1);
|
||||
query.setEndPelogTime(cal.getTime());
|
||||
}
|
||||
query.setSortColumns("pelog_create_time desc");
|
||||
query.setProcessLogLevel("info");
|
||||
Page page = this.processErrorLogManager.findPageNotMsg(query);
|
||||
ModelAndView result = new ModelAndView("/processErrorLog/infoList");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
result.addObject("flag", flag);
|
||||
this.saveQueryParams(request, query);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "showInfo")
|
||||
public ModelAndView showInfo(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("pelogId"));
|
||||
ProcessErrorLog processErrorLog = (ProcessErrorLog) processErrorLogManager.getById(id);
|
||||
return new ModelAndView("/processErrorLog/showInfo", "processErrorLog", processErrorLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "showError")
|
||||
public ModelAndView showError(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("pelogId"));
|
||||
ProcessErrorLog processErrorLog = (ProcessErrorLog) processErrorLogManager.getById(id);
|
||||
return new ModelAndView("/processErrorLog/showError", "processErrorLog", processErrorLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request, ProcessErrorLog processErrorLog,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
processErrorLogManager.save(processErrorLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "retryVeiw")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("pelogId"));
|
||||
ProcessErrorLog processErrorLog = (ProcessErrorLog) processErrorLogManager.getById(id);
|
||||
return new ModelAndView("/processErrorLog/retry", "processErrorLog", processErrorLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "retry")
|
||||
@ResponseBody
|
||||
public String retry(String pelogId, String processMsg) {
|
||||
if (StringUtils.isEmpty(processMsg)) {
|
||||
return "发送的消息内容不能为空!";
|
||||
}
|
||||
ProcessInputModel processInputModel = null;
|
||||
try {
|
||||
processInputModel = (ProcessInputModel) JsonUtil.convertToBean(processMsg, ProcessInputModel.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (processInputModel == null || StringUtils.isEmpty(processInputModel.getWf_procTitle())) {
|
||||
return "消息内容格式有误,无法转换成processInputModel对象";
|
||||
}
|
||||
Map<String, Object> result = null;
|
||||
try {
|
||||
result = processExecuteService.nextExecute(processInputModel);
|
||||
} catch (Exception e) {
|
||||
log.error("==retry==", e);
|
||||
}
|
||||
ProcessErrorLog processErrorLog = processErrorLogManager.getById(pelogId);
|
||||
processErrorLog.setRetryStatus("y");
|
||||
processErrorLogManager.update(processErrorLog);
|
||||
// try{
|
||||
// ApplicationEntity applicationEntity = applicationManager.getById(processErrorLog.getAppId());
|
||||
// SmsEmailMsg.sendSmsEmail(SmsEmailMsg.buildEmailMsgData(applicationEntity, processErrorLog,msg));
|
||||
// }catch(Exception e){
|
||||
// log.error("==retry==邮件提醒发送失败:", e);
|
||||
// }
|
||||
return (String) result.get("executeStatus");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理错误消息
|
||||
*
|
||||
* @param pelogId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "disposeErrorLog")
|
||||
@ResponseBody
|
||||
public String disposeErrorLog(String pelogId) {
|
||||
ProcessErrorLog processErrorLog = processErrorLogManager.getById(pelogId);
|
||||
if (processErrorLog == null) {
|
||||
return "错误消息为空!";
|
||||
}
|
||||
processErrorLog.setRetryStatus("y");
|
||||
processErrorLogManager.update(processErrorLog);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request, ProcessErrorLog processErrorLog,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
//String id = new String(request.getParameter("pelogId"));
|
||||
processErrorLogManager.update(processErrorLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request, RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String) params.get("pelogId"));
|
||||
|
||||
processErrorLogManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.blueland.bpm.manage.log.web;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.log.model.ProcessRetryLog;
|
||||
import com.blueland.bpm.log.service.ProcessRetryLogManager;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "processRetryLog")
|
||||
public class ProcessRetryLogController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ProcessRetryLogManager processRetryLogManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/processRetryLog/list.do";
|
||||
|
||||
public ProcessRetryLogController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ProcessRetryLog query) {
|
||||
Page page = this.processRetryLogManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/processRetryLog/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("prlogId"));
|
||||
ProcessRetryLog processRetryLog = (ProcessRetryLog)processRetryLogManager.getById(id);
|
||||
return new ModelAndView("/processRetryLog/show","processRetryLog",processRetryLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ProcessRetryLog processRetryLog) {
|
||||
return new ModelAndView("/processRetryLog/create","processRetryLog",processRetryLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,ProcessRetryLog processRetryLog,RedirectAttributes redirectAttributes) {
|
||||
processRetryLogManager.save(processRetryLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("prlogId"));
|
||||
ProcessRetryLog processRetryLog = (ProcessRetryLog)processRetryLogManager.getById(id);
|
||||
return new ModelAndView("/processRetryLog/edit","processRetryLog",processRetryLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,ProcessRetryLog processRetryLog,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("prlogId"));
|
||||
processRetryLogManager.update(processRetryLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("prlogId"));
|
||||
|
||||
processRetryLogManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.blueland.bpm.manage.log.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.DateUtil;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
import com.blueland.bpm.log.model.*;
|
||||
import com.blueland.bpm.log.service.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "tlogUserOperate")
|
||||
public class TlogUserOperateController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private TlogUserOperateManager tlogUserOperateManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/tlogUserOperate/list.do";
|
||||
|
||||
public TlogUserOperateController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,TlogUserOperate query,
|
||||
String startOperateTimeStr,String endOperateTimeStr) throws Exception {
|
||||
if(null!=startOperateTimeStr && !"".equals(startOperateTimeStr)){
|
||||
query.setStartOperateTime(DateUtil.convertStringToDate("yyyy-MM-dd HH:mm:ss",
|
||||
startOperateTimeStr + " 00:00:00"));
|
||||
}
|
||||
if(null!=endOperateTimeStr && !"".equals(endOperateTimeStr)){
|
||||
query.setEndOperateTime(DateUtil.convertStringToDate("yyyy-MM-dd HH:mm:ss",
|
||||
endOperateTimeStr + " 23:59:59"));
|
||||
}
|
||||
Page page = this.tlogUserOperateManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/tlogUserOperate/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
result.addObject("startOperateTimeStr", startOperateTimeStr);
|
||||
result.addObject("endOperateTimeStr",endOperateTimeStr);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("logId"));
|
||||
TlogUserOperate tlogUserOperate = (TlogUserOperate)tlogUserOperateManager.getById(id);
|
||||
return new ModelAndView("/tlogUserOperate/show","tlogUserOperate",tlogUserOperate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,TlogUserOperate tlogUserOperate) {
|
||||
return new ModelAndView("/tlogUserOperate/create","tlogUserOperate",tlogUserOperate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(HttpServletRequest request,TlogUserOperate tlogUserOperate,RedirectAttributes redirectAttributes) {
|
||||
tlogUserOperateManager.save(tlogUserOperate);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("logId"));
|
||||
TlogUserOperate tlogUserOperate = (TlogUserOperate)tlogUserOperateManager.getById(id);
|
||||
return new ModelAndView("/tlogUserOperate/edit","tlogUserOperate",tlogUserOperate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(HttpServletRequest request,TlogUserOperate tlogUserOperate,RedirectAttributes redirectAttributes) {
|
||||
String id = new String(request.getParameter("logId"));
|
||||
tlogUserOperateManager.update(tlogUserOperate);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("logId"));
|
||||
|
||||
tlogUserOperateManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
@Service
|
||||
public class AgainSaveSessionService {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
/**
|
||||
* 根据iv-user 重新注入session
|
||||
* @param request
|
||||
*/
|
||||
public void saveSession(String appId,HttpServletRequest request,HttpServletResponse response){
|
||||
String userId=request.getHeader("iv-user");
|
||||
|
||||
if(userId!=null){
|
||||
User user=userService.getUserById(userId);
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response, BaseUser.toUpperCase(user.getUserId()));
|
||||
List<ApplicationEntity> list =new ArrayList<ApplicationEntity>();
|
||||
if(StringUtils.isNotEmpty(appId)){
|
||||
ApplicationEntity app =applicationManager.getById(appId);
|
||||
if(app!=null){
|
||||
list.add(app);
|
||||
}
|
||||
|
||||
}else{
|
||||
list = applicationManager.selectByUserId(userId);
|
||||
}
|
||||
if(list!=null && list.size()>0){
|
||||
filter(list,"task");
|
||||
}
|
||||
|
||||
bUser.saveUserToSession(request,user,list);
|
||||
}
|
||||
}
|
||||
public void filter(List<ApplicationEntity> list,String task){
|
||||
for (int i=0;i<list.size();i++) {
|
||||
if(list.get(i).getAppType()==null||list.get(i).getAppType().equals(task)){
|
||||
list.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.engine.core.service.ProcessDefinitionService;
|
||||
|
||||
/**
|
||||
* @作者 lw
|
||||
* @创建时间 2018年4月26日
|
||||
* @说明
|
||||
*/
|
||||
@Service
|
||||
public class CheckProcessResourceService {
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
public void check() {
|
||||
ApplicationEntity query=new ApplicationEntity();
|
||||
query.setAppTypes("('inner','outside')");
|
||||
List<ApplicationEntity> entitys = this.applicationManager.findByExample(query);
|
||||
for (ApplicationEntity app : entitys) {
|
||||
//List<Map<String,Object>> inProcess = processDefinitionService.findResourceByOrgError(app.getAppId(),false);
|
||||
//System.out.println(inProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.util.BaseSpringJdbcDao;
|
||||
|
||||
import groovy.util.logging.Slf4j;
|
||||
|
||||
/**
|
||||
* @作者 dsl
|
||||
* @创建时间 2019年12月09日
|
||||
* @说明 维护流程结束,重新退回最后一个环节,让流程可以重新走
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ProcessRestoreService extends BaseSpringJdbcDao<String,String>{
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
|
||||
/**
|
||||
* 流程办结,恢复流程
|
||||
*/
|
||||
public Map<String, Object> processRestore(String procInstId) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
boolean flag = false;
|
||||
String msg = "操作失败!";
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("procInstId", procInstId);
|
||||
// 1、根据流程实例id获取流程任务数据
|
||||
ProcessInstanceModel procInstModel = processInstanceService.getProcessInstanceById(procInstId);
|
||||
// 判断非主流程
|
||||
if (!procInstModel.getTopProcInstId().equals(procInstId)) {
|
||||
msg="选择的流程为子流程,不能恢复!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
// 判断状态不等于办结
|
||||
if ("5".equals(procInstModel.getProcState())) {
|
||||
return this.delBanJie(procInstId);
|
||||
}else if("3".equals(procInstModel.getProcState())){
|
||||
return this.delZuoFei(procInstId);
|
||||
}else{
|
||||
msg="该流程还未办结,不能恢复!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 处理作废流程恢复
|
||||
* @param procInstId
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> delZuoFei(String procInstId) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
boolean flag = false;
|
||||
String msg = "操作失败!";
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("procInstId", procInstId);
|
||||
String findTaskListSql = "select *from ACT_HI_TASKINST a where a.proc_inst_id_ = :procInstId order by start_time_ desc";
|
||||
List<Map<String, Object>> list = this.namedParameterJdbcTemplate.queryForList(findTaskListSql, params);
|
||||
if (!(list != null && list.size() > 0)) {
|
||||
msg="未找到该任务!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
String taskId = list.get(0).get("id_").toString();
|
||||
Map<String, Object> taskParams = new HashMap<String, Object>();
|
||||
taskParams.put("taskId", taskId);
|
||||
Map<String, Object> procInstAndtaskParams = new HashMap<String, Object>();
|
||||
procInstAndtaskParams.put("taskId", taskId);
|
||||
procInstAndtaskParams.put("procInstId", procInstId);
|
||||
//插入任务对象
|
||||
String updateAct = "update ACT_HI_ACTINST aat set aat.end_time_=null,aat.duration_=null where aat.proc_inst_id_ = :procInstId and aat.TASK_ID_= :taskId";
|
||||
String updateTask = "update ACT_HI_TASKINST tt set tt.action_type='execute_activity',tt.claim_time_=null,tt.description_=null,tt.end_time_=null,tt.duration_=null,tt.delete_reason_=null where tt.proc_inst_id_ = :procInstId and id_= :taskId";
|
||||
String insertActTask ="insert into ACT_RU_TASK";
|
||||
insertActTask+=" (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME)";
|
||||
insertActTask+=" select ID_, 1, NAME_, PARENT_TASK_ID_,DESCRIPTION_, PRIORITY_, START_TIME_, OWNER_, ASSIGNEE_, null, PROC_INST_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, 1, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME";
|
||||
insertActTask+=" from ACT_HI_TASKINST a where a.id_= :taskId";
|
||||
//修改流程状态
|
||||
String updateProc ="update ACT_HI_PROCINST a set a.delete_reason_=null, a.end_time_=null,a.end_act_id_=null,proc_state=1 where a.proc_inst_id_ = :procInstId";
|
||||
//同步待办数据
|
||||
String updateHistory= "update t_unitework_history h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid= :taskId and h.unite_status=6";
|
||||
String insertTask = "insert into t_unitework_task";
|
||||
insertTask+=" (unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid)";
|
||||
insertTask+=" select unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid";
|
||||
insertTask+=" from t_unitework_history h where h.unite_cur_actinstid= :taskId and h.unite_status=1";
|
||||
|
||||
String deleteComment = "delete from ACT_HI_COMMENT where proc_inst_id_ = :procInstId and task_id_= :taskId";
|
||||
try {
|
||||
this.namedParameterJdbcTemplate.update(updateAct, procInstAndtaskParams);
|
||||
this.namedParameterJdbcTemplate.update(updateTask, procInstAndtaskParams);
|
||||
this.namedParameterJdbcTemplate.update(insertActTask, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(updateProc, params);
|
||||
this.namedParameterJdbcTemplate.update(updateHistory, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(insertTask, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(deleteComment, procInstAndtaskParams);
|
||||
} catch (Exception e) {
|
||||
log.error("processRestore error ,procInstId:" + procInstId, e);
|
||||
msg="恢复数据异常,请查看后台日志";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
flag=true;
|
||||
msg="操作成功!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 处理办结流程恢复
|
||||
* @param procInstId
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Object> delBanJie(String procInstId) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
boolean flag = false;
|
||||
String msg = "操作失败!";
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("procInstId", procInstId);
|
||||
String findTaskListSql = "select * from ACT_HI_TASKINST a where a.proc_inst_id_ = :procInstId order by start_time_ desc";
|
||||
List<Map<String, Object>> list = this.namedParameterJdbcTemplate.queryForList(findTaskListSql, params);
|
||||
if (!(list != null && list.size() > 0)) {
|
||||
msg="未找到该任务!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
String taskId = list.get(0).get("id_").toString();
|
||||
Map<String, Object> taskParams = new HashMap<String, Object>();
|
||||
taskParams.put("taskId", taskId);
|
||||
Map<String, Object> procInstAndtaskParams = new HashMap<String, Object>();
|
||||
procInstAndtaskParams.put("taskId", taskId);
|
||||
procInstAndtaskParams.put("procInstId", procInstId);
|
||||
// 2、插入执行路径
|
||||
String insertExe = "insert into ACT_RU_EXECUTION";
|
||||
insertExe += " (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_, TENANT_ID_, NAME_,PROC_TITLE,TOP_PROCESS_INSTANCE_ID_)";
|
||||
insertExe += " select";
|
||||
insertExe += " EXECUTION_ID_, '1', PROC_INST_ID_, '', PROC_DEF_ID_, TASK_DEF_KEY_, 1, 0, 1, 0, NULL, NULL, 1, 2, tenant_id_, NULL,proc_title,PROC_INST_ID_";
|
||||
insertExe += " from ACT_HI_TASKINST a where a.id_ = :taskId";
|
||||
// 3、插入任务对象
|
||||
String insertTask = "insert into ACT_RU_TASK";
|
||||
insertTask += " (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME)";
|
||||
insertTask += " select";
|
||||
insertTask += " ID_, 1, NAME_, PARENT_TASK_ID_,DESCRIPTION_, PRIORITY_, START_TIME_, OWNER_, ASSIGNEE_, null, PROC_INST_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, 1, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME";
|
||||
insertTask += " from ACT_HI_TASKINST a where a.id_ = :taskId";
|
||||
// 4、删除最后一步
|
||||
String delLastStep = "delete from act_hi_actinst a where a.proc_inst_id_ = :procInstId and act_type_='endEvent'";
|
||||
// 5、修改流程状态
|
||||
String updateProcessStatus = "update ACT_HI_PROCINST a set a.end_time_=null,a.end_act_id_=null,proc_state=1 where a.proc_inst_id_ = :procInstId";
|
||||
// 6、插入act_ru_variable数据
|
||||
String insertRu = "insert into act_ru_variable";
|
||||
insertRu += " (id_, rev_, type_, name_, execution_id_, proc_inst_id_, task_id_, bytearray_id_, double_, long_, text_, text2_)";
|
||||
insertRu += " select id_, rev_, var_type_, name_, execution_id_, proc_inst_id_, null, bytearray_id_, double_, long_, text_, text2_";
|
||||
insertRu += " from act_hi_varinst a where a.proc_inst_id_ = :procInstId and task_id_= :taskId";
|
||||
// 7、同步待办数据
|
||||
String updateHistory = "update t_unitework_history h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid= :taskId";
|
||||
// 8 、插入数据到t_unitework_task
|
||||
String insertUniteTask = "insert into t_unitework_task";
|
||||
insertUniteTask += " (unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid)";
|
||||
insertUniteTask += " select unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid";
|
||||
insertUniteTask += " from t_unitework_history h where h.unite_cur_actinstid=:taskId";
|
||||
// 9、修改ACT_HI_ACTINST环节时间
|
||||
String updateActTime = "update ACT_HI_ACTINST aat set aat.end_time_=null,aat.duration_=null where aat.proc_inst_id_ = :procInstId and task_id_= :taskId ";
|
||||
// 10、修改ACT_HI_ACTINST修改环节时间
|
||||
String updateTaskTime = " update ACT_HI_TASKINST tt set tt.claim_time_=null,tt.end_time_=null,tt.duration_=null,tt.delete_reason_=null where tt.proc_inst_id_ = :procInstId and tt.ID_= :taskId";
|
||||
// 11、删除意见
|
||||
String delComment = "delete from ACT_HI_COMMENT where proc_inst_id_ = :procInstId and task_id_=:taskId";
|
||||
try {
|
||||
this.namedParameterJdbcTemplate.update(insertExe, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(insertTask, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(delLastStep, params);
|
||||
this.namedParameterJdbcTemplate.update(updateProcessStatus, params);
|
||||
this.namedParameterJdbcTemplate.update(insertRu, procInstAndtaskParams);
|
||||
this.namedParameterJdbcTemplate.update(updateHistory, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(insertUniteTask, taskParams);
|
||||
this.namedParameterJdbcTemplate.update(updateActTime, procInstAndtaskParams);
|
||||
this.namedParameterJdbcTemplate.update(updateTaskTime, procInstAndtaskParams);
|
||||
this.namedParameterJdbcTemplate.update(delComment, procInstAndtaskParams);
|
||||
} catch (Exception e) {
|
||||
log.error("processRestore error ,procInstId:" + procInstId, e);
|
||||
msg="恢复数据异常,请查看后台日志";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
flag=true;
|
||||
msg="操作成功!";
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.blueland.bpm.common.util.DateUtil;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.util.BaseSpringJdbcDao;
|
||||
|
||||
import groovy.util.logging.Slf4j;
|
||||
|
||||
/**
|
||||
* @作者 lw
|
||||
* @创建时间 2018年10月11日
|
||||
* @说明
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ProcessUpdateTimeService extends BaseSpringJdbcDao<String,String>{
|
||||
@Autowired
|
||||
HistoryService historyService;
|
||||
/**
|
||||
* 更新环节实例时间
|
||||
*/
|
||||
public boolean updateActInstTime(List<ActivityInstanceModel> actInstList) {
|
||||
if (actInstList == null || actInstList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String uptTaskSql = "update ACT_HI_TASKINST h set h.end_time_=:endTime,h.start_time_=:createTime,h.DURATION_=:duration,h.sender=:sendUserId,h.send_user_name=:sendUserName,h.sender_org_id=:senderOrgId,h.sender_org_name=:senderOrgName WHERE h.id_=:actInstId";
|
||||
String uptActSql = "update ACT_HI_ACTINST h set h.end_time_=:endTime,h.start_time_=:createTime,h.DURATION_=:duration,h.sender=:sendUserId,h.send_user_name=:sendUserName,h.sender_org_id=:senderOrgId,h.sender_org_name=:senderOrgName WHERE h.task_id_=:actInstId";
|
||||
String uptUniteTaskSql = "update t_unitework_history h set h.unite_deal_time=:endTime,h.unite_send_time=:createTime,h.unite_send_userid=:sendUserId,h.unite_send_username=:sendUserName,h.unite_send_orgid=:senderOrgId,h.unite_send_orgname=:senderOrgName where h.UNITE_CUR_ACTINSTID=:actInstId";
|
||||
String uptUniteHisSql = "update t_unitework_task h set h.unite_deal_time=:endTime,h.unite_send_time=:createTime,h.unite_send_userid=:sendUserId,h.unite_send_username=:sendUserName,h.unite_send_orgid=:senderOrgId,h.unite_send_orgname=:senderOrgName where h.UNITE_CUR_ACTINSTID=:actInstId";
|
||||
String uptActEndSql = "update ACT_HI_ACTINST h set h.end_time_=:endTime,h.start_time_=:createTime WHERE h.id_=:actInstId";
|
||||
String uptActRuTask = "UPDATE ACT_RU_TASK t set t.CREATE_TIME_=:createTime,t.SEND_USER_ID=:sendUserId,t.SEND_USER_NAME=:sendUserName,t.SENDER_ORG_ID=:senderOrgId,t.SENDER_ORG_NAME=:senderOrgName WHERE t.ID_=:actInstId";
|
||||
for (ActivityInstanceModel model : actInstList) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(model.getActInstId())) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("actInstId", model.getActInstId());
|
||||
if (model.getCreateTime() == null) {
|
||||
params.put("createTime", null);
|
||||
}else{
|
||||
params.put("createTime", model.getCreateTime());
|
||||
}
|
||||
if (model.getFinishTime() == null) {
|
||||
params.put("endTime", null);
|
||||
}else{
|
||||
params.put("endTime", model.getFinishTime());
|
||||
}
|
||||
if (model.getCreateTime() == null || model.getFinishTime() == null) {
|
||||
params.put("duration", 0);
|
||||
}else{
|
||||
params.put("duration", model.getFinishTime().getTime()-model.getCreateTime().getTime());
|
||||
}
|
||||
params.put("sendUserId", model.getSendUserId());
|
||||
params.put("sendUserName", model.getSendUserName());
|
||||
params.put("senderOrgId", model.getSenderOrgId());
|
||||
params.put("senderOrgName", model.getSenderOrgName());
|
||||
if(model.getActState().equals("0")){
|
||||
this.namedParameterJdbcTemplate.update(uptTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptActSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptUniteTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptUniteHisSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptActRuTask, params);
|
||||
}else{
|
||||
this.namedParameterJdbcTemplate.update(uptActEndSql, params);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("updateActInstTime error ,actInstModel:" + model, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程实例时间
|
||||
*/
|
||||
public boolean updateProcTime(String procInstId, String createTime, String endTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("procInstId", procInstId);
|
||||
params.put("createTime", createTime);
|
||||
params.put("endTime", endTime);
|
||||
try {
|
||||
if(createTime=="" || endTime==""){
|
||||
params.put("duration", 0);
|
||||
}else{
|
||||
params.put("duration", DateUtil.convertStringToDate("yyyy-mm-dd HH:mm:ss", endTime).getTime()-DateUtil.convertStringToDate("yyyy-mm-dd HH:mm:ss", createTime).getTime());
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
log.error("updateActInstTime duration error ,actInstModel:" + params, e1);
|
||||
}
|
||||
String uptProcSql = "update ACT_HI_PROCINST h set h.end_time_=to_date(:endTime,'yyyy-mm-dd hh24:mi:ss'),h.start_time_=to_date(:createTime,'yyyy-mm-dd hh24:mi:ss'),DURATION_=:duration WHERE h.id_=:procInstId";
|
||||
try {
|
||||
|
||||
this.namedParameterJdbcTemplate.update(uptProcSql, params);
|
||||
} catch (Exception e) {
|
||||
log.error("updateActInstTime error ,actInstModel:" + params, e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<ActivityInstanceModel> getAllHistTaskByProcess(String procInstId) {
|
||||
if (StringUtils.isEmpty(procInstId)) {
|
||||
return null;
|
||||
}
|
||||
List<HistoricTaskInstance> historicTaskInstances = historyService
|
||||
.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(procInstId)
|
||||
.orderByHistoricTaskInstanceEndTime().asc().list();
|
||||
if (historicTaskInstances == null || historicTaskInstances.isEmpty())
|
||||
return null;
|
||||
List<ActivityInstanceModel> activityInstanceModels = new ArrayList<ActivityInstanceModel>();
|
||||
for (HistoricTaskInstance task : historicTaskInstances) {
|
||||
activityInstanceModels.add(ActivityInstanceModel.buildAndActDef(
|
||||
(HistoricTaskInstance) task, null));
|
||||
}
|
||||
return activityInstanceModels;
|
||||
}
|
||||
/**
|
||||
* 删除当前流程环节
|
||||
* @param actInstList
|
||||
* @return
|
||||
*/
|
||||
public boolean delActInst(List<ActivityInstanceModel> actInstList) {
|
||||
if (actInstList == null || actInstList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String delTaskSql = "DELETE ACT_HI_TASKINST h WHERE h.id_=:actInstId";
|
||||
String delActSql = "DELETE ACT_HI_ACTINST h WHERE h.task_id_=:actInstId";
|
||||
String delUniteTaskSql = "DELETE t_unitework_history h where h.UNITE_CUR_ACTINSTID=:actInstId";
|
||||
String delUniteHisSql = "DELETE t_unitework_task h where h.UNITE_CUR_ACTINSTID=:actInstId";
|
||||
for (ActivityInstanceModel model : actInstList) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(model.getActInstId())) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
|
||||
params.put("actInstId", model.getActInstId());
|
||||
this.namedParameterJdbcTemplate.update(delTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(delActSql, params);
|
||||
this.namedParameterJdbcTemplate.update(delUniteTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(delUniteHisSql, params);
|
||||
} catch (Exception e) {
|
||||
log.error("updateActInstTime error ,actInstModel:" + model, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
System.out.println(DateUtils.addDays(new Date(),9).getTime()-new Date().getTime());
|
||||
}
|
||||
/**
|
||||
* 改当前流程环节信息
|
||||
* @param actInstList
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateActInst(List<ActivityInstanceModel> actInstList) {
|
||||
if (actInstList == null || actInstList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (ActivityInstanceModel model : actInstList) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(model.getActInstId())) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("actInstId", model.getActInstId());
|
||||
params.put("sendUserId", model.getSendUserId());
|
||||
params.put("sendUserName", model.getSendUserName());
|
||||
params.put("senderOrgId", model.getSenderOrgId());
|
||||
params.put("senderOrgName", model.getSenderOrgName());
|
||||
params.put("prevActInstId", model.getPrevActInstId());
|
||||
params.put("prevActDefName", model.getPrevActDefName());
|
||||
params.put("prevActDefId", model.getPrevActDefId());
|
||||
params.put("startTime", model.getCreateTime());
|
||||
String uptTaskSql = " update ACT_HI_ACTINST h set h.sender=:sendUserId,h.send_user_name=:sendUserName,h.sender_org_id=:senderOrgId,h.sender_org_name=:senderOrgName,h.pre_act_id=:prevActDefId,h.pre_act_name=:prevActDefName,h.pre_act_inst_id=:prevActInstId ";
|
||||
if(model.getCreateTime()!=null){
|
||||
uptTaskSql=uptTaskSql+ ",h.start_time_=:startTime ";
|
||||
}
|
||||
uptTaskSql=uptTaskSql+ " WHERE h.task_id_=:actInstId";
|
||||
String uptActSql = " update ACT_HI_TASKINST h set h.sender=:sendUserId,h.send_user_name=:sendUserName,h.sender_org_id=:senderOrgId,h.sender_org_name=:senderOrgName,h.pre_task_def_key=:prevActDefId,h.pre_task_def_name=:prevActDefName,h.pre_task_id=:prevActInstId ";
|
||||
if(model.getCreateTime()!=null){
|
||||
uptActSql=uptActSql+ ",h.start_time_=:startTime ";
|
||||
}
|
||||
uptActSql=uptActSql+ " WHERE h.id_=:actInstId";
|
||||
String uptUniteTaskSql = " update t_unitework_history h set h.unite_send_userid=:sendUserId,h.unite_send_username=:sendUserName,h.unite_send_orgid=:senderOrgId,h.unite_send_orgname=:senderOrgName,h.unite_prev_actdefid=:prevActDefId,h.unite_prev_actdefname=:prevActDefName,h.unite_prev_actinstid=:prevActInstId ";
|
||||
if(model.getCreateTime()!=null){
|
||||
uptUniteTaskSql=uptUniteTaskSql+ ",h.unite_send_time=:startTime ";
|
||||
}
|
||||
uptUniteTaskSql=uptUniteTaskSql+ " where h.UNITE_CUR_ACTINSTID=:actInstId ";
|
||||
String uptUniteHisSql = " update t_unitework_task h set h.unite_send_userid=:sendUserId,h.unite_send_username=:sendUserName,h.unite_send_orgid=:senderOrgId,h.unite_send_orgname=:senderOrgName,h.unite_prev_actdefid=:prevActDefId,h.unite_prev_actdefname=:prevActDefName,h.unite_prev_actinstid=:prevActInstId ";
|
||||
if(model.getCreateTime()!=null){
|
||||
uptUniteHisSql=uptUniteHisSql+ ",h.unite_send_time=:startTime ";
|
||||
}
|
||||
uptUniteHisSql=uptUniteHisSql+ " where h.UNITE_CUR_ACTINSTID=:actInstId";
|
||||
this.namedParameterJdbcTemplate.update(uptTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptActSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptUniteTaskSql, params);
|
||||
this.namedParameterJdbcTemplate.update(uptUniteHisSql, params);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("updateActInstTime error ,actInstModel:" + model, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
/**
|
||||
* @作者 lw
|
||||
* @创建时间 2018年10月11日
|
||||
* @说明
|
||||
*/
|
||||
public class RecoveryProcessService {
|
||||
|
||||
/**
|
||||
* 流程恢复,恢复至最后一个节点
|
||||
* 场景:正常办结
|
||||
*/
|
||||
public void endRecovery(String procInstId,String lastTaskId,String lastActId) {
|
||||
/*String lastTaskId="593f6340-c1f3-11e8-ad75-005056b6289c";
|
||||
String lastActId="593f3c2f-c1f3-11e8-ad75-005056b6289c";
|
||||
String procInstId="68e79036-c076-11e8-ad75-005056b6289c";
|
||||
*//*select *from ACT_HI_TASKINST a where a.proc_inst_id_ ='9d8ae48d-199b-11e7-a9d2-005056b64a7d' order by start_time_
|
||||
|
||||
|
||||
select *from Act_Hi_Actinst aa where aa.task_id_='08549ade-19ca-11e7-a9d2-005056b64a7d' */
|
||||
StringBuffer buf =new StringBuffer();
|
||||
//---插入执行路径
|
||||
String addExeSql="insert into ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_, TENANT_ID_, NAME_,PROC_TITLE,TOP_PROCESS_INSTANCE_ID_) "
|
||||
+ "select EXECUTION_ID_, '1', PROC_INST_ID_, '', PROC_DEF_ID_, TASK_DEF_KEY_, 1, 0, 1, 0, NULL, NULL, 1, 2, tenant_id_, NULL,proc_title,PROC_INST_ID_ from ACT_HI_TASKINST a where a.id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//---插入任务对象
|
||||
|
||||
|
||||
String addTaskSql="insert into ACT_RU_TASK(ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME) "
|
||||
+ "select ID_, 1, NAME_, PARENT_TASK_ID_,DESCRIPTION_, PRIORITY_, START_TIME_, OWNER_, ASSIGNEE_, '', PROC_INST_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, 1, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME "
|
||||
+ "from ACT_HI_TASKINST a where a.id_='"+lastTaskId+"'";
|
||||
|
||||
//--删除最后一步
|
||||
String delTaskSql="delete from act_hi_actinst a where a.proc_inst_id_ ='"+procInstId+"' and act_type_='endEvent'";
|
||||
//--修改流程状态
|
||||
String updProcSql="update ACT_HI_PROCINST a set a.end_time_=null,a.end_act_id_=null,proc_state=1 where a.proc_inst_id_ ='"+procInstId+"'";
|
||||
|
||||
//--恢复变量
|
||||
String addVarSql="insert into act_ru_variable(id_, rev_, type_, name_, execution_id_, proc_inst_id_, task_id_, bytearray_id_, double_, long_, text_, text2_) "
|
||||
+ "select id_, rev_, var_type_, name_, execution_id_, proc_inst_id_, null, bytearray_id_, double_, long_, text_, text2_ "
|
||||
+ "from act_hi_varinst a where a.proc_inst_id_ ='"+procInstId+"' and task_id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--同步待办数据
|
||||
String upUnieHisSql="update t_unitework_history h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid='"+lastTaskId+"'";
|
||||
/* --update t_unitework_task h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid='"+lastTaskId+"';
|
||||
--select *from t_unitework_task where unite_cur_actinstid='"+lastTaskId+"';*/
|
||||
String addUnieHisSql="insert into t_unitework_task(unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid) select unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid "
|
||||
+ " from t_unitework_history h where h.unite_cur_actinstid='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--修改环节时间
|
||||
String uptActIstSql="update ACT_HI_ACTINST aat set aat.end_time_=null,aat.duration_=null "
|
||||
+ "where aat.proc_inst_id_ ='"+procInstId+"' and id_='"+lastActId+"'";
|
||||
String uptTaskSql="update ACT_HI_TASKINST tt set tt.claim_time_=null,tt.end_time_=null,tt.duration_=null,tt.delete_reason_=null "
|
||||
+ " where tt.proc_inst_id_ ='"+procInstId+"' and id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--修改意见数据 --select *from ACT_HI_COMMENT where proc_inst_id_ ='9d8ae48d-199b-11e7-a9d2-005056b64a7d' and task_id_='08549ade-19ca-11e7-a9d2-005056b64a7d';
|
||||
String delComSql="delete from ACT_HI_COMMENT where proc_inst_id_ ='"+procInstId+"' and task_id_='"+lastTaskId+"'";
|
||||
//---插入人员对象
|
||||
|
||||
buf.append(addExeSql).append(";\n").append(addTaskSql).append(";\n").append(delTaskSql).append(";\n").append(updProcSql).append(";\n")
|
||||
.append(addVarSql).append(";\n").append(upUnieHisSql).append(";\n").append(addUnieHisSql)
|
||||
.append(";\n").append(uptActIstSql).append(";\n").append(uptTaskSql).append(";\n").append(delComSql);
|
||||
System.out.println(buf.toString());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String lastTaskId="593f6340-c1f3-11e8-ad75-005056b6289c";
|
||||
String lastActId="593f3c2f-c1f3-11e8-ad75-005056b6289c";
|
||||
String procInstId="68e79036-c076-11e8-ad75-005056b6289c";
|
||||
/*select *from ACT_HI_TASKINST a where a.proc_inst_id_ ='9d8ae48d-199b-11e7-a9d2-005056b64a7d' order by start_time_
|
||||
|
||||
|
||||
select *from Act_Hi_Actinst aa where aa.task_id_='08549ade-19ca-11e7-a9d2-005056b64a7d' */
|
||||
StringBuffer buf =new StringBuffer();
|
||||
//---插入执行路径
|
||||
String addExeSql="insert into ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_, TENANT_ID_, NAME_,PROC_TITLE,TOP_PROCESS_INSTANCE_ID_) "
|
||||
+ "select EXECUTION_ID_, '1', PROC_INST_ID_, '', PROC_DEF_ID_, TASK_DEF_KEY_, 1, 0, 1, 0, NULL, NULL, 1, 2, tenant_id_, NULL,proc_title,PROC_INST_ID_ from ACT_HI_TASKINST a where a.id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//---插入任务对象
|
||||
|
||||
|
||||
String addTaskSql="insert into ACT_RU_TASK(ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME) "
|
||||
+ "select ID_, 1, NAME_, PARENT_TASK_ID_,DESCRIPTION_, PRIORITY_, START_TIME_, OWNER_, ASSIGNEE_, '', PROC_INST_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, 1, TENANT_ID_, FORM_KEY_,PROC_TITLE,SENDER, PRE_TASK_DEF_KEY,PRE_TASK_DEF_NAME,PRE_TASK_ID,ACTION_TYPE,SEND_USER_NAME,SENDER_ORG_ID,SENDER_ORG_NAME,ASSIGNEE_USER_NAME,ASSIGNEE_ORG_ID,ASSIGNEE_ORG_NAME,ASSIGNEE_USER_ID,SEND_USER_ID,PROC_DEF_NAME "
|
||||
+ "from ACT_HI_TASKINST a where a.id_='"+lastTaskId+"'";
|
||||
|
||||
//--删除最后一步
|
||||
String delTaskSql="delete from act_hi_actinst a where a.proc_inst_id_ ='"+procInstId+"' and act_type_='endEvent'";
|
||||
//--修改流程状态
|
||||
String updProcSql="update ACT_HI_PROCINST a set a.end_time_=null,a.end_act_id_=null,proc_state=1 where a.proc_inst_id_ ='"+procInstId+"'";
|
||||
|
||||
//--恢复变量
|
||||
String addVarSql="insert into act_ru_variable(id_, rev_, type_, name_, execution_id_, proc_inst_id_, task_id_, bytearray_id_, double_, long_, text_, text2_) "
|
||||
+ "select id_, rev_, var_type_, name_, execution_id_, proc_inst_id_, null, bytearray_id_, double_, long_, text_, text2_ "
|
||||
+ "from act_hi_varinst a where a.proc_inst_id_ ='"+procInstId+"' and task_id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--同步待办数据
|
||||
String upUnieHisSql="update t_unitework_history h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid='"+lastTaskId+"'";
|
||||
/* --update t_unitework_task h set h.unite_status=1,h.unite_deal_time=null where h.unite_cur_actinstid='"+lastTaskId+"';
|
||||
--select *from t_unitework_task where unite_cur_actinstid='"+lastTaskId+"';*/
|
||||
String addUnieHisSql="insert into t_unitework_task(unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid) select unite_id, unite_title, unite_abstract, unite_content, unite_category, unite_rec_userid, unite_rec_username, unite_rec_orgid, unite_rec_orgname, unite_send_userid, unite_send_username, unite_send_orgid, unite_send_orgname, unite_status, unite_url, unite_tenant_id, unite_tenant_name, unite_send_time, unite_deal_time, unite_start_userid, unite_start_orgid, unite_start_username, unite_start_orgname, unite_start_time, unite_top_procinstid, unite_parent_procinstid, unite_procinstid, unite_procdefid, unite_procdefname, unite_cur_actinstid, unite_cur_actdefid, unite_cur_actdefname, unite_prev_actinstid, unite_prev_actdefid, unite_prev_actdefname, unite_service_code, unite_batch_id, unite_data_souce, unite_other_sys_deal_status, unite_procdefkey, unite_cur_actlimittime, unite_esb_messageid "
|
||||
+ " from t_unitework_history h where h.unite_cur_actinstid='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--修改环节时间
|
||||
String uptActIstSql="update ACT_HI_ACTINST aat set aat.end_time_=null,aat.duration_=null "
|
||||
+ "where aat.proc_inst_id_ ='"+procInstId+"' and id_='"+lastActId+"'";
|
||||
String uptTaskSql="update ACT_HI_TASKINST tt set tt.claim_time_=null,tt.end_time_=null,tt.duration_=null,tt.delete_reason_=null "
|
||||
+ " where tt.proc_inst_id_ ='"+procInstId+"' and id_='"+lastTaskId+"'";
|
||||
|
||||
|
||||
//--修改意见数据 --select *from ACT_HI_COMMENT where proc_inst_id_ ='9d8ae48d-199b-11e7-a9d2-005056b64a7d' and task_id_='08549ade-19ca-11e7-a9d2-005056b64a7d';
|
||||
String delComSql="delete from ACT_HI_COMMENT where proc_inst_id_ ='"+procInstId+"' and task_id_='"+lastTaskId+"'";
|
||||
//---插入人员对象
|
||||
|
||||
buf.append(addExeSql).append(";\n").append(addTaskSql).append(";\n").append(delTaskSql).append(";\n").append(updProcSql).append(";\n")
|
||||
.append(addVarSql).append(";\n").append(upUnieHisSql).append(";\n").append(addUnieHisSql)
|
||||
.append(";\n").append(uptActIstSql).append(";\n").append(uptTaskSql).append(";\n").append(delComSql);
|
||||
System.out.println(buf.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.blueland.bpm.manage.service;
|
||||
|
||||
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");
|
||||
//response.setHeader("Content-Security-Policy", "default-src 'self'");
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
|
||||
public void destroy() {}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
public class ApplicationContextHolder implements ApplicationContextAware {
|
||||
private static Log log = LogFactory.getLog(ApplicationContextHolder.class);
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
public ApplicationContextHolder() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||
applicationContext = context;
|
||||
log.info("holded applicationContext,displayName:" + applicationContext.getDisplayName());
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
if (applicationContext == null) {
|
||||
throw new IllegalStateException("'applicationContext' property is null,ApplicationContextHolder not yet init.");
|
||||
} else {
|
||||
return applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getBean(String beanName) {
|
||||
return getApplicationContext().getBean(beanName);
|
||||
}
|
||||
|
||||
public static Map<String, Object> getBeans(Class clazz) {
|
||||
return getApplicationContext().getBeansOfType(clazz);
|
||||
}
|
||||
|
||||
public static void cleanHolder() {
|
||||
applicationContext = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.identity.RoleService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.Role;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseUser {
|
||||
private static BaseUser baseUser=new BaseUser();
|
||||
private static RoleService roleService;
|
||||
private static UserService userService;
|
||||
private BaseUser(){
|
||||
|
||||
}
|
||||
public static BaseUser getInstance(){
|
||||
roleService=(RoleService)ApplicationContextHolder.getBean("roleServiceImpl");
|
||||
userService=(UserService)ApplicationContextHolder.getBean("userServiceImpl");
|
||||
return baseUser;
|
||||
}
|
||||
public void setRoleService(RoleService roleService) {
|
||||
BaseUser.roleService = roleService;
|
||||
}
|
||||
/**
|
||||
* 系统管理员
|
||||
*/
|
||||
public static String ROLE_SYSROLE = "sysrole";
|
||||
public static String ROLE_EBPMADMIN="ebpmAdmin";
|
||||
public String getUserId(HttpServletRequest request) {
|
||||
//Cookie
|
||||
String sUserId = getCookieUser(request);
|
||||
return sUserId ;
|
||||
}
|
||||
|
||||
|
||||
public User backSSO(HttpServletRequest request,HttpServletResponse response,String userId){
|
||||
if(StringUtils.isEmpty(userId)){
|
||||
userId=request.getHeader("iv-user");
|
||||
}
|
||||
User loginUser=null;
|
||||
if(StringUtils.isEmpty(userId)){
|
||||
try {
|
||||
loginUser = getSessionUser(request);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
loginUser = userService.getUserById(userId);
|
||||
baseUser.cleanCookieUser(request, response);
|
||||
baseUser.setCookieUser(response, BaseUser.toUpperCase(userId));
|
||||
System.out.println(userId);
|
||||
baseUser.saveUserToSession(request, loginUser, null);
|
||||
}
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
public String getCookieUser (HttpServletRequest request){
|
||||
|
||||
Cookie [] cookie = request.getCookies();
|
||||
|
||||
if(null!=cookie){
|
||||
for(int i=0,len=cookie.length; i<len; i++){
|
||||
if(cookie[i].getName().equalsIgnoreCase(MyContants.userId)){
|
||||
String userId = cookie[i].getValue().toString();
|
||||
return toUpperCase(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void cleanCookieUser (HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
Cookie[] cookies=request.getCookies();
|
||||
if(cookies!=null){
|
||||
for(int i=0,len=cookies.length; i<len; i++)
|
||||
{
|
||||
Cookie cookie=cookies[i];
|
||||
if(cookie!=null&&MyContants.userId.equals(cookie.getName())){
|
||||
cookie.setMaxAge(0);
|
||||
cookie.setValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setCookieUser (HttpServletResponse response,String userId) {
|
||||
Cookie mycookie=new Cookie(MyContants.userId,toUpperCase(userId));
|
||||
mycookie.setMaxAge(Integer.valueOf(MyContants.MAX_COOKIE));//????Cookie????????,??cookie??2????<3F><>
|
||||
mycookie.setPath("/");
|
||||
response.addCookie(mycookie);
|
||||
}
|
||||
public String getSessionUser(HttpServletRequest request,String userId){
|
||||
HttpSession hs = request.getSession();
|
||||
String sUserId = (String)hs.getAttribute(MyContants.userId);
|
||||
if (sUserId!=null && sUserId.length()>0)
|
||||
sUserId = toUpperCase(sUserId);
|
||||
return sUserId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setUser(HttpServletRequest request,HttpServletResponse response,String UserID)
|
||||
{
|
||||
|
||||
Cookie ck=new Cookie(MyContants.userId,toUpperCase(UserID));
|
||||
ck.setMaxAge(Integer.valueOf(MyContants.MAX_COOKIE));//cookie????10<31><30>?
|
||||
String path1 = request.getContextPath();
|
||||
ck.setPath(path1);
|
||||
response.addCookie(ck);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ????????
|
||||
public static String toUpperCase(String source){
|
||||
|
||||
String sour = source;
|
||||
try{
|
||||
sour = sour.toUpperCase();
|
||||
}catch(Exception ex){
|
||||
sour = source;
|
||||
}
|
||||
return sour;
|
||||
}
|
||||
|
||||
public void saveUserToSession(HttpServletRequest request,User loginUser, List<ApplicationEntity> applications){
|
||||
HttpSession session=request.getSession(true);
|
||||
try{
|
||||
boolean isAdmin= isSysrole(loginUser);
|
||||
boolean isEbpmAdmin = isEbpmAdmin(loginUser);
|
||||
session.setAttribute(ROLE_SYSROLE, isAdmin);
|
||||
session.setAttribute(ROLE_EBPMADMIN, isEbpmAdmin);
|
||||
session.setAttribute(MyContants.LOGIN_SESSION_USER, loginUser);
|
||||
// Map<String,String> appMaps=new HashMap<String,String>();
|
||||
// appMaps.put("","所有系统");
|
||||
// appMaps.put("STDD_SYS","标准化系统");
|
||||
// appMaps.put("WORKDOC_SYS","公文系统");
|
||||
// appMaps.put("WORKORDER_SYS","工单系统");
|
||||
// if(isAdmin){
|
||||
// session.setAttribute(MyContants.APP_ID_KEY, "");
|
||||
// }else{
|
||||
// session.setAttribute(MyContants.APP_ID_KEY, "STDD_SYS");
|
||||
// }
|
||||
// session.setAttribute("APP_MAPS", appMaps);
|
||||
if(applications!=null){
|
||||
session.setAttribute("APP_MAPS", applications);
|
||||
saveLoginUserAppId( applications.get(0), request);
|
||||
}
|
||||
session.setMaxInactiveInterval(Integer.valueOf(MyContants.MAX_SESSION));
|
||||
}catch(Throwable e){
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLoginUserAppId(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession();
|
||||
String appId = (String) session.getAttribute(MyContants.APP_ID_KEY);
|
||||
return appId;
|
||||
}
|
||||
|
||||
public ApplicationEntity getLoginUserApplication(HttpServletRequest request){
|
||||
HttpSession session = request.getSession();
|
||||
ApplicationEntity application = (ApplicationEntity) session.getAttribute(MyContants.APPLICATION);
|
||||
return application;
|
||||
}
|
||||
|
||||
public void saveLoginUserAppId(ApplicationEntity application,HttpServletRequest request) {
|
||||
HttpSession session = request.getSession(false);
|
||||
session.setAttribute(MyContants.APP_ID_KEY,application.getAppId());
|
||||
session.setAttribute(MyContants.APPLICATION, application);
|
||||
}
|
||||
|
||||
public void removeUserToSession(HttpServletRequest request){
|
||||
HttpSession session=request.getSession(false);
|
||||
try{
|
||||
User userData=(User)session.getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
if(userData!=null){
|
||||
userData=null;
|
||||
}
|
||||
session.removeAttribute(MyContants.USER_ROLES);
|
||||
session.removeAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
session.invalidate();
|
||||
|
||||
}catch(Throwable e){
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
public List getUserRoles(String userId){
|
||||
//return copyRoleData(orgSchema.getUserRoles(userId));
|
||||
return null;
|
||||
}
|
||||
public boolean isInRole(HttpServletRequest request,List roles,String purviewName){
|
||||
|
||||
/*try {
|
||||
if(getSessionUser(request)==null){
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(StringUtils.isNull(roles)){
|
||||
return false;
|
||||
}
|
||||
//HttpSession session=request.getSession();
|
||||
//Boolean isAdmin=(Boolean) session.getAttribute(MyContants.KH_COMPANY_ADMIN_ROLE);
|
||||
if(isAdmin!=null&&isAdmin.booleanValue()){
|
||||
return true;
|
||||
}else if(MyContants.KH_ORG_ADMIN_ROLE.equals(purviewName)){
|
||||
Boolean isOrgRole=(Boolean) session.getAttribute(MyContants.KH_ORG_ADMIN_ROLE);
|
||||
return (isOrgRole!=null?isOrgRole.booleanValue():false);
|
||||
}
|
||||
else{
|
||||
|
||||
if(roles!=null){
|
||||
for(int i=0;i<roles.size();i++){
|
||||
RoleData role=(RoleData)roles.get(i);
|
||||
if(role.getName().equalsIgnoreCase(purviewName)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
*/ return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
public User getSessionUser(HttpServletRequest request)throws Exception{
|
||||
User loginUser=null;
|
||||
loginUser=(User)request.getSession().getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
return loginUser;
|
||||
|
||||
}
|
||||
/**
|
||||
* 是否系统管理员
|
||||
*/
|
||||
public static boolean isSysrole(User user){
|
||||
return checkRoleByUserId(user.getUserId(), ROLE_SYSROLE);
|
||||
}
|
||||
/**
|
||||
* 是否流程管理员
|
||||
*/
|
||||
public static boolean isEbpmAdmin(User user){
|
||||
return checkRoleByUserId(user.getUserId(), ROLE_EBPMADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否流程管理员
|
||||
*/
|
||||
public static boolean isEbpmAdminSession(HttpServletRequest request){
|
||||
try {
|
||||
return (boolean) request.getSession().getAttribute(ROLE_EBPMADMIN);
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 是否流程管理员
|
||||
*/
|
||||
public static boolean isEbpmAdmin(HttpServletRequest request){
|
||||
User user=null;
|
||||
try {
|
||||
user = BaseUser.getInstance().getSessionUser(request);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return checkRoleByUserId(user.getUserId(), ROLE_EBPMADMIN);
|
||||
}
|
||||
private static boolean checkRoleByUserId(String userId,String roleFlag){
|
||||
try{
|
||||
List<Role> userRoles=roleService.findRoleByUserId(userId);
|
||||
for(Role role : userRoles){
|
||||
if (roleFlag.equals(role.getRoleId())||(role.getRoleId().equals("1")&&roleFlag.equals(ROLE_EBPMADMIN))){
|
||||
return true;
|
||||
}
|
||||
}}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* 检测是否为移动端设备访问
|
||||
*/
|
||||
public class CheckMobile {
|
||||
|
||||
// \b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),
|
||||
// 字符串在编译时会被转码一次,所以是 "\\b"
|
||||
// \B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔)
|
||||
static String phoneReg = "\\b(ip(hone|od)|android|opera m(ob|in)i"
|
||||
+"|windows (phone|ce)|blackberry"
|
||||
+"|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp"
|
||||
+"|laystation portable)|nokia|fennec|htc[-_]"
|
||||
+"|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
static String tableReg = "\\b(ipad|tablet|(Nexus 7)|up.browser"
|
||||
+"|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
|
||||
//移动设备正则匹配:手机端、平板
|
||||
static Pattern phonePat = Pattern.compile(phoneReg, Pattern.CASE_INSENSITIVE);
|
||||
static Pattern tablePat = Pattern.compile(tableReg, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
/**
|
||||
* 检测是否是移动设备访问
|
||||
*
|
||||
* @Title: check
|
||||
* @Date : 2014-7-7 下午01:29:07
|
||||
* @param userAgent 浏览器标识
|
||||
* @return true:移动设备接入,false:pc端接入
|
||||
*/
|
||||
public static boolean check(String userAgent){
|
||||
if(null == userAgent){
|
||||
userAgent = "";
|
||||
}
|
||||
// 匹配
|
||||
Matcher matcherPhone = phonePat.matcher(userAgent);
|
||||
Matcher matcherTable = tablePat.matcher(userAgent);
|
||||
if(matcherPhone.find() || matcherTable.find()){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkuserAgent(HttpServletRequest request,HttpServletResponse response) throws IOException{
|
||||
boolean isFromMobile=false;
|
||||
|
||||
HttpSession session= request.getSession();
|
||||
//检查是否已经记录访问方式(移动端或pc端)
|
||||
if(null==session.getAttribute("ua")){
|
||||
try{
|
||||
//获取ua,用来判断是否为移动端访问
|
||||
String userAgent = request.getHeader( "USER-AGENT" ).toLowerCase();
|
||||
if(null == userAgent){
|
||||
userAgent = "";
|
||||
}
|
||||
isFromMobile=CheckMobile.check(userAgent);
|
||||
//判断是否为移动端访问
|
||||
if(isFromMobile){
|
||||
System.out.println("移动端访问");
|
||||
session.setAttribute("ua","mobile");
|
||||
} else {
|
||||
System.out.println("pc端访问");
|
||||
session.setAttribute("ua","pc");
|
||||
}
|
||||
}catch(Exception e){}
|
||||
}else{
|
||||
isFromMobile=session.getAttribute("ua").equals("mobile");
|
||||
}
|
||||
|
||||
return isFromMobile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
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.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class CheckUserLoginFilter implements Filter {
|
||||
|
||||
public CheckUserLoginFilter() {
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
boolean flag = false;
|
||||
String spath = request.getServletPath();
|
||||
String userId = request.getHeader("iv-user");
|
||||
userId = "admin";
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
if (spath.indexOf("/depute/create") != -1 || spath.indexOf("/trace/") != -1
|
||||
|| spath.indexOf("resource.do") != -1 || spath.indexOf("login.do") != -1
|
||||
|| spath.indexOf("logout.do") != -1 || spath.indexOf("login.jsp") != -1
|
||||
|| spath.indexOf("applicationMgr/syncApp.do") != -1
|
||||
|| spath.indexOf("role/sync/saveOrUpdate.do") != -1
|
||||
|| spath.indexOf("role/sync/saveUserrole.do") != -1
|
||||
|| spath.indexOf("activityInfo/getActForm.do") != -1
|
||||
|| spath.indexOf("role/sync/delRole.do") != -1
|
||||
|| spath.indexOf("procDefMgr") != -1
|
||||
|| spath.indexOf("workflow/trace") != -1
|
||||
|| spath.indexOf("flow/monitor") != -1
|
||||
|| spath.indexOf("procDefModelMgr") != -1) {
|
||||
flag = true;
|
||||
} else {
|
||||
try {
|
||||
if (BaseUser.getInstance().getSessionUser((HttpServletRequest) request) != null)
|
||||
flag = true;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
filterChain.doFilter(request, response);
|
||||
else
|
||||
response.sendRedirect(request.getSession().getServletContext().getContextPath() + "/login.jsp");
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterconfig) throws ServletException {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.activiti.bpmn.model.ExpandProperty;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
|
||||
import com.blueland.bpm.engine.util.ProcessDefinitionUtils;
|
||||
|
||||
|
||||
public class ComparatorTransition implements Comparator<SequenceFlow>{
|
||||
|
||||
@Override
|
||||
public int compare(SequenceFlow sequenceFlow1, SequenceFlow sequenceFlow2) {
|
||||
ExpandProperty expandProperty1=ProcessDefinitionUtils.findTransitionOrder(sequenceFlow1.getExpandProperties());
|
||||
ExpandProperty expandProperty2=ProcessDefinitionUtils.findTransitionOrder(sequenceFlow2.getExpandProperties());
|
||||
String val1="99";
|
||||
String val2="99";
|
||||
if(expandProperty1!=null){
|
||||
val1=expandProperty1.getValue();
|
||||
}
|
||||
if(expandProperty2!=null){
|
||||
val2=expandProperty2.getValue();
|
||||
}
|
||||
return val1.compareTo(val2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HttpUtil {
|
||||
private final static String APPLICATION_JSON = "application/json";
|
||||
|
||||
public static String get(String url) {
|
||||
String retvalue = "";
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
try {
|
||||
HttpGet httpget = new HttpGet(url);
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(950000000)
|
||||
.setConnectTimeout(950000000).build();
|
||||
httpget.setConfig(requestConfig);
|
||||
httpget.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
|
||||
ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
|
||||
|
||||
public String handleResponse(final HttpResponse response) throws ClientProtocolException, IOException {
|
||||
int status = response.getStatusLine().getStatusCode();
|
||||
if (status >= 200 && status < 300) {
|
||||
HttpEntity entity = (HttpEntity) response.getEntity();
|
||||
return entity != null ? EntityUtils.toString((org.apache.http.HttpEntity) entity) : null;
|
||||
} else {
|
||||
throw new ClientProtocolException("Unexpected response status: " + status);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
retvalue = httpclient.execute(httpget, responseHandler);
|
||||
} catch (Exception ex) {
|
||||
throw new java.lang.IllegalArgumentException("get url error: " + ex);
|
||||
} finally {
|
||||
try {
|
||||
httpclient.close();
|
||||
} catch (Exception e) {
|
||||
throw new java.lang.IllegalArgumentException("httpclient.close(): " + e);
|
||||
}
|
||||
}
|
||||
return retvalue;
|
||||
}
|
||||
|
||||
public static String post(String url,String body){
|
||||
String retvalue = "";
|
||||
CloseableHttpClient httpclient = HttpClients.createDefault();
|
||||
try {
|
||||
HttpPost httppost = new HttpPost(url);
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(950000000)
|
||||
.setConnectTimeout(950000000).build();
|
||||
httppost.setConfig(requestConfig);
|
||||
httppost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
|
||||
StringEntity entity = new StringEntity(body, "UTF-8");
|
||||
entity.setContentType("application/json;charset=UTF-8");
|
||||
entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,
|
||||
"application/json;charset=UTF-8"));
|
||||
httppost.setEntity(entity);
|
||||
CloseableHttpResponse response = httpclient.execute(httppost);
|
||||
try {
|
||||
retvalue = EntityUtils.toString(response.getEntity());
|
||||
} catch (Exception ex) {
|
||||
throw new java.lang.Exception("post url error: " + ex);
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException ex) {
|
||||
throw new java.io.IOException("post url error: " + ex);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new java.lang.IllegalArgumentException("post url error: " + ex);
|
||||
} finally {
|
||||
try {
|
||||
httpclient.close();
|
||||
} catch (IOException e) {
|
||||
throw new java.lang.IllegalArgumentException("httpclient.close(): " + e);
|
||||
}
|
||||
}
|
||||
return retvalue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import com.blueland.bpm.common.util.ApplicationContextHolder;
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.log.service.TlogUserOperateManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class MyContants {
|
||||
public static final String userId = "bpm_login_cookie_userid";
|
||||
public static final String APP_ID_KEY="app_id";
|
||||
public static final String APPLICATION="application";
|
||||
public static final String MAX_COOKIE=(String) SysConfig.getValue("MAX_COOKIE");
|
||||
|
||||
public static final String MAX_SESSION=(String) SysConfig.getValue("MAX_SESSION");
|
||||
public static final String LOGIN_SESSION_USER ="bpm_login_session_user";
|
||||
public static final String TOP_ORG_ID= (String)SysConfig.getValue("TOP_ORG_ID");
|
||||
public static final String profile= (String)SysConfig.getValue("profile");
|
||||
|
||||
public static String BPM_PROCESS_MODELER_PATH = (String) SysConfig
|
||||
.getValue("bpm_process_modeler_path") ;
|
||||
|
||||
public static final String EBPM_UNITEWORK_MANAGE_PATH = (String) SysConfig
|
||||
.getValue("EBPM_UNITEWORK_MANAGE_PATH") ;
|
||||
public static final String PERSONAL_OFFICE_PATH = (String) SysConfig
|
||||
.getValue("personal_office_path") ;
|
||||
public static final String IS_OPEN_TENANT=(String)SysConfig.getValue("IS_OPEN_TENANT");
|
||||
public static final String USER_ROLES="user_roles";
|
||||
public static final Map DV_STATUS=new HashMap();
|
||||
private static final Logger log = LoggerFactory.getLogger(MyContants.class);
|
||||
|
||||
public static final String KSKF_PAHT = (String) SysConfig
|
||||
.getValue("kskf_path") ;
|
||||
public static final String BPM_FILE_PATH = (String) SysConfig
|
||||
.getValue("bpm_file_path") ;
|
||||
public static final String BPM_FRONT_PATH = (String) SysConfig
|
||||
.getValue("bpm_front_path") ;
|
||||
|
||||
@Autowired
|
||||
private static TlogUserOperateManager userOperateService ;
|
||||
|
||||
public static void setUserOperateService(
|
||||
TlogUserOperateManager userOperateService) {
|
||||
MyContants.userOperateService = userOperateService;
|
||||
}
|
||||
|
||||
public static void resetBpmProcessModelerPath(String path){
|
||||
BPM_PROCESS_MODELER_PATH = path;
|
||||
}
|
||||
|
||||
static{
|
||||
DV_STATUS.put("OFF","离线");
|
||||
DV_STATUS.put("ON","在线");
|
||||
}
|
||||
|
||||
public static boolean isTestProfile() {
|
||||
if(profile!=null&&profile.equals("test")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static String getContextJunction(HttpServletRequest request) {
|
||||
String http = "http:";
|
||||
String https = "https:";
|
||||
String ctx = "";
|
||||
//log.info("iv--"+request.getHeader("iv-user"));
|
||||
if (null == SysConfig.getValue("CTX")
|
||||
||request.getHeader("iv-user") == null) {
|
||||
return ctx;
|
||||
}
|
||||
/*log.info("iv--"+request.getHeader("iv-user"));
|
||||
// referer为先前网页的地址,当前请求网页紧随其后,即来路。可视化中用此属性来区分http/https
|
||||
String referer = request.getHeader("referer");
|
||||
// Via为通知中间网关或代理服务器地址,通信协议。如可视化或直接浏览器访问没有referer,用此属性来区分http/https
|
||||
String via = request.getHeader("Via");
|
||||
log.info("referer--"+referer);
|
||||
log.info("via--"+via);
|
||||
*/
|
||||
ctx = (String) SysConfig.getValue("CTX");
|
||||
/*if (StringUtils.isNotEmpty(referer)) {
|
||||
if (referer.indexOf(https) != -1) {// https访问
|
||||
ctx = ctx.indexOf(http) != -1 ? ctx.replace(http, https) : ctx;
|
||||
} else if (referer.indexOf(http) != -1) {// http访问
|
||||
ctx = ctx.indexOf(https) != -1 ? ctx.replace(https, http) : ctx;
|
||||
}
|
||||
} else if (StringUtils.isNotEmpty(via)) {
|
||||
if (request.getHeader("Via").indexOf(":443") != -1) {// https访问
|
||||
ctx = ctx.indexOf(http) != -1 ? ctx.replace(http, https) : ctx;
|
||||
} else if (request.getHeader("Via").indexOf(":80") != -1) {// http访问
|
||||
ctx = ctx.indexOf(https) != -1 ? ctx.replace(https, http) : ctx;
|
||||
}
|
||||
}
|
||||
log.info("ctx-"+ctx);*/
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request 客户端发送的请求
|
||||
* @param param 需要获取的参数列表
|
||||
* @param isSuccess true为成功 false为失败
|
||||
* @param message 操作的结果字符串,可以自定义,可以为空
|
||||
* @param login_session_user 在session中获取用户信息的key
|
||||
* @param 在session中获取当前租户信息的key
|
||||
*/
|
||||
public static void saveUserOperate(HttpServletRequest request,
|
||||
String paramStr,boolean isSuccess,String message,
|
||||
String login_session_user,String applicationStr){
|
||||
try {
|
||||
userOperateService=(TlogUserOperateManager)ApplicationContextHolder.getBean("tlogUserOperateManager");
|
||||
userOperateService.saveUserOperate(request, paramStr,
|
||||
isSuccess, message,login_session_user,applicationStr);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
public class ProcessZipUtil {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ProcessZipUtil.class);
|
||||
|
||||
|
||||
/**
|
||||
* 压缩文件
|
||||
*
|
||||
* @param srcfile
|
||||
* File[] 需要压缩的文件列表
|
||||
* @param zipfile
|
||||
* File 压缩后的文件
|
||||
*/
|
||||
public static void zipFiles(Map<String, byte[]> srcFileBytes,
|
||||
OutputStream out) {
|
||||
// Create the ZIP file
|
||||
ZipOutputStream zipOut = new ZipOutputStream(out);
|
||||
try {
|
||||
// Compress the files
|
||||
for (Entry<String, byte[]> srcFileByte : srcFileBytes.entrySet()) {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(
|
||||
srcFileByte.getValue());
|
||||
try {
|
||||
// Add ZIP entry to output stream.
|
||||
zipOut.putNextEntry(new ZipEntry(srcFileByte.getKey()));
|
||||
// Transfer bytes from the file to the ZIP file
|
||||
IOUtils.copy(in, zipOut);
|
||||
// Complete the entry
|
||||
zipOut.closeEntry();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("ProcessZipUtil zipFiles exception:" + e);
|
||||
} finally {
|
||||
//IOUtils.closeQuietly(zipOut);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压缩
|
||||
*
|
||||
* @param zipfile
|
||||
* File 需要解压缩的文件
|
||||
* @param descDir
|
||||
* String 解压后的目标目录
|
||||
*/
|
||||
public static Map<String,byte[][]> unZipFiles(byte[] zipfile) {
|
||||
Map<String,byte[][]> processFile = new HashMap<String,byte[][]>();
|
||||
ZipInputStream zf = null;
|
||||
try {
|
||||
// Open the ZIP file
|
||||
ZipEntry entry = null;
|
||||
zf = new ZipInputStream(new ByteArrayInputStream(zipfile));
|
||||
while ((entry = zf.getNextEntry()) != null) {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
try {
|
||||
String zipEntryName = entry.getName();
|
||||
String[] zipEntryNames = new String[3];
|
||||
if (zipEntryName.indexOf(".") != -1) {
|
||||
zipEntryNames = zipEntryName.split("\\.");
|
||||
}
|
||||
IOUtils.copy(zf, out);
|
||||
if (processFile.containsKey(zipEntryNames[0])) {
|
||||
if (zipEntryNames[1].indexOf("data") != -1) {
|
||||
processFile.get(zipEntryNames[0])[1]=
|
||||
out.toByteArray();
|
||||
} else if (zipEntryNames[1].indexOf("bpmn20") != -1) {
|
||||
processFile.get(zipEntryNames[0])[0]=
|
||||
out.toByteArray();
|
||||
}
|
||||
} else {
|
||||
byte[][] values = new byte[2][];
|
||||
if (zipEntryNames[1].indexOf("data") != -1) {
|
||||
values[1]=out.toByteArray();
|
||||
} else if (zipEntryNames[1].indexOf("bpmn20") != -1) {
|
||||
values[0]=out.toByteArray();
|
||||
}
|
||||
processFile.put(zipEntryNames[0], values);
|
||||
}
|
||||
zf.closeEntry();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("ProcessZipUtil unZipFiles exception:" + e);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(zf);
|
||||
}
|
||||
return processFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main
|
||||
*
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
FileInputStream input = new FileInputStream("d:\\项目报价工作量估算.xls");
|
||||
FileOutputStream out = new FileOutputStream("d:\\a.zip");
|
||||
// Create the ZIP file
|
||||
ZipOutputStream zipOut = new ZipOutputStream(out);
|
||||
try {
|
||||
try {
|
||||
// Add ZIP entry to output stream.
|
||||
zipOut.putNextEntry(new ZipEntry("d/项目报价工作量估算.xls"));
|
||||
// Transfer bytes from the file to the ZIP file
|
||||
IOUtils.copy(input, zipOut);
|
||||
// Complete the entry
|
||||
zipOut.closeEntry();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("ProcessZipUtil zipFiles exception:" + e);
|
||||
} finally {
|
||||
// IOUtils.closeQuietly(zipOut);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.common.util.DateConvertUtils;
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.log.model.ProcessErrorLog;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
/**
|
||||
* @author ly
|
||||
*
|
||||
*/
|
||||
public class SmsEmailMsg {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SmsEmailMsg.class);
|
||||
/**
|
||||
* 发送邮件提醒
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public static String sendSmsEmail(String param) {
|
||||
String url = (String) SysConfig.getValue("SMS_EMAIL_URL");
|
||||
if (StringUtils.isEmpty(url)) {
|
||||
log.info(String.format("未配置邮件发送地址"));
|
||||
return null;
|
||||
}
|
||||
return HttpUtil.post(url, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用信息和流程错误信息组装邮件发送参数
|
||||
* @param applicationEntity 应用信息
|
||||
* @param processErrorLog 流程错误信息
|
||||
* @return
|
||||
*/
|
||||
public static String buildEmailMsgData(ApplicationEntity applicationEntity, ProcessErrorLog processErrorLog,String msg) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("toMailAddress", applicationEntity.getManagerEmails());//applicationEntity.getAppUserMails());
|
||||
jsonObject.addProperty("toMailUser", applicationEntity.getManagerNames());//applicationEntity.getAppUserNames());
|
||||
jsonObject.addProperty("mailSubject", processErrorLog.getAppId()+"_"+processErrorLog.getProcessTitle()+"异常"+msg);
|
||||
String ebpmUrl = (String) SysConfig.getValue("EBPM_URL");
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("管理员,您好\n");
|
||||
content.append(
|
||||
" " + processErrorLog.getAppId()+"_"+processErrorLog.getProcessTitle()+"异常"+msg + ",请管理员访问 " + ebpmUrl + " (流程执行管理系统)进行查看。\n");
|
||||
content.append("\t\t\t\t\t\t\t\t\t\t" + DateConvertUtils.format(new Date(), "yyyy-MM-dd"));
|
||||
jsonObject.addProperty("mailMessage", content.toString());
|
||||
jsonObject.addProperty("fromUser", "系统管理员");
|
||||
return jsonObject.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
public class TreeNode {
|
||||
//private String tId;
|
||||
private String id;
|
||||
private String pId;
|
||||
private String name;
|
||||
private boolean checked;
|
||||
private boolean open;
|
||||
private boolean isParent;
|
||||
private String type;
|
||||
private String isAccessTopNode;
|
||||
private Integer level;
|
||||
private boolean isMulti;
|
||||
private boolean isNotSelectReceiver;
|
||||
private String linkUrl;
|
||||
//是否显示checkbox
|
||||
private boolean nocheck;
|
||||
private static final String pre_icon_path="/bpmc-manage/resource/js/plugins/zTree/";
|
||||
private String icon=pre_icon_path+"css/zTreeStyle/img/diy/1_open.png";
|
||||
public static final String TOPORGIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/home.png";
|
||||
public static final String ORGIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_open.png";
|
||||
public static final String USERIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_openUser.png";
|
||||
public static final String GROUPIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_openGroup.png";
|
||||
|
||||
public TreeNode(String id, String pId, String name, boolean checked, boolean open,boolean isParent,String type,String isAccessTopNode,Integer level,String linkUrl) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
this.open = open;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
this.isAccessTopNode=isAccessTopNode;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}
|
||||
this.level=level;
|
||||
this.isMulti=isMulti;
|
||||
this.linkUrl=linkUrl;
|
||||
|
||||
}
|
||||
|
||||
public TreeNode(String id, String pId, String name, boolean checked, boolean open,boolean isParent,String type,String isAccessTopNode,Integer level) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
this.open = open;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
this.isAccessTopNode=isAccessTopNode;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}
|
||||
this.level=level;
|
||||
this.isMulti=isMulti;
|
||||
|
||||
}
|
||||
public TreeNode(String id, String pId, String name, boolean checked, boolean open,boolean isParent,String type,String isAccessTopNode,Integer level,boolean nocheck) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
this.open = open;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
this.nocheck = nocheck;
|
||||
this.isAccessTopNode=isAccessTopNode;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}
|
||||
this.level=level;
|
||||
this.isMulti=isMulti;
|
||||
|
||||
}
|
||||
public TreeNode(String id, String pId, String name,boolean isParent,String type,boolean isMulti,boolean isNotSelectReceiver) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = false;
|
||||
this.open = isParent;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}
|
||||
this.isMulti=isMulti;
|
||||
this.isNotSelectReceiver=isNotSelectReceiver;
|
||||
}
|
||||
|
||||
public TreeNode() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the checked
|
||||
*/
|
||||
public boolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
/**
|
||||
* @param checked the checked to set
|
||||
*/
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
/**
|
||||
* @return the open
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
/**
|
||||
* @param open the open to set
|
||||
*/
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
/**
|
||||
* @return the pId
|
||||
*/
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
/**
|
||||
* @param pId the pId to set
|
||||
*/
|
||||
public void setpId(String pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
/**
|
||||
* @return the isParent
|
||||
*/
|
||||
public boolean getIsParent() {
|
||||
return isParent;
|
||||
}
|
||||
/**
|
||||
* @param isParent the isParent to set
|
||||
*/
|
||||
public void setIsParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the isAccess
|
||||
*/
|
||||
public String getIsAccessTopNode() {
|
||||
return isAccessTopNode;
|
||||
}
|
||||
/**
|
||||
* @param isAccess the isAccess to set
|
||||
*/
|
||||
public void setIsAccessTopNode(String isAccessTopNode) {
|
||||
this.isAccessTopNode = isAccessTopNode;
|
||||
}
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
public void setParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public boolean getIsMulti() {
|
||||
return isMulti;
|
||||
}
|
||||
|
||||
public void setMulti(boolean isMulti) {
|
||||
this.isMulti = isMulti;
|
||||
}
|
||||
|
||||
public boolean getIsNotSelectReceiver() {
|
||||
return isNotSelectReceiver;
|
||||
}
|
||||
|
||||
public void setNotSelectReceiver(boolean isNotSelectReceiver) {
|
||||
this.isNotSelectReceiver = isNotSelectReceiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TreeNode other = (TreeNode) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getLinkUrl() {
|
||||
return linkUrl;
|
||||
}
|
||||
|
||||
public void setLinkUrl(String linkUrl) {
|
||||
this.linkUrl = linkUrl;
|
||||
}
|
||||
|
||||
public boolean isNocheck() {
|
||||
return nocheck;
|
||||
}
|
||||
|
||||
public void setNocheck(boolean nocheck) {
|
||||
this.nocheck = nocheck;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class XLSExportUtil {
|
||||
// 设置cell编码解决中文高位字节截断
|
||||
// 定制日期格式
|
||||
private static String DATE_FORMAT = " m/d/yy "; // "m/d/yy h:mm"
|
||||
// 定制浮点数格式
|
||||
private static String NUMBER_FORMAT = " #,##0.00 ";
|
||||
private String xlsFileName;
|
||||
private String path;
|
||||
private HSSFWorkbook workbook;
|
||||
private HSSFSheet sheet;
|
||||
private HSSFRow row;
|
||||
/**
|
||||
* 初始化Excel
|
||||
*
|
||||
* @param fileName
|
||||
* 导出文件名
|
||||
*/
|
||||
public XLSExportUtil(String fileName,String path) {
|
||||
this.xlsFileName = fileName;
|
||||
this.path=path;
|
||||
this.workbook = new HSSFWorkbook();
|
||||
this.sheet = workbook.createSheet();
|
||||
this.sheet.setDefaultColumnWidth(50);
|
||||
}
|
||||
|
||||
public void createSheet(String sheetName){
|
||||
this.sheet = workbook.createSheet(sheetName);
|
||||
this.sheet.setDefaultColumnWidth(50);
|
||||
}
|
||||
|
||||
public void removeSheetAt(int index){
|
||||
workbook.removeSheetAt(index);
|
||||
}
|
||||
/** */
|
||||
/**
|
||||
* 导出Excel文件
|
||||
*
|
||||
*/
|
||||
public void exportXLS() throws Exception {
|
||||
try {
|
||||
File file=new File(path);
|
||||
if(!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
FileOutputStream fOut = new FileOutputStream(path+File.separator+xlsFileName);
|
||||
workbook.write(fOut);
|
||||
fOut.flush();
|
||||
fOut.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new Exception(" 生成导出Excel文件出错! ", e);
|
||||
} catch (IOException e) {
|
||||
throw new Exception(" 写入Excel文件出错! ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* 增加一行
|
||||
*
|
||||
* @param index
|
||||
* 行号
|
||||
*/
|
||||
public void createRow(int index) {
|
||||
this.row = this.sheet.createRow(index);
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* 设置单元格
|
||||
*
|
||||
* @param index
|
||||
* 列号
|
||||
* @param value
|
||||
* 单元格填充值
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setCell(int index, String value) {
|
||||
HSSFCell cell = this.row.createCell((short) index);
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
cell.setCellValue(value);
|
||||
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* 设置单元格
|
||||
*
|
||||
* @param index
|
||||
* 列号
|
||||
* @param value
|
||||
* 单元格填充值
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setCell(int index, Calendar value) {
|
||||
HSSFCell cell = this.row.createCell((short) index);
|
||||
cell.setCellValue(value.getTime());
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle(); // 建立新的cell样式
|
||||
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat(DATE_FORMAT)); // 设置cell样式为定制的日期格式
|
||||
cell.setCellStyle(cellStyle); // 设置该cell日期的显示格式
|
||||
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* 设置单元格
|
||||
*
|
||||
* @param index
|
||||
* 列号
|
||||
* @param value
|
||||
* 单元格填充值
|
||||
*/
|
||||
public void setCell(int index, int value) {
|
||||
HSSFCell cell = this.row.createCell((short) index);
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
cell.setCellValue(value);
|
||||
}
|
||||
|
||||
/** */
|
||||
/**
|
||||
* 设置单元格
|
||||
*
|
||||
* @param index
|
||||
* 列号
|
||||
* @param value
|
||||
* 单元格填充值
|
||||
*/
|
||||
public void setCell(int index, double value) {
|
||||
HSSFCell cell = this.row.createCell((short) index);
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
cell.setCellValue(value);
|
||||
HSSFCellStyle cellStyle = workbook.createCellStyle(); // 建立新的cell样式
|
||||
HSSFDataFormat format = workbook.createDataFormat();
|
||||
cellStyle.setDataFormat(format.getFormat(NUMBER_FORMAT)); // 设置cell样式为定制的浮点数格式
|
||||
cell.setCellStyle(cellStyle); // 设置该cell浮点数的显示格式
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.blueland.bpm.manage.util;
|
||||
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
public class XssFilter implements Filter {
|
||||
private static final Logger logger = LogManager.getLogger(XssFilter.class);
|
||||
|
||||
/**
|
||||
* 排除部分URL不做过滤
|
||||
*/
|
||||
private List<String> excludeUrls = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* 公告新增、修改用到富文本,对标签进行转义
|
||||
*/
|
||||
private List<String> noticeUrls = new ArrayList<String>();
|
||||
|
||||
public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2)
|
||||
throws IOException, ServletException {
|
||||
HttpServletRequest req = (HttpServletRequest) arg0;
|
||||
HttpServletResponse response = (HttpServletResponse) arg1;
|
||||
String pathInfo = req.getPathInfo() == null ? "" : req.getPathInfo();
|
||||
String url = req.getServletPath() + pathInfo;
|
||||
String uri = req.getRequestURI();
|
||||
boolean isNoticeUrl = false;
|
||||
// 排除部分URL不做过滤。
|
||||
for (String str : excludeUrls) {
|
||||
if (uri.indexOf(str) >= 0) {
|
||||
logger.info("该URL不作校验:" + url);
|
||||
arg2.doFilter(req, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (String st : noticeUrls) {
|
||||
if (uri.indexOf(st) >= 0) {
|
||||
isNoticeUrl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 获取请求所有参数,校验防止SQL注入,防止XSS漏洞
|
||||
|
||||
Enumeration<?> params = req.getParameterNames();
|
||||
String paramN = null;
|
||||
while (params.hasMoreElements()) {
|
||||
paramN = (String) params.nextElement();
|
||||
String paramVale = req.getParameter(paramN);
|
||||
if (!paramN.toLowerCase().contains("password")) {
|
||||
logger.info(paramN + "==" + paramVale);
|
||||
}
|
||||
if (isNoticeUrl) {
|
||||
paramVale = xssEncode(paramVale);
|
||||
}
|
||||
// 校验是否存在SQL注入信息
|
||||
if (checkSQLInject(paramVale, url)) {
|
||||
errorResponse(response, paramN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
arg2.doFilter(req, response);
|
||||
|
||||
}
|
||||
|
||||
private void errorResponse(HttpServletResponse response, String paramNm) throws IOException {
|
||||
String warning = "输入项中不能包含非法字符。";
|
||||
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
|
||||
out.println("{\"httpCode\":\"-9998\",\"msg\":\"" + warning + "\", \"fieldName\": \"" + paramNm + "\"}");
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterconfig1) throws ServletException {
|
||||
// 读取文件
|
||||
String path = XssFilter.class.getResource("/").getFile();
|
||||
excludeUrls.add("/actInfo/activityResourceRule/save");
|
||||
excludeUrls.add("/actInfo/activityResourceRule/update");
|
||||
excludeUrls.add("/actInfo/activityRule/save");
|
||||
excludeUrls.add("/actInfo/activityRule/update");
|
||||
excludeUrls.add("/procDefModelMgr/importProcessAllFile");
|
||||
excludeUrls.add("/procDefMgr/updateBpmnFile");
|
||||
/*noticeUrls.add("ebpm_process_manage/notice!saveNotice");
|
||||
noticeUrls.add("notice!updateNoticeById");*/
|
||||
}
|
||||
|
||||
private String xssEncode(String s) {
|
||||
if (s == null || s.isEmpty()) {
|
||||
return s;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(s.length() + 16);
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
switch (c) {
|
||||
case '>':
|
||||
sb.append(">");
|
||||
break;
|
||||
case '<':
|
||||
sb.append("<");
|
||||
break;
|
||||
// case '\'':
|
||||
// sb.append("‘");
|
||||
// break;
|
||||
case '\"':
|
||||
sb.append("“");
|
||||
break;
|
||||
case '&':
|
||||
sb.append("&");
|
||||
break;
|
||||
case '\\':
|
||||
sb.append("\");
|
||||
break;
|
||||
case '#':
|
||||
sb.append("#");
|
||||
break;
|
||||
case '(':
|
||||
sb.append("(");
|
||||
break;
|
||||
case ')':
|
||||
sb.append(")");
|
||||
break;
|
||||
default:
|
||||
sb.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 检查是否存在非法字符,防止SQL注入
|
||||
*
|
||||
* @param str
|
||||
* 被检查的字符串
|
||||
* @return ture-字符串中存在非法字符,false-不存在非法字符
|
||||
*/
|
||||
public static boolean checkSQLInject(String str, String url) {
|
||||
if (StringUtils.isEmpty(str)) {
|
||||
return false;// 如果传入空串则认为不存在非法字符
|
||||
}
|
||||
|
||||
// 判断黑名单
|
||||
String[] inj_stra = { "script", "mid", "master", "truncate", "insert", "select", "delete", "update", "declare",
|
||||
"iframe", "onreadystatechange", "atestu", "\"", "<", ">",
|
||||
"\\", "svg", "confirm", "prompt", "onload", "onmouseover", "onfocus", "onerror", "onclick" , "alert" };
|
||||
|
||||
str = str.toLowerCase(); // sql不区分大小写
|
||||
|
||||
for (int i = 0; i < inj_stra.length; i++) {
|
||||
if (str.indexOf(inj_stra[i]) >= 0) {
|
||||
logger.info("xss防攻击拦截url:" + url + ",原因:特殊字符,传入str=" + str + ",包含特殊字符:" + inj_stra[i]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.Application2UserManager;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
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.bpm.engine.util.cache.ShareCache;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "applicationMgr")
|
||||
public class ApplicationController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
@Autowired
|
||||
private Application2UserManager application2UserManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/applicationMgr/list.do";
|
||||
|
||||
public ApplicationController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,ApplicationEntity query) {
|
||||
boolean isebpmAdmin =(Boolean) request.getSession().getAttribute(BaseUser.ROLE_EBPMADMIN);
|
||||
if(!isebpmAdmin){
|
||||
String currentAppId = request.getSession().getAttribute(MyContants.APP_ID_KEY).toString();
|
||||
query.setAppId(currentAppId);
|
||||
}
|
||||
|
||||
query.setAppTypes("('inner','outside')");
|
||||
Page page = this.applicationManager.findPageByMgr(query);
|
||||
ModelAndView result = new ModelAndView("/applicationMgr/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("appId"));
|
||||
ApplicationEntity application = (ApplicationEntity)applicationManager.getById(id);
|
||||
return new ModelAndView("/applicationMgr/show","application",application);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,ApplicationEntity application) {
|
||||
return new ModelAndView("/applicationMgr/create","application",application);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(HttpServletRequest request,ApplicationEntity application,String appManagerIds) {
|
||||
HttpSession session=request.getSession(false);
|
||||
String[] users = appManagerIds.split(",");
|
||||
User userData=(User)session.getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
application.setAppCreatorId(userData.getUserId());
|
||||
applicationManager.save(application);
|
||||
application2UserManager.addApplicationUser(application.getAppId(), users);
|
||||
//redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
ShareCache.setIpList(applicationManager.getAllowIpList());
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("appId"));
|
||||
ApplicationEntity application = (ApplicationEntity)applicationManager.getById(id);
|
||||
return new ModelAndView("/applicationMgr/edit","application",application);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request,ApplicationEntity application,String appManagerIds) {
|
||||
String id = new String(request.getParameter("appId"));
|
||||
applicationManager.update(application);
|
||||
String[] users = appManagerIds.split(",");
|
||||
application2UserManager.deleteApplicationUser(id);
|
||||
application2UserManager.addApplicationUser(id, users);
|
||||
//redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
ShareCache.setIpList(applicationManager.getAllowIpList());
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
String id = new String((String) params.get("appId"));
|
||||
SearchProcessListDTO searchProcessListDTO = new SearchProcessListDTO();
|
||||
searchProcessListDTO.setTenantId(id);
|
||||
// 查询符合条件的流程定义列表
|
||||
List<ProcessDefinitionModel> processDefinitions = processDefinitionService
|
||||
.findProcessDefsNotCascide(searchProcessListDTO);
|
||||
System.out.println("查询到出的流程定义列表:" + processDefinitions.size());
|
||||
if (processDefinitions.size() == 0) {
|
||||
application2UserManager.deleteApplicationUser(id);
|
||||
applicationManager.removeById(id);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE,
|
||||
DELETE_SUCCESS);
|
||||
} else {
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE,
|
||||
"该应用系统内包含流程定义,无法进行删除操作!");
|
||||
}
|
||||
}
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供给快速开发平台同步应用
|
||||
* @param request
|
||||
* @param application
|
||||
* @param appManagerIds
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "syncApp")
|
||||
@ResponseBody
|
||||
public String syncApp(HttpServletRequest request,@RequestBody Map<String,Object> params) {
|
||||
if(params.containsKey("appId") && params.containsKey("appName") && params.containsKey("appManagerIds")
|
||||
&& params.containsKey("flag") && params.containsKey("userId")){
|
||||
String[] users = params.get("appManagerIds").toString().split(",");
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setAppCreatorId( params.get("userId").toString());
|
||||
application.setAppId(params.get("appId").toString());
|
||||
application.setAppName(params.get("appName").toString());
|
||||
String appId =application.getAppId();
|
||||
ApplicationEntity app = applicationManager.getById(appId);
|
||||
if(params.get("flag").equals("Y")){//如果是需要建应用,先查找这个应用是否存在,存在就更新应用,删除人员,新增人员,否则新增应用、新增人员
|
||||
application.setAppStatus("N");
|
||||
application.setAppType("inner");
|
||||
application.setAppProvider("湖南天惟");
|
||||
if(app==null){
|
||||
applicationManager.save(application);
|
||||
application2UserManager.addApplicationUser(appId, users);
|
||||
}else{
|
||||
applicationManager.update(application);
|
||||
application2UserManager.deleteApplicationUser(appId);
|
||||
application2UserManager.addApplicationUser(appId, users);
|
||||
}
|
||||
}else{
|
||||
if(app!=null){//如果有该应用制为停用
|
||||
application.setAppStatus("T");
|
||||
application.setAppProvider("湖南天惟");
|
||||
applicationManager.update(application);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
System.out.println("调用syncApp接口失败,appId、appName、appManagerIds、flag为必填参数,入参为:"+params);
|
||||
return ACTION_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//ShareCache.setIpList(applicationManager.getAllowIpList());
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
|
||||
public class BaseProcessController extends BaseSpringController {
|
||||
@Autowired
|
||||
ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
ProcessInfoConfigManager processInfoConfigManager;
|
||||
public boolean updateBpmnModel(BpmnModel bpmnModel,String procDefId,boolean isUpdateProceImage){
|
||||
ProcessDefinitionModel processDefinition=processDefinitionService.getProcessDef(procDefId);
|
||||
processInfoConfigManager.setProcessInfoUpdateState(procDefId);
|
||||
return processDefinitionService.updateDeploymentResourceAndCache(bpmnModel,processDefinition,isUpdateProceImage);
|
||||
}
|
||||
|
||||
public boolean updateBpmnModel(BpmnModel bpmnModel,ProcessDefinitionModel processDefinition,boolean isUpdateProceImage){
|
||||
processInfoConfigManager.setProcessInfoUpdateState(processDefinition.getProcDefId());
|
||||
return processDefinitionService.updateDeploymentResourceAndCache(bpmnModel,processDefinition,isUpdateProceImage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.engine.config.model.Depute;
|
||||
import com.blueland.bpm.engine.config.service.DeputeManager;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "depute")
|
||||
public class DeputeController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private DeputeManager deputeManager;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private final String LIST_ACTION = "redirect:/depute/list.do";
|
||||
|
||||
public DeputeController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,Depute query) {
|
||||
query.setSortColumns("START_TIME DESC");
|
||||
Page page = this.deputeManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/depute/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("deputeId"));
|
||||
Depute depute = (Depute)deputeManager.getById(id);
|
||||
return new ModelAndView("/depute/show","depute",depute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,HttpServletResponse response,Depute depute,String userId) {
|
||||
User user=BaseUser.getInstance().backSSO(request,response, userId);
|
||||
depute.setDeputeUserId(user.getUserCode());
|
||||
ModelAndView result = new ModelAndView("/depute/create");
|
||||
Page page = this.deputeManager.findPage(depute);
|
||||
//展示委托记录
|
||||
// String deputeStr = "";
|
||||
//委托信息,一个委托人只会有一个委托人
|
||||
Depute existDepute = null ;
|
||||
for(int i = 0; i<page.getResult().size(); i++){
|
||||
existDepute = (Depute)page.getResult().get(i);
|
||||
// if(existDepute.getDeputeType().equals("golal")){
|
||||
// deputeStr = deputeStr+"所有流程";
|
||||
// }
|
||||
// else{
|
||||
// if(page.getResult().size()>1 && i < page.getResult().size()-1){
|
||||
// deputeStr = deputeStr + existDepute.getProcessDefName() +"、";
|
||||
// }else{
|
||||
// deputeStr = deputeStr + existDepute.getProcessDefName() ;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
result.addObject("user",user);
|
||||
result.addObject("existDepute",existDepute);
|
||||
// result.addObject("deputeStr",deputeStr);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "backCreate")
|
||||
public ModelAndView backCreate(HttpServletRequest request,Depute depute,String userId) {
|
||||
User user = userService.getUserById(userId);
|
||||
depute.setDeputeUserId(userId);
|
||||
ModelAndView result = new ModelAndView("/depute/createBack");
|
||||
Page page = this.deputeManager.findPage(depute);
|
||||
//展示委托记录
|
||||
// String deputeStr = "";
|
||||
//委托信息,一个委托人只会有一个委托人
|
||||
Depute existDepute = null ;
|
||||
for(int i = 0; i<page.getResult().size(); i++){
|
||||
existDepute = (Depute)page.getResult().get(i);
|
||||
// if(existDepute.getDeputeType().equals("golal")){
|
||||
// deputeStr = deputeStr+"所有流程";
|
||||
// }
|
||||
// else{
|
||||
// if(page.getResult().size()>1 && i < page.getResult().size()-1){
|
||||
// deputeStr = deputeStr + existDepute.getProcessDefName() +"、";
|
||||
// }else{
|
||||
// deputeStr = deputeStr + existDepute.getProcessDefName() ;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
result.addObject("user",user);
|
||||
result.addObject("existDepute",existDepute);
|
||||
// result.addObject("deputeStr",deputeStr);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public Map save(HttpServletRequest request,Depute depute,String processAllCheck,RedirectAttributes redirectAttributes) {
|
||||
Map result = new HashMap();
|
||||
result.put("success",true);
|
||||
if(StringUtils.isNotEmpty(processAllCheck)){
|
||||
depute.setDeputeType(processAllCheck);
|
||||
}
|
||||
try {
|
||||
deputeManager.delAndsave(depute);
|
||||
} catch (Exception e) {
|
||||
result.put("success",false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request) {
|
||||
String id = new String(request.getParameter("deputeId"));
|
||||
Depute depute = (Depute)deputeManager.getById(id);
|
||||
User loginUser = (User)request.getSession().getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
String userId = loginUser.getOrgId();
|
||||
ModelAndView result = new ModelAndView("/depute/edit");
|
||||
result.addObject("userId",userId);
|
||||
result.addObject("depute",depute);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public Map update(HttpServletRequest request,Depute depute,RedirectAttributes redirectAttributes) {
|
||||
Map result = new HashMap();
|
||||
result.put("success",true);
|
||||
try {
|
||||
String id = new String(request.getParameter("deputeId"));
|
||||
deputeManager.update(depute);
|
||||
} catch (Exception e) {
|
||||
result.put("success",false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("deputeId"));
|
||||
|
||||
deputeManager.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
/**
|
||||
*重置委托
|
||||
**/
|
||||
@RequestMapping(value = "reSetDepute")
|
||||
@ResponseBody
|
||||
public Map reSetDepute(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
Map result = new HashMap();
|
||||
result.put("success",true);
|
||||
try {
|
||||
User loginUser = (User)request.getSession().getAttribute(MyContants.LOGIN_SESSION_USER);
|
||||
Depute depute = new Depute();
|
||||
depute.setDeputeUserId(loginUser.getUserId());
|
||||
//重置该委托人的全部委托信息
|
||||
List<Depute> existDeputeList = deputeManager.findByExample(depute);
|
||||
for(Depute existDepute: existDeputeList){
|
||||
if(null != existDepute){
|
||||
deputeManager.removeById(existDepute.getDeputeId());
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
result.put("success",false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*重置委托
|
||||
**/
|
||||
@RequestMapping(value = "reSetDeputeBack")
|
||||
@ResponseBody
|
||||
public Map reSetDeputeBack(HttpServletRequest request,String deputeUserId) {
|
||||
Map result = new HashMap();
|
||||
result.put("success",true);
|
||||
try {
|
||||
Depute depute = new Depute();
|
||||
depute.setDeputeUserId(deputeUserId);
|
||||
//重置该委托人的全部委托信息
|
||||
List<Depute> existDeputeList = deputeManager.findByExample(depute);
|
||||
for(Depute existDepute: existDeputeList){
|
||||
if(null != existDepute){
|
||||
deputeManager.removeById(existDepute.getDeputeId());
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
result.put("success",false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.Gateway;
|
||||
import org.activiti.bpmn.model.ScriptTask;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectManager;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectRelationManager;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import com.blueland.bpm.manage.util.ComparatorTransition;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/gateway")
|
||||
public class GatewayController extends BaseProcessController{
|
||||
// 默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
@Autowired
|
||||
private DataObjectManager dataObjectManager;
|
||||
@Autowired
|
||||
private DataObjectRelationManager dataObjectRelationManager;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
private final String LIST_ACTION = "redirect:/otherTask/list.do";
|
||||
|
||||
public GatewayController() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editGatewayByCd")
|
||||
public ModelAndView editGatewayByCd(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView=new ModelAndView("/actInfo/gateway/editGatewayByCd");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
Gateway gateway=(Gateway) bpmnModel.getFlowElement(params.getActivityDefId());;
|
||||
List<SequenceFlow> sequenceFlows=gateway.getOutgoingFlows();
|
||||
Collections.sort(sequenceFlows,new ComparatorTransition());
|
||||
for (SequenceFlow sequenceFlow : sequenceFlows) {
|
||||
sequenceFlow.setSourceRefName(bpmnModel.getFlowElement(sequenceFlow.getSourceRef()).getName());
|
||||
sequenceFlow.setTargetRefName(bpmnModel.getFlowElement(sequenceFlow.getTargetRef()).getName());
|
||||
}
|
||||
modelAndView.addObject("gateway", gateway);
|
||||
modelAndView.addObject("params", params);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editGatewayByIc")
|
||||
public ModelAndView editGatewayByIc(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView=new ModelAndView("/actInfo/gateway/editGatewayByCd");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
Gateway gateway=(Gateway) bpmnModel.getFlowElement(params.getActivityDefId());;
|
||||
List<SequenceFlow> sequenceFlows=gateway.getOutgoingFlows();
|
||||
Collections.sort(sequenceFlows,new ComparatorTransition());
|
||||
for (SequenceFlow sequenceFlow : sequenceFlows) {
|
||||
sequenceFlow.setSourceRefName(bpmnModel.getFlowElement(sequenceFlow.getSourceRef()).getName());
|
||||
sequenceFlow.setTargetRefName(bpmnModel.getFlowElement(sequenceFlow.getTargetRef()).getName());
|
||||
}
|
||||
modelAndView.addObject("gateway", gateway);
|
||||
modelAndView.addObject("params", params);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "updateGateway")
|
||||
@ResponseBody
|
||||
public String updateGateway(HttpServletRequest request,
|
||||
ScriptTask scriptTask,ActivityInfoConfig params) {
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
ScriptTask tempScriptTask = (ScriptTask) bpmnModel.getFlowElement(params.getActivityDefId());
|
||||
tempScriptTask.setScript(scriptTask.getScript());
|
||||
tempScriptTask.setScriptFormat(scriptTask.getScriptFormat());
|
||||
tempScriptTask.setDocumentation(scriptTask.getDocumentation());
|
||||
updateBpmnModel(bpmnModel, params.getProcessDefId(), true);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.manage.countAnalysis.service.IndexService;
|
||||
/**
|
||||
* @作者 dsl
|
||||
* @创建时间 2020年2月5日
|
||||
* @说明 流程首页
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/sys/index")
|
||||
public class IndexController extends BaseSpringController{
|
||||
@Autowired
|
||||
private IndexService indexService;
|
||||
/**
|
||||
* 流程统计
|
||||
**/
|
||||
@RequestMapping(value = "/porcessStatistics")
|
||||
public ModelAndView porcessStatistics(HttpServletRequest request) throws Exception{
|
||||
//所有接入应用
|
||||
int allApp = indexService.getAppCount();
|
||||
//流程定义总数
|
||||
int procDefKeyCount = indexService.getProcDefKeyCount();
|
||||
//流程执行情况
|
||||
Map<String,Object> processLogCount= indexService.getProcessLogCount();
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/index");
|
||||
|
||||
modelAndView.addObject("allApp", allApp);
|
||||
modelAndView.addObject("procDefKeyCount", procDefKeyCount);
|
||||
modelAndView.addObject("error", processLogCount.get("ERROR"));
|
||||
modelAndView.addObject("info", processLogCount.get("INFO"));
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程运行情况
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/statisticsProcessByTime")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> statisticsProcessByTime(HttpServletRequest request) throws Exception{
|
||||
return indexService.getAllFlowDatas();
|
||||
}
|
||||
/**
|
||||
* 流程监控top
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/getProcessMonitorTop")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getProcessMonitorTop(HttpServletRequest request) throws Exception{
|
||||
return indexService.getProcessMonitorTop();
|
||||
}
|
||||
/**
|
||||
* 系统负载数据
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/getSysLoadData")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getSysLoadData(HttpServletRequest request) throws Exception{
|
||||
return indexService.getSysLoadData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
|
||||
public class LoginInterceptor implements HandlerInterceptor{
|
||||
private static final Logger log = LoggerFactory.getLogger(LoginInterceptor.class);
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object arg2) {
|
||||
log.debug("preHandle");
|
||||
String url=request.getRequestURL().toString();
|
||||
log.debug("url"+url);
|
||||
if(!"".equals(url) && !url.contains("login")){
|
||||
try {
|
||||
User user = BaseUser.getInstance().getSessionUser(request);
|
||||
if(null == user){
|
||||
request.getRequestDispatcher("/pages/login.jsp").forward(request, response);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
request.getRequestDispatcher("/pages/login.jsp").forward(request, response);
|
||||
return false;
|
||||
} catch (ServletException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request,
|
||||
HttpServletResponse response, Object arg2, Exception arg3)
|
||||
throws Exception {
|
||||
|
||||
log.debug("afterCompletion");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object arg2, ModelAndView arg3) throws Exception {
|
||||
log.debug("postHandle");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,356 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.model.DataObjectRelation;
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectManager;
|
||||
import com.blueland.bpm.engine.config.service.DataObjectRelationManager;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.util.ProcessModelUtils;
|
||||
import com.blueland.bpm.engine.util.WorkFlowContants;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import org.activiti.bpmn.constants.BpmnXMLConstants;
|
||||
import org.activiti.bpmn.model.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/otherTask")
|
||||
public class OtherTaskController extends BaseProcessController{
|
||||
// 默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private DataObjectManager dataObjectManager;
|
||||
@Autowired
|
||||
private DataObjectRelationManager dataObjectRelationManager;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
private final String LIST_ACTION = "redirect:/otherTask/list.do";
|
||||
|
||||
public OtherTaskController() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editScriptTaskView")
|
||||
public ModelAndView editScriptTaskView(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView=new ModelAndView("/actInfo/otherTask/editScriptTask");
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
ScriptTask scriptTask = (ScriptTask) bpmnModel.getFlowElement(params.getActivityDefId());
|
||||
modelAndView.addObject("scriptTask",scriptTask);
|
||||
modelAndView.addObject("activityInfoConfig",params);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editScriptTask")
|
||||
@ResponseBody
|
||||
public String editScriptTask(HttpServletRequest request,
|
||||
ScriptTask scriptTask,ActivityInfoConfig params) {
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
ScriptTask tempScriptTask = (ScriptTask) bpmnModel.getFlowElement(params.getActivityDefId());
|
||||
tempScriptTask.setScript(scriptTask.getScript());
|
||||
tempScriptTask.setScriptFormat(scriptTask.getScriptFormat());
|
||||
tempScriptTask.setDocumentation(scriptTask.getDocumentation());
|
||||
updateBpmnModel(bpmnModel, params.getProcessDefId(), true);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editServiceTaskView")
|
||||
public ModelAndView editServiceTaskView(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView=new ModelAndView("/actInfo/otherTask/editServiceTask");
|
||||
ActivityInfoConfig activityInfoConfig=activityInfoConfigManager.getActivityInfoConfig(params.getProcessDefId(), params.getActivityDefId());
|
||||
if(activityInfoConfig==null){
|
||||
return modelAndView;
|
||||
}
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
ServiceTask serviceTask = (ServiceTask) bpmnModel.getFlowElement(activityInfoConfig.getActivityDefId());
|
||||
FieldExtension fieldExtension=ProcessModelUtils.findFieldExtension(serviceTask.getFieldExtensions(),"procDefIdText");
|
||||
String procDefIdText="";
|
||||
if(fieldExtension!=null){
|
||||
procDefIdText=fieldExtension.getStringValue();
|
||||
if(StringUtils.isNotEmpty(procDefIdText)){
|
||||
ProcessDefinitionModel throughProcDefModel=processDefinitionService.getProcessDef(procDefIdText);
|
||||
modelAndView.addObject("throughProcDefModel",throughProcDefModel);
|
||||
}
|
||||
}
|
||||
List<DataObjectRelation> dataObjectRelations=dataObjectRelationManager.findDataObjectRelationsByThroughProc(activityInfoConfig.getProcessDefId(), activityInfoConfig.getActivityDefId());
|
||||
modelAndView.addObject("procDefIdText",procDefIdText);
|
||||
modelAndView.addObject("serviceTask",serviceTask);
|
||||
modelAndView.addObject("activityInfoConfig",activityInfoConfig);
|
||||
modelAndView.addObject("dataObjectRelations",dataObjectRelations);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editServiceTask")
|
||||
@ResponseBody
|
||||
public String editServiceTask(HttpServletRequest request,
|
||||
ServiceTask serviceTask,String procDefIdText,ActivityInfoConfig params) {
|
||||
if(StringUtils.isEmpty(procDefIdText)){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
ActivityInfoConfig activityInfoConfig=activityInfoConfigManager.getActivityInfoConfig(params.getProcessDefId(), params.getActivityDefId());
|
||||
activityInfoConfig.setActivityDefType(BpmnXMLConstants.ELEMENT_TASK_SERVICE);
|
||||
activityInfoConfig.setActivityDefChildType(params.getActivityDefChildType());
|
||||
activityInfoConfig.setActivityDefDealType(params.getActivityDefDealType());
|
||||
activityInfoConfigManager.update(activityInfoConfig);
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
ServiceTask tempServiceTask = (ServiceTask) bpmnModel.getFlowElement(params.getActivityDefId());
|
||||
tempServiceTask.setImplementationType("class");
|
||||
tempServiceTask.setType("");
|
||||
tempServiceTask.setImplementation("com.blueland.bpm.engine.core.listener.ThroughBizAppProcess");
|
||||
tempServiceTask.getFieldExtensions().clear();
|
||||
|
||||
FieldExtension fieldExtension=new FieldExtension();
|
||||
fieldExtension.setFieldName("procDefIdText");
|
||||
fieldExtension.setStringValue(procDefIdText);
|
||||
tempServiceTask.getFieldExtensions().add(fieldExtension);
|
||||
tempServiceTask.setDocumentation(serviceTask.getDocumentation());
|
||||
//暂时必须是异常调用
|
||||
tempServiceTask.setAsynchronous(true);
|
||||
updateBpmnModel(bpmnModel, params.getProcessDefId(), false);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editCallActivityView")
|
||||
public ModelAndView editCallActivityView(HttpServletRequest request,
|
||||
ActivityInfoConfig params) {
|
||||
ModelAndView modelAndView=new ModelAndView("/actInfo/otherTask/editCallActivity");
|
||||
ActivityInfoConfig activityInfoConfig=activityInfoConfigManager.getActivityInfoConfig(params.getProcessDefId(), params.getActivityDefId());
|
||||
if(activityInfoConfig==null){
|
||||
return modelAndView;
|
||||
}
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
CallActivity callActivity = (CallActivity) bpmnModel.getFlowElement(activityInfoConfig.getActivityDefId());
|
||||
String procDefKey=callActivity.getCalledElement();
|
||||
try{
|
||||
if(StringUtils.isNotEmpty(procDefKey)){
|
||||
ProcessDefinitionModel callProcDefModel=processDefinitionService.getProcessDefBykey(procDefKey);
|
||||
modelAndView.addObject("callProcDefModel",callProcDefModel);
|
||||
}}catch(Exception e){
|
||||
|
||||
}
|
||||
modelAndView.addObject("callActivity",callActivity);
|
||||
modelAndView.addObject("activityInfoConfig",activityInfoConfig);
|
||||
modelAndView.addObject("dataInputAssociations",callActivity.getDataInputAssociations());
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "editCallActivity")
|
||||
@ResponseBody
|
||||
public String editCallActivity(HttpServletRequest request,
|
||||
CallActivity callActivity,ActivityInfoConfig params) {
|
||||
String procDefId=callActivity.getCalledElement();
|
||||
if(StringUtils.isEmpty(procDefId)){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
ActivityInfoConfig activityInfoConfig=activityInfoConfigManager.getActivityInfoConfig(params.getProcessDefId(), params.getActivityDefId());
|
||||
activityInfoConfig.setActivityDefType(BpmnXMLConstants.ELEMENT_CALL_ACTIVITY);
|
||||
activityInfoConfig.setActivityDefChildType(params.getActivityDefChildType());
|
||||
activityInfoConfig.setActivityDefDealType(params.getActivityDefDealType());
|
||||
activityInfoConfigManager.update(activityInfoConfig);
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(params.getProcessDefId());
|
||||
CallActivity tempCallActivity = (CallActivity) bpmnModel.getFlowElement(params.getActivityDefId());
|
||||
if(procDefId.indexOf(":")!=-1){
|
||||
tempCallActivity.setCalledElement(procDefId.split(":")[0]);
|
||||
}
|
||||
|
||||
tempCallActivity.setDocumentation(callActivity.getDocumentation());
|
||||
tempCallActivity.getInParameters().clear();
|
||||
tempCallActivity.getOutParameters().clear();
|
||||
ExtensionElement extensionAttribute=null;
|
||||
//把原来的属性,使用带activiti:前缀的属性,这样导入不会出现异常
|
||||
if(tempCallActivity.getExtensionElements().get(WorkFlowContants.ACTIVITY_DEF_CHILD_TYPE)!=null){
|
||||
tempCallActivity.getExtensionElements().remove(WorkFlowContants.ACTIVITY_DEF_CHILD_TYPE);
|
||||
}
|
||||
if(tempCallActivity.getExtensionElements().get(WorkFlowContants.PREX_ACTIVITY_DEF_CHILD_TYPE)!=null){
|
||||
extensionAttribute=(ExtensionElement) (tempCallActivity.getExtensionElements().get(WorkFlowContants.PREX_ACTIVITY_DEF_CHILD_TYPE).get(0));
|
||||
extensionAttribute.setElementText(params.getActivityDefChildType());
|
||||
}else{
|
||||
extensionAttribute=new ExtensionElement();
|
||||
extensionAttribute.setName(WorkFlowContants.PREX_ACTIVITY_DEF_CHILD_TYPE);
|
||||
extensionAttribute.setElementText(params.getActivityDefChildType());
|
||||
tempCallActivity.addExtensionElement(extensionAttribute);
|
||||
}
|
||||
if(params.getActivityDefChildType().equals(ActivityInfoConfig.ACTIVITY_DEF_CHILD_TYPE_THROUGH)){
|
||||
IOParameter dataAssociation1=new IOParameter();
|
||||
dataAssociation1.setSource(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
dataAssociation1.setTarget(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
IOParameter dataAssociation2=new IOParameter();
|
||||
dataAssociation2.setSource(WorkFlowContants.WF_FIELDS_KEY);
|
||||
dataAssociation2.setTarget(WorkFlowContants.WF_FIELDS_KEY);
|
||||
IOParameter dataAssociation3=new IOParameter();
|
||||
//流程贯穿数据变量
|
||||
dataAssociation3.setSource(WorkFlowContants.WF_THROUGH_BUSINESS_DATA_OBJECT_KEY);
|
||||
dataAssociation3.setTarget(WorkFlowContants.WF_THROUGH_BUSINESS_DATA_OBJECT_KEY);
|
||||
IOParameter dataAssociation4=new IOParameter();
|
||||
dataAssociation4.setSource(WorkFlowContants.WF_PRE_TASK_DEF_NAME_VAR_KEY);
|
||||
dataAssociation4.setTarget(WorkFlowContants.WF_PRE_TASK_DEF_NAME_VAR_KEY);
|
||||
IOParameter dataAssociation5=new IOParameter();
|
||||
dataAssociation5.setSource(WorkFlowContants.WF_PRE_TASK_ID_VAR_KEY);
|
||||
dataAssociation5.setTarget(WorkFlowContants.WF_PRE_TASK_ID_VAR_KEY);
|
||||
IOParameter dataAssociation6=new IOParameter();
|
||||
dataAssociation6.setSource(WorkFlowContants.WF_PRE_TASK_DEF_ID_VAR_KEY);
|
||||
dataAssociation6.setTarget(WorkFlowContants.WF_PRE_TASK_DEF_ID_VAR_KEY);
|
||||
tempCallActivity.getInParameters().add(dataAssociation1);
|
||||
tempCallActivity.getInParameters().add(dataAssociation2);
|
||||
tempCallActivity.getInParameters().add(dataAssociation3);
|
||||
tempCallActivity.getInParameters().add(dataAssociation4);
|
||||
tempCallActivity.getInParameters().add(dataAssociation5);
|
||||
tempCallActivity.getInParameters().add(dataAssociation6);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation1);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation2);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation3);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation4);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation5);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation6);
|
||||
}else{//内部子流程数据变量
|
||||
IOParameter dataAssociation1=new IOParameter();
|
||||
dataAssociation1.setSource(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
dataAssociation1.setTarget(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
IOParameter dataAssociation2=new IOParameter();
|
||||
dataAssociation2.setSource(WorkFlowContants.WF_FIELDS_KEY);
|
||||
dataAssociation2.setTarget(WorkFlowContants.WF_FIELDS_KEY);
|
||||
IOParameter dataAssociation3=new IOParameter();
|
||||
dataAssociation3.setSource(WorkFlowContants.WF_BUSINESS_DATA_OBJECT_KEY);
|
||||
dataAssociation3.setTarget(WorkFlowContants.WF_BUSINESS_DATA_OBJECT_KEY);
|
||||
IOParameter dataAssociation4=new IOParameter();
|
||||
dataAssociation4.setSource(WorkFlowContants.WF_PRE_TASK_DEF_NAME_VAR_KEY);
|
||||
dataAssociation4.setTarget(WorkFlowContants.WF_PRE_TASK_DEF_NAME_VAR_KEY);
|
||||
IOParameter dataAssociation5=new IOParameter();
|
||||
dataAssociation5.setSource(WorkFlowContants.WF_PRE_TASK_ID_VAR_KEY);
|
||||
dataAssociation5.setTarget(WorkFlowContants.WF_PRE_TASK_ID_VAR_KEY);
|
||||
IOParameter dataAssociation6=new IOParameter();
|
||||
dataAssociation6.setSource(WorkFlowContants.WF_PRE_TASK_DEF_ID_VAR_KEY);
|
||||
dataAssociation6.setTarget(WorkFlowContants.WF_PRE_TASK_DEF_ID_VAR_KEY);
|
||||
tempCallActivity.getInParameters().add(dataAssociation1);
|
||||
tempCallActivity.getInParameters().add(dataAssociation2);
|
||||
tempCallActivity.getInParameters().add(dataAssociation3);
|
||||
tempCallActivity.getInParameters().add(dataAssociation4);
|
||||
tempCallActivity.getInParameters().add(dataAssociation5);
|
||||
tempCallActivity.getInParameters().add(dataAssociation6);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation1);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation2);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation3);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation4);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation5);
|
||||
tempCallActivity.getOutParameters().add(dataAssociation6);
|
||||
}
|
||||
//暂时必须是异常调用
|
||||
tempCallActivity.setAsynchronous(false);
|
||||
|
||||
if (params.isMulti()) {
|
||||
if (tempCallActivity != null
|
||||
&& tempCallActivity.getLoopCharacteristics() == null) {
|
||||
MultiInstanceLoopCharacteristics multiInstance = new MultiInstanceLoopCharacteristics();
|
||||
multiInstance.setElementVariable(WorkFlowContants.ELEMENT_ASSIGNEE);
|
||||
multiInstance.setInputDataItem(WorkFlowContants.ELEMENT_ASSIGNEE_EL);
|
||||
multiInstance.setSequential(false);
|
||||
tempCallActivity.setLoopCharacteristics(multiInstance);
|
||||
}
|
||||
} else if (tempCallActivity != null
|
||||
&& tempCallActivity.getLoopCharacteristics() != null) {
|
||||
tempCallActivity.setLoopCharacteristics(null);
|
||||
}
|
||||
updateBpmnModel(bpmnModel, params.getProcessDefId(), false);
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "createCallActProperty")
|
||||
public ModelAndView createCallActProperty(DataObjectRelation dataObjectRelation) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/otherTask/property/create");
|
||||
modelAndView.addObject("dataObjectRelation", dataObjectRelation);
|
||||
return modelAndView;
|
||||
}
|
||||
@RequestMapping(value = "saveCallActProperty")
|
||||
@ResponseBody
|
||||
public String saveCallActProperty(HttpServletRequest request,DataObjectRelation dataObjectRelation) {
|
||||
boolean result=false;
|
||||
dataObjectRelation.getDataObject().setObjName(dataObjectRelation.getDataObject().getObjKey());
|
||||
dataObjectRelation.getDataObject().setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
dataObjectRelationManager.save(dataObjectRelation);
|
||||
result=true;
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "editCallActProperty")
|
||||
public ModelAndView editCallActProperty(String dorId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/otherTask/property/edit");
|
||||
DataObjectRelation dataObjectRelation = (DataObjectRelation)dataObjectRelationManager.getById(dorId);
|
||||
modelAndView.addObject("dataObjectRelation", dataObjectRelation);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateCallActProperty")
|
||||
@ResponseBody
|
||||
public String updateCallActProperty(DataObjectRelation dataObjectRelation) {
|
||||
boolean result=false;
|
||||
dataObjectRelation.getDataObject().setObjName(dataObjectRelation.getDataObject().getObjKey());
|
||||
dataObjectRelationManager.update(dataObjectRelation);
|
||||
result=true;
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteCallActProperty")
|
||||
@ResponseBody
|
||||
public String deleteCallActProperty(String processDefId,String id,String[] dorIds) {
|
||||
boolean result=false;
|
||||
for (String dorId : dorIds) {
|
||||
DataObjectRelation dataObjectRelation=dataObjectRelationManager.getById(dorId);
|
||||
if(dataObjectRelation!=null){
|
||||
dataObjectRelationManager.removeById(dorId);
|
||||
dataObjectManager.removeById(dataObjectRelation.getObjId());
|
||||
}
|
||||
}
|
||||
result=true;
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,489 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.SuspensionState;
|
||||
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.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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.core.model.ActivityInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInputModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessMgrDataShare;
|
||||
import com.blueland.bpm.engine.core.model.SearchProcessListDTO;
|
||||
import com.blueland.bpm.engine.core.service.AutoRunOneProcess;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
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.bpm.engine.util.WorkFlowException;
|
||||
import com.blueland.bpm.manage.service.ProcessRestoreService;
|
||||
import com.blueland.bpm.manage.service.ProcessUpdateTimeService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/procInstMgr")
|
||||
public class ProcessInstanceController extends BaseProcessController{
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Autowired
|
||||
ProcessExecuteService processExecuteService;
|
||||
@Autowired
|
||||
AutoRunOneProcess autoRunOneProcess;
|
||||
@Autowired
|
||||
ProcessUpdateTimeService processUpdateTimeService;
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private ProcessRestoreService processRestoreService;
|
||||
@RequestMapping(value = "/historyList")
|
||||
public ModelAndView historyList(String tenantId,SearchProcessListDTO pageRequest,
|
||||
HttpServletRequest request) {
|
||||
HistoricProcessInstanceQuery query = processInstanceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.finished();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,
|
||||
pageRequest, "");
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefKey())) {
|
||||
query.processDefinitionKey(pageRequest.getProcessDefKey());
|
||||
|
||||
}if (StringUtils.isNotEmpty(pageRequest.getProcessDefName())) {
|
||||
query.processDefinitionName("%"+pageRequest.getProcessDefName()+"%");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getTitle())) {
|
||||
query.procTitle("%"+pageRequest.getTitle()+"%");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessInstanceId())) {
|
||||
query.processInstanceId(pageRequest.getProcessInstanceId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getUserId())) {
|
||||
query.startedBy(pageRequest.getUserId());
|
||||
}
|
||||
if(null!=pageRequest.getProcState()){
|
||||
query.procState(pageRequest.getProcState());
|
||||
}
|
||||
String appId = "";
|
||||
if(StringUtils.isNotEmpty(tenantId)){
|
||||
appId= tenantId;
|
||||
}else{
|
||||
appId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
}
|
||||
if ("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT) && (!StringUtils.isEmpty(appId))) {
|
||||
query.processInstanceTenantId(appId);
|
||||
}
|
||||
Page page = new Page(pageRequest, Integer.MAX_VALUE);
|
||||
|
||||
List<HistoricProcessInstance> historicProcessInstances = query
|
||||
.orderByProcessInstanceStartTime().desc()
|
||||
.listPage(page.getFirstResult(), page.getPageSize());
|
||||
ModelAndView modelAndView = new ModelAndView("/procInstMgr/historyList");
|
||||
|
||||
page.setResult(historicProcessInstances);
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
public ModelAndView list(SearchProcessListDTO pageRequest,HttpServletRequest request) throws Exception {
|
||||
HistoricProcessInstanceQuery query=processInstanceService.getHistoryService().createHistoricProcessInstanceQuery();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,
|
||||
pageRequest, "");
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefKey())) {
|
||||
query.processDefinitionKey(pageRequest.getProcessDefKey());
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefName())) {
|
||||
query.processDefinitionName("%"+pageRequest.getProcessDefName()+"%");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getTitle())) {
|
||||
query.procTitle("%"+pageRequest.getTitle()+"%");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessInstanceId())) {
|
||||
query.processInstanceId(pageRequest.getProcessInstanceId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getUserId())) {
|
||||
query.startedBy(pageRequest.getUserId());
|
||||
}
|
||||
|
||||
query.procState(1);
|
||||
|
||||
|
||||
String appId=BaseUser.getInstance().getLoginUserAppId(request);
|
||||
if("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT)&&(!StringUtils.isEmpty(appId))){
|
||||
query.processInstanceTenantId(appId);
|
||||
}
|
||||
|
||||
//pageRequest.setPageSize(500);
|
||||
Page page = new Page(pageRequest, Integer.MAX_VALUE);
|
||||
|
||||
List<HistoricProcessInstance> historicProcessInstances=query.orderByProcessInstanceStartTime().desc().listPage(page.getFirstResult(),page.getPageSize());
|
||||
ModelAndView modelAndView = new ModelAndView("/procInstMgr/list");
|
||||
|
||||
page.setResult(historicProcessInstances);
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
modelAndView.addObject("isBpmAdmin",BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request)));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value="/suspend",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String suspend(String processInstanceId,HttpServletRequest request) {
|
||||
ProcessInstance processInstance=processInstanceService.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
if(processInstance==null){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
if(!processInstance.isSuspended()){
|
||||
processInstanceService.getRuntimeService().suspendProcessInstanceById(processInstanceId);
|
||||
}
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/restore",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String restore(String processInstanceId,HttpServletRequest request) {
|
||||
ProcessInstance processInstance=processInstanceService.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
if(processInstance==null){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
if(processInstance.isSuspended()){
|
||||
processInstanceService.getRuntimeService().activateProcessInstanceById(processInstanceId);
|
||||
}
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/cancel",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String cancel(String processInstanceId, HttpServletRequest request)
|
||||
throws Exception {
|
||||
if (processInstanceId == null) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
String[] processInstanceIds = null;
|
||||
if (processInstanceId.indexOf(";") != -1) {
|
||||
processInstanceIds = processInstanceId.split(";");
|
||||
} else {
|
||||
processInstanceIds = new String[] { processInstanceId };
|
||||
}
|
||||
String errorMsg="";
|
||||
for (String pid : processInstanceIds) {
|
||||
try {
|
||||
ProcessInstance processInstance = processInstanceService
|
||||
.getRuntimeService().createProcessInstanceQuery()
|
||||
.processInstanceId(pid).singleResult();
|
||||
if (processInstance == null) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
List<Task> tasks = processInstanceService.getTaskService()
|
||||
.createTaskQuery()
|
||||
.processInstanceId(processInstance.getId()).active()
|
||||
.orderByTaskCreateTime().desc().list();
|
||||
ProcessInputModel processInputModel = null;
|
||||
if (tasks != null && !tasks.isEmpty()) {
|
||||
Task task = tasks.get(0);
|
||||
processInputModel = (ProcessInputModel) processInstanceService
|
||||
.getTaskVariables(task.getId())
|
||||
.get(WorkFlowContants.WF_PROCESS_INPUT_VARIABLE_KEY);
|
||||
if (processInputModel != null) {
|
||||
processInputModel.setWf_curActInstId(task.getId());
|
||||
}
|
||||
|
||||
}
|
||||
if (processInputModel == null) {
|
||||
processInputModel = new ProcessInputModel();
|
||||
}
|
||||
processInputModel
|
||||
.setWf_actionType(WorkFlowContants.ACTION_TYPE_CANCEL_PROCESS);
|
||||
processInputModel.setWf_procDefId(processInstance
|
||||
.getProcessDefinitionId());
|
||||
processInputModel.setWf_procInstId(processInstance
|
||||
.getProcessInstanceId());
|
||||
processInputModel
|
||||
.setWf_curComment("流程管理端作废,操作人:"
|
||||
+ BaseUser.getInstance()
|
||||
.getSessionUser(request).getUserId());
|
||||
ProcessMgrDataShare.setProcessMgrData(WorkFlowContants.PROCESS_DEF_DEL_MANAGE_OPT);
|
||||
Map<String, Object> resultMap = processExecuteService
|
||||
.nextExecute(processInputModel);
|
||||
MyContants.saveUserOperate(request, "processInstanceId", true,
|
||||
"作废成功", MyContants.LOGIN_SESSION_USER,
|
||||
MyContants.APPLICATION);
|
||||
if ("ERROR".equals(resultMap.get("executeStatus"))) {
|
||||
errorMsg+=resultMap.get("executeErrorMsg")+",";
|
||||
}
|
||||
ProcessMgrDataShare.clear();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errorMsg+=WorkFlowException.getWorkFlowException(e)
|
||||
.getMessage()+",";
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(errorMsg)){
|
||||
return this.ACTION_ERROR + "," + errorMsg;
|
||||
}
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/delete",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String delete(String processInstanceId,boolean isHistory,HttpServletRequest request) throws Exception {
|
||||
if(processInstanceId==null){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
String[] processInstanceIds=null;
|
||||
if(processInstanceId.indexOf(";")!=-1){
|
||||
processInstanceIds=processInstanceId.split(";");
|
||||
}else{
|
||||
processInstanceIds=new String[]{processInstanceId};
|
||||
}
|
||||
for (String pid : processInstanceIds) {
|
||||
MyContants.saveUserOperate(request, "processInstanceId;isHistory", true, "删除成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
ProcessInstance processInstance=null;
|
||||
HistoricProcessInstance historicProcessInstance=null;
|
||||
ProcessMgrDataShare.setProcessMgrData(WorkFlowContants.PROCESS_DEF_DEL_MANAGE_OPT);
|
||||
|
||||
try{
|
||||
if(isHistory){
|
||||
historicProcessInstance=processInstanceService.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).singleResult();
|
||||
if(historicProcessInstance==null){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
processInstanceService.getHistoryService().deleteHistoricProcessInstance(pid);
|
||||
}else{
|
||||
processInstance=processInstanceService.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult();
|
||||
if(processInstance==null){
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
processInstanceService.getRuntimeService().deleteProcessInstance(pid,"action:/procInstMgr/delete,actionUser:"+BaseUser.getInstance().getSessionUser(request).getUserId());
|
||||
}
|
||||
ProcessMgrDataShare.clear();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
String errorMsg=WorkFlowException.getWorkFlowException(e).getMessage();
|
||||
return this.ACTION_ERROR+","+errorMsg;
|
||||
}
|
||||
}
|
||||
return this.ACTION_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* 计算时间day
|
||||
* @param String startDate
|
||||
* @param String endDate
|
||||
* @return day
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String differByDay(Date startDate, Date endDate) {
|
||||
if(startDate==null||endDate==null){
|
||||
return "";
|
||||
}
|
||||
return "" + (endDate.getTime() / 86400000 - startDate.getTime() / 86400000);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value="/autoRunVeiw")
|
||||
public ModelAndView autoRunVeiw(String procDefKy,HttpServletRequest request) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/autoRun/autoRunProcess");
|
||||
return modelAndView;
|
||||
}
|
||||
@RequestMapping(value="/autoRun",method=RequestMethod.POST)
|
||||
public ModelAndView autoRun(String procDefKey,String procStartUserId,HttpServletRequest request) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/autoRun/autoRunProcess");
|
||||
if(StringUtils.isNotEmpty(procDefKey)){
|
||||
ProcessInstanceModel processInstance=autoRunOneProcess.autoRunOneProcess(procDefKey.split(":")[0], procStartUserId,BaseUser.getInstance().getLoginUserAppId(request));
|
||||
modelAndView.addObject("processInstance",processInstance);
|
||||
}
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开对应流程,修改流程流转时间页面
|
||||
* @param procInstId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/updateProcessTimeView")
|
||||
public ModelAndView updateProcessTimeView(String procInstId,HttpServletRequest request) throws Exception {
|
||||
List<ActivityInstanceModel> allActivityInstance = processUpdateTimeService.getAllHistTaskByProcess(procInstId);
|
||||
/**
|
||||
* 处理最后结束时间的数据
|
||||
* 1、把结束时间的信息放到所有环节中,显示在页面,以id为actInstId
|
||||
* 2、actState:0(结束以前的环节)、1(结束环节)
|
||||
*/
|
||||
HistoricProcessInstance curProcessInstance = historyService
|
||||
.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(procInstId).singleResult();
|
||||
List<ActivityInstanceModel> allActivityInstanceNew = new ArrayList<ActivityInstanceModel>();
|
||||
for (ActivityInstanceModel act : allActivityInstance) {
|
||||
act.setActState("0");
|
||||
allActivityInstanceNew.add(act);
|
||||
}
|
||||
if (curProcessInstance.getProcState() == SuspensionState.FINISH
|
||||
.getStateCode()
|
||||
&& curProcessInstance.getEndTime() != null
|
||||
&& curProcessInstance.getEndActivityId() != null) {
|
||||
// 将办结节点加入historicTaskInstances中
|
||||
List<HistoricActivityInstance> hisActInsts = historyService
|
||||
.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(curProcessInstance.getId())
|
||||
.activityId(curProcessInstance.getEndActivityId())
|
||||
.orderByHistoricActivityInstanceStartTime().desc().list();
|
||||
//组装最后一个环节数据
|
||||
if (hisActInsts != null && !hisActInsts.isEmpty()) {
|
||||
HistoricActivityInstanceEntity hisActInst = (HistoricActivityInstanceEntity) hisActInsts
|
||||
.get(0);
|
||||
HistoricTaskInstanceEntity task = new HistoricTaskInstanceEntity();
|
||||
task.setSender(hisActInst != null ? hisActInst.getSender() : "");
|
||||
task.setSenderOrgId(hisActInst != null ? hisActInst.getSenderOrgId() : "");
|
||||
task.setSendUserId(hisActInst != null ? hisActInst.getSendUserId() : "");
|
||||
task.setSendUserName(hisActInst != null ? hisActInst.getSendUserName() : "");
|
||||
task.setSenderOrgName(hisActInst != null ? hisActInst.getSenderOrgName() : "");
|
||||
task.setId(hisActInst.getTaskId());
|
||||
task.setProcessInstanceId(hisActInst.getProcessInstanceId());
|
||||
task.setExecutionId(hisActInst.getExecutionId());
|
||||
task.setTaskDefinitionKey(hisActInst.getActivityId());
|
||||
String activityName = hisActInst.getActivityName();
|
||||
if ("endEvent".equals(hisActInst.getActivityType())
|
||||
&& StringUtils.isEmpty(activityName)) {
|
||||
activityName = "结束";
|
||||
}
|
||||
task.setName(activityName);
|
||||
task.setActionType(hisActInst.getActivityType());
|
||||
task.setPreTaskDefKey(hisActInst != null ? hisActInst
|
||||
.getPreActId() : "");
|
||||
task.setPreTaskDefName(hisActInst != null ? hisActInst
|
||||
.getPreActName() : "");
|
||||
task.setPreTaskId(hisActInst != null ? hisActInst
|
||||
.getPreActInstId() : "");
|
||||
task.setStartTime(hisActInst.getStartTime());
|
||||
task.setEndTime(hisActInst.getEndTime());
|
||||
task.setProcTitle(hisActInst.getProcTitle());
|
||||
task.setId(hisActInst.getId());
|
||||
allActivityInstanceNew.add(ActivityInstanceModel.buildAndActDef(
|
||||
(HistoricTaskInstance) task, null));
|
||||
}
|
||||
}
|
||||
//查询对应流程信息,用于修改流程时间
|
||||
HistoricProcessInstance historicProcessInstance=processTraceService.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
||||
ModelAndView modelAndView = new ModelAndView("/taskMgr/updateProcessTime");
|
||||
request.setAttribute("procInstId", procInstId);
|
||||
request.setAttribute("allActivityInstance", allActivityInstanceNew);
|
||||
request.setAttribute("historicProcessInstance", historicProcessInstance);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改流程流转时间
|
||||
*/
|
||||
@RequestMapping(value = "/updateActInstTime",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean updateActInstTime(@RequestBody List<ActivityInstanceModel> list){
|
||||
Boolean status= processUpdateTimeService.updateActInstTime(list);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改当前流程开始、结束时间
|
||||
* @param procInstId
|
||||
* @param createTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateProcessTime",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean updateProcessTime(@RequestParam String procInstId,@RequestParam String createTime,@RequestParam String endTime){
|
||||
Boolean status= processUpdateTimeService.updateProcTime(procInstId, createTime, endTime);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 恢复流程
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/processRestore",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String,Object> processRestore(@RequestParam String processInstanceId){
|
||||
|
||||
return processRestoreService.processRestore(processInstanceId);
|
||||
}
|
||||
/**
|
||||
* 打开对应流程,删除流程流转页面
|
||||
* @param procInstId
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/delProcessRoamView")
|
||||
public ModelAndView delProcessRoamView(String procInstId,HttpServletRequest request) throws Exception {
|
||||
List<ActivityInstanceModel> allActivityInstance = processUpdateTimeService.getAllHistTaskByProcess(procInstId);
|
||||
//查询对应流程信息,用于修改流程时间
|
||||
HistoricProcessInstance historicProcessInstance=processTraceService.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(procInstId).singleResult();
|
||||
ModelAndView modelAndView = new ModelAndView("/taskMgr/delProcessRoam");
|
||||
request.setAttribute("procInstId", procInstId);
|
||||
request.setAttribute("allActivityInstance", allActivityInstance);
|
||||
request.setAttribute("historicProcessInstance", historicProcessInstance);
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 删除当前流程环节
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delActInst",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean delActInst(@RequestBody List<ActivityInstanceModel> list){
|
||||
Boolean status= processUpdateTimeService.delActInst(list);
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 修改当前流程环节信息
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateActInst",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean updateActInst(@RequestBody List<ActivityInstanceModel> list){
|
||||
Boolean status= processUpdateTimeService.updateActInst(list);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.activiti.engine.repository.ModelQuery;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.page.PageRequest;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.util.WorkFlowException;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/procModelMgr")
|
||||
public class ProcessModelController extends BaseProcessController {
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
RepositoryService repositoryService;
|
||||
@Autowired
|
||||
ProcessModelService processModelService;
|
||||
|
||||
/**
|
||||
* 流程模型列表
|
||||
*/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView modelList(HttpServletRequest request) {
|
||||
ModelAndView mav = new ModelAndView("/procModelMgr/list");
|
||||
PageRequest pageRequest = this.bindPageRequest(request,
|
||||
new PageRequest(), "");
|
||||
ModelQuery modelQuery = repositoryService.createModelQuery();
|
||||
String appId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
if ("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT)
|
||||
&& !StringUtils.isEmpty(appId)) {
|
||||
modelQuery.modelTenantId(appId);
|
||||
}
|
||||
if (!StringUtils.isEmpty(request.getParameter("modelKey")))
|
||||
modelQuery.modelKeyLike("%" + request.getParameter("modelKey")+"%");
|
||||
if (!StringUtils.isEmpty(request.getParameter("modelName")))
|
||||
modelQuery.modelNameLike("%" + request.getParameter("modelName")
|
||||
+ "%");
|
||||
Page<Model> page = new Page<Model>(pageRequest,
|
||||
(int) modelQuery.count());
|
||||
List<Model> list = modelQuery.orderByCreateTime().desc()
|
||||
.listPage(page.getFirstResult(), pageRequest.getPageSize());
|
||||
page.setResult(list);
|
||||
mav.addAllObjects(toModelMap(page, null));
|
||||
mav.addObject("modelKey", request.getParameter("modelKey"));
|
||||
mav.addObject("modelName", request.getParameter("modelName"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制模型
|
||||
*/
|
||||
@RequestMapping(value = "copy")
|
||||
@ResponseBody
|
||||
public String copy(String modelId, String name, String key,
|
||||
String description) {
|
||||
String errorMsg = "";
|
||||
try {
|
||||
processModelService.copy(modelId,name, key, description);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof WorkFlowException) {
|
||||
errorMsg = ((WorkFlowException) e).getWebShowErrorMessage();
|
||||
}
|
||||
}
|
||||
return StringUtils.isEmpty(errorMsg)?this.ACTION_SUCCESS:errorMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制模型
|
||||
*/
|
||||
@RequestMapping(value = "copyView")
|
||||
public ModelAndView copyView(String modelId) {
|
||||
ModelAndView modelAndView = new ModelAndView("/procModelMgr/copy");
|
||||
Model modelData = repositoryService.getModel(modelId);
|
||||
modelAndView.addObject("modelData", modelData);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建模型
|
||||
*/
|
||||
@RequestMapping(value = "create")
|
||||
@ResponseBody
|
||||
public Map<String, String> create(String name, String key,
|
||||
String description, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
String path = "";
|
||||
String errorMsg = "";
|
||||
try {
|
||||
String modelId = processModelService.create(name, key, description,
|
||||
BaseUser.getInstance().getLoginUserAppId(request));
|
||||
path = MyContants.BPM_PROCESS_MODELER_PATH + "?id=" + modelId;
|
||||
} catch (Exception e) {
|
||||
if (e instanceof WorkFlowException) {
|
||||
errorMsg = ((WorkFlowException) e).getWebShowErrorMessage();
|
||||
}
|
||||
}
|
||||
Map result = new HashMap();
|
||||
result.put("path", path);
|
||||
result.put("errorMsg", errorMsg);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Model部署流程
|
||||
*/
|
||||
@RequestMapping(value = "deploy")
|
||||
@ResponseBody
|
||||
public String deploy(String modelId, HttpServletRequest request,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
String result = "";
|
||||
try {
|
||||
if (StringUtils.isEmpty(modelId)) {
|
||||
result = "传入modelId为空值,无法找到模型!";
|
||||
return result;
|
||||
}
|
||||
result = processModelService.deploy(modelId, BaseUser.getInstance()
|
||||
.getLoginUserAppId(request));
|
||||
} catch (Exception e) {
|
||||
String errorMsg = String.format("根据流程模型[%s]来部署流程失败,错误信息:[%s]",
|
||||
modelId, e.getLocalizedMessage());
|
||||
logger.error(errorMsg, e);
|
||||
result = errorMsg;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接覆盖已有流程定义版本,并更新流程定义的缓存
|
||||
*/
|
||||
@RequestMapping(value = "deployCascodeUpdate")
|
||||
@ResponseBody
|
||||
public String deployCascodeUpdate(String modelId,
|
||||
HttpServletRequest request, RedirectAttributes redirectAttributes) {
|
||||
String result = "";
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
if (StringUtils.isEmpty(modelId)) {
|
||||
result = "传入modelId为空值,无法找到模型!";
|
||||
return result;
|
||||
}
|
||||
/*String flowElementUptMsg=processModelService.getFlowElementUptMsg(modelId);
|
||||
if(StringUtils.isNotEmpty(flowElementUptMsg)){
|
||||
result=flowElementUptMsg;
|
||||
return result;
|
||||
}*/
|
||||
if (processModelService.isPprocessDeployment(modelId, BaseUser
|
||||
.getInstance().getLoginUserAppId(request))) {
|
||||
result = processModelService.deployCascodeUpdate(modelId);
|
||||
} else {
|
||||
result = processModelService.deploy(modelId, BaseUser
|
||||
.getInstance().getLoginUserAppId(request));
|
||||
}
|
||||
isSuccess = true;
|
||||
} catch (Exception e) {
|
||||
logger.error("根据模型部署流程失败:modelId={}", modelId, e);
|
||||
result = "根据模型部署流程失败";
|
||||
}
|
||||
MyContants.saveUserOperate(request, "modelId", isSuccess, result,
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出model的xml文件
|
||||
*/
|
||||
@RequestMapping(value = "export")
|
||||
public void export(String modelId, HttpServletResponse response) {
|
||||
try {
|
||||
BpmnModel bpmnModel = this.processModelService
|
||||
.getBpmnModelByModelId(modelId);
|
||||
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
|
||||
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
|
||||
IOUtils.copy(in, response.getOutputStream());
|
||||
String filename = bpmnModel.getMainProcess().getName()
|
||||
+ ".bpmn20.xml";
|
||||
response.setHeader("Content-Disposition", "attachment; filename="
|
||||
+ URLEncoder.encode(filename, "UTF-8"));
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
logger.error("导出model的xml文件失败:modelId={}", modelId, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入流程模型文件
|
||||
*
|
||||
* @param file
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importBpmnFile")
|
||||
public ModelAndView importBpmnFile(
|
||||
@RequestParam(value = "file", required = false) MultipartFile file,
|
||||
HttpServletRequest request) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/procModelMgr/importBpmnFile");
|
||||
try {
|
||||
processModelService.importBpmnFile(file.getBytes(),
|
||||
BaseUser.getInstance().getLoginUserAppId(request));
|
||||
modelAndView.addObject("flashSuccess", "导入成功!");
|
||||
} catch (Exception e) {
|
||||
modelAndView.addObject("flashSuccess", "非法的BPMN文件!");
|
||||
}
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程模型
|
||||
*
|
||||
* @param modelId
|
||||
* @param redirectAttributes
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(String modelId,HttpServletRequest request,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"redirect:/procModelMgr/list.do");
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
repositoryService.deleteModel(modelId);
|
||||
|
||||
MyContants.saveUserOperate(request, "modelId", true, DELETE_SUCCESS,
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.manage.countAnalysis.service.ProcessMonitorService;
|
||||
/**
|
||||
* @作者 dsl
|
||||
* @创建时间 2020年2月14日
|
||||
* @说明 流程首页
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/flow/monitor")
|
||||
public class ProcessMonitorController extends BaseSpringController{
|
||||
@Autowired
|
||||
private ProcessMonitorService processMonitorService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
/**
|
||||
* 流程监控-流程分析
|
||||
**/
|
||||
@RequestMapping(value = "/processAnalysis")
|
||||
public ModelAndView processAnalysis(HttpServletRequest request) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/analysis");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-流程分析-根据流程租户下钻
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/analysisDetailByAppId")
|
||||
public ModelAndView analysisDetailByAppId(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/analysisDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-流程分析-平均审批耗时最长的流程下钻
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/avgUserTimePage")
|
||||
public ModelAndView avgUserTimePage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/avgUserTimeDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-流程分析-超时最多的流程下钻
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/overTimePage")
|
||||
public ModelAndView overTimePage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/overTimeDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-节点分析
|
||||
**/
|
||||
@RequestMapping(value = "/actAnalysis")
|
||||
public ModelAndView defAnalysis(HttpServletRequest request) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/actAnalysis");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-节点分析-耗时最长的节点下钻
|
||||
**/
|
||||
@RequestMapping(value = "/actAvgUserTimePage")
|
||||
public ModelAndView actAvgUserTimePage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/actAvgUserTimeDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-节点分析-待审流程最多的节点下钻
|
||||
**/
|
||||
@RequestMapping(value = "/actDoProcessMaxPage")
|
||||
public ModelAndView actDoProcessMaxPage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/actDoProcessMaxDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-流程创建最多的流程-下钻
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/createMaxPorcessPage")
|
||||
public ModelAndView createMaxPorcessPage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/createMaxPorcessDetail");
|
||||
//ApplicationEntity app = applicationManager.getById(appId);
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-人员分析
|
||||
**/
|
||||
@RequestMapping(value = "/staffAnalysis")
|
||||
public ModelAndView staffAnalysis(HttpServletRequest request) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/staffAnalysis");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程监控-人员分析
|
||||
**/
|
||||
@RequestMapping(value = "/staffPage")
|
||||
public ModelAndView staffPage(HttpServletRequest request,String appId) throws Exception{
|
||||
ModelAndView modelAndView = new ModelAndView("/processReport/staffTopDetail");
|
||||
/*ApplicationEntity app = applicationManager.getById(appId);*/
|
||||
modelAndView.addObject("appId", appId);
|
||||
modelAndView.addObject("appName", "");
|
||||
return modelAndView;
|
||||
}
|
||||
/**
|
||||
* 流程分析详情
|
||||
* 待办最多流程、超时处理最多流程、创建量最高流程、平均审批耗时最长流程
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/analysisDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> analysisDetail(HttpServletRequest request) throws Exception{
|
||||
return processMonitorService.analysisDetail();
|
||||
}
|
||||
/**
|
||||
* 节点分析详情
|
||||
* 节点平均耗时、待办流程最多的节点
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/actAnalysisDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> actAnalysisDetail(HttpServletRequest request) throws Exception{
|
||||
return processMonitorService.actAnalysisDetail();
|
||||
}
|
||||
/**
|
||||
* 人员分析详情
|
||||
* 待处理流程最多的员工
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/staffAnalysisDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> staffAnalysisDetail(HttpServletRequest request) throws Exception{
|
||||
return processMonitorService.staffAnalysisDetail();
|
||||
}
|
||||
/**
|
||||
* 平均耗时最长的流程统计详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/avgUserTimeDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> avgUserTimeDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.avgUserTimeDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 流程创建数量排名详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/createMaxProcessDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> createProcessProcessDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.createMaxProcessDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 待办流程最多-下钻
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/appProcessDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> appProcessDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.appProcessDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 超时最多的流程详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/overTimeProcessDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> overTimeProcessDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.overTimeProcessDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 节点平均耗时-下钻详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/actAvgUserTimeDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> actAvgUserTimeDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.actAvgUserTimeDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 人员分析-下钻详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/staffTopDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> staffTopDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.staffTopDetail(appId);
|
||||
}
|
||||
/**
|
||||
* 节点分析-待审流程最多的节点下钻详情
|
||||
* @param request
|
||||
* @param appId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/actDoProcessDetail")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> actDoProcessDetail(HttpServletRequest request,String appId) throws Exception{
|
||||
return processMonitorService.actDoProcessDetail(appId);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
String sql="select\r\n" +
|
||||
" mu.user_uuid inst_id,\r\n" +
|
||||
" mu.nickname inst_name,\r\n" +
|
||||
" '性别' type_name,\r\n" +
|
||||
" ulp.sex tag_name,\r\n" +
|
||||
" '年龄层次' type_name1,\r\n" +
|
||||
" age_group tag_name1,\r\n" +
|
||||
" '用户类型' type_name2, \r\n" +
|
||||
" user_type tag_name2,\r\n" +
|
||||
" '用户生命周期' type_name3,\r\n" +
|
||||
" user_life_cycle tag_name3,\r\n" +
|
||||
" '主抽品牌偏好' type_name4,\r\n" +
|
||||
" primary_brand tag_name4,\r\n" +
|
||||
" '辅抽品牌偏好' type_name5,\r\n" +
|
||||
" second_brand tag_name5,\r\n" +
|
||||
" '主抽规格偏好' type_name6,\r\n" +
|
||||
" primary_trandemark tag_name6,\r\n" +
|
||||
" '活动用户分层' type_name7,\r\n" +
|
||||
" user_activity_stratification tag_name7,\r\n" +
|
||||
" '价值用户' type_name8,\r\n" +
|
||||
" user_worth tag_name8,\r\n" +
|
||||
" '是否尝鲜用户' type_name9,\r\n" +
|
||||
" taste_fresh_type tag_name9\r\n" +
|
||||
" FROM\r\n" +
|
||||
" ( select\r\n" +
|
||||
" user_uuid,\r\n" +
|
||||
" ifnull(sex,'未知') sex,\r\n" +
|
||||
" ifnull(age_group,'未知') age_group,\r\n" +
|
||||
" ifnull(user_type,'未知') user_type,\r\n" +
|
||||
" ifnull(user_life_cycle,'未知') user_life_cycle,\r\n" +
|
||||
" ifnull(primary_brand,'未知') primary_brand,\r\n" +
|
||||
" ifnull(user_activity_stratification,'未知') user_activity_stratification,\r\n" +
|
||||
" ifnull(user_worth,'未知') user_worth,\r\n" +
|
||||
" ifnull(taste_fresh_type,'未知') taste_fresh_type,\r\n" +
|
||||
" ifnull(second_brand,'未知') second_brand,\r\n" +
|
||||
" ifnull(primary_trandemark,'未知') primary_trandemark\r\n" +
|
||||
" FROM\r\n" +
|
||||
" user_label_portrait ) ulp\r\n" +
|
||||
" left join (SELECT user_uuid, nickname FROM mg_user) mu on ulp.user_uuid = mu.user_uuid limit 10000";
|
||||
|
||||
try {
|
||||
String sqlEnStr=java.net.URLEncoder.encode(sql);
|
||||
System.out.println(sqlEnStr);
|
||||
System.out.println(java.net.URLDecoder.decode(sqlEnStr));
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,360 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
/**
|
||||
* 流程监控
|
||||
* @version: 1.0
|
||||
* @author lw
|
||||
*/
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.common.util.SysConfig;
|
||||
import com.blueland.bpm.engine.config.model.ProcessInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ProcessInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.model.ProcessInstanceModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessTraceService;
|
||||
import com.blueland.bpm.manage.util.CheckMobile;
|
||||
|
||||
@Controller
|
||||
@RequestMapping({ "/workflow/trace" })
|
||||
public class ProcessTraceController extends BaseProcessController {
|
||||
@Autowired
|
||||
private ProcessTraceService processTraceService;
|
||||
@Autowired
|
||||
private ProcessInfoConfigManager processInfoConfigManager;
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
private String tracePicFix="/bpmc/resource/js/plugins/zTree/css/zTreeStyle/img/diy";
|
||||
/**
|
||||
* 流程监控总入口
|
||||
* @param traceType
|
||||
* @param processInstanceId
|
||||
* @param response
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/traceProcess")
|
||||
public ModelAndView traceProcessView(String traceType, String processInstanceId, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
return traceProcessOldView(traceType, processInstanceId, response, request);
|
||||
}
|
||||
|
||||
@RequestMapping({ "/traceByImage" })
|
||||
public ModelAndView processTraceImage(String processInstanceId, String imageHeight, String imageWidth,
|
||||
String fileId) throws Exception {
|
||||
return traceImage(processInstanceId);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* traceImage中会调用这个方法
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/traceNewByImage")
|
||||
@ResponseBody
|
||||
public Map<String, Object> processTraceNewImage(String processInstanceId) throws Exception {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
Map<String, Object> hisTaskLog = processTraceService.getCurTaskLog(processInstanceId);
|
||||
result.put("hisTaskLog", hisTaskLog);
|
||||
result.put("processTrace", processTraceService.getProcessTrace(processInstanceId));
|
||||
result.put("processInstance", hisTaskLog.get("curProcessInstance"));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程监控-文本+图形,暂未上线
|
||||
*
|
||||
* @param traceType
|
||||
* @param processInstanceId
|
||||
* @param response
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView traceProcessNewView(String traceType, String processInstanceId, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceImageAndText");
|
||||
List<HistoricProcessInstance> allProcessInstances = new ArrayList<HistoricProcessInstance>();
|
||||
Map<String, Object> hisTaskLog = processTraceService.getHisTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
List<HistoricProcessInstance> subProcessInstances = processTraceService.getHistoryService()
|
||||
.createHistoricProcessInstanceQuery().superProcessInstanceId(processInstanceId)
|
||||
.orderByProcessInstanceStartTime().desc().list();
|
||||
allProcessInstances.add((HistoricProcessInstance) hisTaskLog.get("curProcessInstance"));
|
||||
allProcessInstances.addAll(subProcessInstances);
|
||||
modelAndView.addObject("curProcessInstance", hisTaskLog.get("curProcessInstance"));
|
||||
modelAndView.addObject("allProcessInstances", allProcessInstances);
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 老版本流程监控入口
|
||||
*
|
||||
* @param traceType
|
||||
* @param processInstanceId
|
||||
* @param response
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private ModelAndView traceProcessOldView(String traceType, String processInstanceId, HttpServletResponse response,
|
||||
HttpServletRequest request) {
|
||||
boolean isFromMobile = false;
|
||||
try {
|
||||
String userAgent = request.getHeader("USER-AGENT").toLowerCase();
|
||||
if (userAgent == null) {
|
||||
userAgent = "";
|
||||
}
|
||||
isFromMobile = CheckMobile.check(userAgent);
|
||||
|
||||
if (isFromMobile) {
|
||||
return traceProcessMobile(processInstanceId, response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceProcess");
|
||||
ProcessInstanceModel processInstance = this.processInstanceService.getProcessInstanceById(processInstanceId);
|
||||
modelAndView.addObject("traceType", traceType);
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
if(processInstance!=null) {
|
||||
ProcessInfoConfig processInfoConfig = this.processInfoConfigManager.getById(processInstance.getProcDefId());
|
||||
modelAndView.addObject("processInstance", processInstance);
|
||||
if (StringUtils.isNotEmpty(processInfoConfig.getArisCode()))
|
||||
modelAndView.addObject("arisUrl", SysConfig.getValue("ARIS_URL") + processInfoConfig.getArisCode());
|
||||
if (StringUtils.isNotEmpty(processInfoConfig.getArisCode())) {
|
||||
modelAndView.addObject("arisCode", processInfoConfig.getArisCode());
|
||||
}
|
||||
}
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping({ "/traceProcessMobile" })
|
||||
public ModelAndView traceProcessMobile(String processInstanceId, HttpServletResponse response) {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceProcessMobile");
|
||||
|
||||
ProcessInstanceModel processInstance = this.processInstanceService.getProcessInstanceById(processInstanceId);
|
||||
ProcessInfoConfig processInfoConfig = this.processInfoConfigManager.getById(processInstance.getProcDefId());
|
||||
|
||||
List<HistoricProcessInstance> allProcessInstances = new ArrayList();
|
||||
HistoricProcessInstance curProcessInstance = (HistoricProcessInstance) this.processTraceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
|
||||
.singleResult();
|
||||
modelAndView.addObject("curProcessInstance", curProcessInstance);
|
||||
List<HistoricProcessInstance> subProcessInstances =
|
||||
|
||||
((HistoricProcessInstanceQuery) this.processTraceService.getHistoryService()
|
||||
.createHistoricProcessInstanceQuery().superProcessInstanceId(curProcessInstance.getId())
|
||||
.orderByProcessInstanceStartTime().desc()).list();
|
||||
allProcessInstances.add(curProcessInstance);
|
||||
allProcessInstances.addAll(subProcessInstances);
|
||||
|
||||
Map<String, Object> hisTaskLog = this.processTraceService.getHisTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
HistoricProcessInstance historicProcessInstance = (HistoricProcessInstance) this.processTraceService
|
||||
.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
|
||||
.singleResult();
|
||||
try {
|
||||
String[] size = this.processTraceService
|
||||
.getProcessDiagramSize(historicProcessInstance.getProcessDefinitionId());
|
||||
modelAndView.addObject("imageWidth", size[0]);
|
||||
modelAndView.addObject("imageHeight", size[1]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
modelAndView.addObject("allProcessInstances", allProcessInstances);
|
||||
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
modelAndView.addObject("processInstance", processInstance);
|
||||
modelAndView.addObject("processDefinitonDiv",
|
||||
this.processTraceService.getProcessDefinitionDiv(historicProcessInstance.getProcessDefinitionId()));
|
||||
if (StringUtils.isNotEmpty(processInfoConfig.getArisCode()))
|
||||
modelAndView.addObject("arisUrl", SysConfig.getValue("ARIS_URL") + processInfoConfig.getArisCode());
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 老版本流程监控
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @param imageHeight
|
||||
* @param imageWidth
|
||||
* @param fileId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private ModelAndView processTraceOldImage(String processInstanceId, String imageHeight, String imageWidth,
|
||||
String fileId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceByImage");
|
||||
Map<String, Object> hisTaskLog = this.processTraceService.getCurTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
HistoricProcessInstance historicProcessInstance=(HistoricProcessInstance)hisTaskLog.get("curProcessInstance");
|
||||
try {
|
||||
String[] size = this.processTraceService
|
||||
.getProcessDiagramSize(historicProcessInstance.getProcessDefinitionId());
|
||||
modelAndView.addObject("imageWidth", size[0]);
|
||||
modelAndView.addObject("imageHeight", size[1]);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
modelAndView.addObject("processInstance", historicProcessInstance);
|
||||
modelAndView.addObject("procTitle", historicProcessInstance.getProcTitle().replaceAll("\"", "\'"));
|
||||
modelAndView.addObject("fileId", fileId);
|
||||
modelAndView.addObject("processDefinitonDiv",
|
||||
this.processTraceService.getProcessDefinitionDiv(historicProcessInstance.getProcessDefinitionId()));
|
||||
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程监控图入口
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/traceImage")
|
||||
public ModelAndView traceImage(String processInstanceId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceImage");
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新版本流程监控
|
||||
*/
|
||||
private ModelAndView processTraceNewImage(String processInstanceId, String fileId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceByImage");
|
||||
Map<String, Object> hisTaskLog = processTraceService.getCurTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
HistoricProcessInstance historicProcessInstance=(HistoricProcessInstance)hisTaskLog.get("curProcessInstance");
|
||||
modelAndView.addObject("processTrace", processTraceService.getProcessTrace(processInstanceId));
|
||||
modelAndView.addObject("processInstance", historicProcessInstance);
|
||||
modelAndView.addObject("fileId", fileId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 老版本流程监控-文本
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping({ "/traceByText" })
|
||||
public ModelAndView processTraceText(String processInstanceId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/traceByText");
|
||||
Map<String, Object> hisTaskLog = this.processTraceService.getHisTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
List<HistoricProcessInstance> allProcessInstances = new ArrayList();
|
||||
HistoricProcessInstance curProcessInstance=(HistoricProcessInstance)hisTaskLog.get("curProcessInstance");
|
||||
if(curProcessInstance!=null) {
|
||||
modelAndView.addObject("procTitle", curProcessInstance.getProcTitle().replaceAll("\"", "\'"));
|
||||
}else {
|
||||
curProcessInstance=new HistoricProcessInstanceEntity();
|
||||
}
|
||||
List<HistoricProcessInstance> subProcessInstances =
|
||||
((HistoricProcessInstanceQuery) this.processTraceService.getHistoryService()
|
||||
.createHistoricProcessInstanceQuery().superProcessInstanceId(curProcessInstance.getId())
|
||||
.orderByProcessInstanceStartTime().desc()).list();
|
||||
allProcessInstances.add(curProcessInstance);
|
||||
allProcessInstances.addAll(subProcessInstances);
|
||||
modelAndView.addObject("allProcessInstances", allProcessInstances);
|
||||
|
||||
modelAndView.addObject("curProcessInstance", curProcessInstance);
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping({ "/processTitleTree" })
|
||||
public ModelAndView processTitleTree(String processInstanceId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/processTitleTree");
|
||||
modelAndView.addObject("processInstanceId", processInstanceId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程监控-子流程使用
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping({ "/allProcessInstance" })
|
||||
@ResponseBody
|
||||
public List<TreeNode> allProcessInstance(String processInstanceId) throws Exception {
|
||||
List<ProcessInstanceModel> historicProcessInstances = this.processInstanceService
|
||||
.getAllProcessInstance(processInstanceId);
|
||||
List<TreeNode> treeNodes = new ArrayList();
|
||||
for (ProcessInstanceModel hisPro : historicProcessInstances) {
|
||||
TreeNode treeNode = null;
|
||||
if (StringUtils.isEmpty(hisPro.getParentProcInstId())) {
|
||||
if (hisPro.isFinishProcess()) {
|
||||
treeNode = new TreeNode(hisPro.getProcInstId(), "-1", hisPro.getProcTitle(), false,
|
||||
"NODENOTFINISH");
|
||||
} else {
|
||||
treeNode = new TreeNode(hisPro.getProcInstId(), "-1", hisPro.getProcTitle(), false, "NODEFINISH");
|
||||
}
|
||||
|
||||
} else {
|
||||
treeNode = new TreeNode(hisPro.getProcInstId(), hisPro.getParentProcInstId(),
|
||||
hisPro.getProcTitle() + "(" + hisPro.getStartUserName() + ")", false, "NODE");
|
||||
if (hisPro.isFinishProcess()) {
|
||||
treeNode.setIcon(tracePicFix+"/ico-agree1.png");
|
||||
} else {
|
||||
treeNode.setIcon(tracePicFix+"/ico-agree.png");
|
||||
}
|
||||
}
|
||||
treeNode.setIcon(SysConfig.getValue("CTX") + treeNode.getIcon());
|
||||
treeNodes.add(treeNode);
|
||||
}
|
||||
return treeNodes;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping({ "/detailLog" })
|
||||
public ModelAndView detailLog(String processInstanceId) throws Exception {
|
||||
ModelAndView modelAndView = new ModelAndView("/trace/detailLog");
|
||||
Map<String, Object> hisTaskLog = this.processTraceService.getHisTaskLog(processInstanceId);
|
||||
modelAndView.addObject("hisTaskLog", hisTaskLog);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping({ "/resource1" })
|
||||
public void graphHistoryProcessInstance(String resourceType, String processInstanceId, HttpServletResponse response)
|
||||
throws Exception {
|
||||
response.setContentType("image/png");
|
||||
InputStream is = this.processTraceService.getProcessInstanceDiagram(processInstanceId);
|
||||
IOUtils.copy(is, response.getOutputStream());
|
||||
}
|
||||
|
||||
public static long differByDay(Date startDate, Date endDate) {
|
||||
if ((startDate == null) || (endDate == null)) {
|
||||
return 0L;
|
||||
}
|
||||
return endDate.getTime() / 86400000L - startDate.getTime() / 86400000L;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.core.model.SearchProcessListDTO;
|
||||
import com.blueland.bpm.engine.core.service.AutoRunOneProcess;
|
||||
import com.blueland.bpm.engine.core.service.ProcessExecuteService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
@Controller
|
||||
@RequestMapping(value = "/procUse")
|
||||
public class ProcessUseController extends BaseProcessController{
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Autowired
|
||||
ProcessExecuteService processExecuteService;
|
||||
@Autowired
|
||||
AutoRunOneProcess autoRunOneProcess;
|
||||
|
||||
@RequestMapping(value="/list")
|
||||
public ModelAndView list(SearchProcessListDTO pageRequest,HttpServletRequest request) throws Exception {
|
||||
HistoricProcessInstanceQuery query=processInstanceService.getHistoryService().createHistoricProcessInstanceQuery().unfinished();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,
|
||||
pageRequest, "");
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefKey())) {
|
||||
query.processDefinitionKey(pageRequest.getProcessDefKey());
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefName())) {
|
||||
query.processDefinitionName("%"+pageRequest.getProcessDefName()+"%");
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessInstanceId())) {
|
||||
query.processInstanceId(pageRequest.getProcessInstanceId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getTitle())) {
|
||||
query.procTitle(pageRequest.getTitle());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getUserId())) {
|
||||
query.startedBy(pageRequest.getUserId());
|
||||
}
|
||||
String appId=BaseUser.getInstance().getLoginUserAppId(request);
|
||||
if("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT)&&(!StringUtils.isEmpty(appId))){
|
||||
query.processInstanceTenantId(appId);
|
||||
}
|
||||
|
||||
//pageRequest.setPageSize(500);
|
||||
Page page = new Page(pageRequest, (int) query.count());
|
||||
|
||||
List<HistoricProcessInstance> historicProcessInstances=query.orderByProcessInstanceStartTime().desc().listPage(page.getFirstResult(),page.getPageSize());
|
||||
ModelAndView modelAndView = new ModelAndView("/procInstMgr/list");
|
||||
|
||||
page.setResult(historicProcessInstances);
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
modelAndView.addObject("isBpmAdmin",BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request)));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.activiti.engine.impl.RepositoryServiceImpl;
|
||||
import org.activiti.engine.impl.pvm.PvmActivity;
|
||||
import org.activiti.engine.impl.pvm.ReadOnlyProcessDefinition;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.Role;
|
||||
import com.blueland.bpm.engine.config.model.User2role;
|
||||
import com.blueland.bpm.engine.config.service.RoleManager;
|
||||
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.bpm.engine.util.ProcessDefinitionUtils;
|
||||
import com.blueland.bpm.identity.OrgService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.blueland.bpm.manage.util.XLSExportUtil;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "role")
|
||||
public class RoleController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = "roleSort";
|
||||
|
||||
private final String LIST_ACTION = "redirect:/role/list.do";
|
||||
|
||||
@Autowired
|
||||
private RoleManager roleManager;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private OrgService orgService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationService;
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
|
||||
public RoleController(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(HttpServletRequest request,Role query) throws Exception {
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
ApplicationEntity applicaton = applicationService.getById(loginUserAppId);
|
||||
|
||||
//设置当前登录用户id以便查询
|
||||
User loginUser = BaseUser.getInstance().getSessionUser(request);
|
||||
if(BaseUser.isEbpmAdminSession(request)) {
|
||||
query.setRoleOrgId("admin");
|
||||
}
|
||||
query.setRoleAppId(applicaton.getAppId());
|
||||
Page page = this.roleManager.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/role/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
|
||||
result.addObject("applicaton", applicaton);
|
||||
result.addObject("loginUser", loginUser);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增或者编辑页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(HttpServletRequest request,Role role) {
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
ApplicationEntity applicaton = applicationService.getById(loginUserAppId);
|
||||
ModelAndView result = new ModelAndView("/role/create");
|
||||
result.addObject("role", role);
|
||||
result.addObject("applicaton", applicaton);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(HttpServletRequest request,Role role) {
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
ApplicationEntity applicaton = applicationService.getById(loginUserAppId);
|
||||
ModelAndView result = new ModelAndView("/role/edit");
|
||||
Role tempRole = roleManager.selectByRoleId(role.getRoleId());
|
||||
result.addObject("role", tempRole);
|
||||
result.addObject("applicaton", applicaton);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增之后保存对象
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(HttpServletRequest request,Role role,RedirectAttributes redirectAttributes) throws Exception {
|
||||
User loginUser = BaseUser.getInstance().getSessionUser(request);
|
||||
role.setRoleCreator(loginUser.getUserId());
|
||||
String messageInfo = ACTION_SUCCESS;
|
||||
if(null!=role && null!=role.getRoleId() && !"".equals(role.getRoleId())){
|
||||
Role tempRole = roleManager.selectByRoleId(role.getRoleId());
|
||||
if(tempRole != null){
|
||||
messageInfo = "["+role.getRoleAppId()+"]"+"应用系统已存在角色编码为["+role.getRoleId()+"]的角色,请您重新输入角色编码!";
|
||||
}
|
||||
}
|
||||
roleManager.saveRole(role);
|
||||
return messageInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存对象
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String update(HttpServletRequest request,Role role) throws Exception {
|
||||
User loginUser = BaseUser.getInstance().getSessionUser(request);
|
||||
role.setRoleCreator(loginUser.getUserId());
|
||||
roleManager.saveRole(role);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存对象
|
||||
**/
|
||||
@RequestMapping(value = "saveUser2role")
|
||||
@ResponseBody
|
||||
public String saveUser2role(HttpServletRequest request,String userIds,String roleId) {
|
||||
MyContants.saveUserOperate(request, "roleId;userIds", true,"角色人员变更成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
roleManager.saveUser2role(userIds, roleId);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String roleId = request.getParameter("item");
|
||||
//通过roleId得到role对象,从而得到AppId(系统Id)
|
||||
Role role =roleManager.selectByRoleId(roleId);
|
||||
String appId = role.getRoleAppId();
|
||||
//资源类型:分为三种(角色role、组织org、人员user)
|
||||
String resourceType = "role";
|
||||
//map返回结果,tenantId、procDefId、procDefName、activityId、activityName
|
||||
List<Map<String,String>> inProcess =null;
|
||||
try{
|
||||
inProcess = processDefinitionService.findProcessDefsByResource(appId,"",resourceType,roleId);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(inProcess!=null&&inProcess.size()>0){
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, "该角色已绑定在流程环节中,无法删除!");
|
||||
}else{
|
||||
roleManager.deleteBatch(roleId);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
MyContants.saveUserOperate(request, "items", true, "删除成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
}
|
||||
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据roleIds获取相对应的user对象
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="queryUserByRoleIdsAjax")
|
||||
@ResponseBody
|
||||
public List<User> queryUserByRoleIdsAjax(HttpServletRequest request,String roleId){
|
||||
|
||||
List<User> users = new ArrayList<User>();
|
||||
|
||||
List<User2role> list = roleManager.getUser2roleList(roleId);
|
||||
if(!list.isEmpty()){
|
||||
for (User2role user2role : list) {
|
||||
User user = userService.getUserById(user2role.getUserId());
|
||||
if(null!=user){
|
||||
user.setOrgId(user2role.getOrgName());
|
||||
users.add(user);
|
||||
}else{
|
||||
System.out.println(user2role.getUserId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出 流程清单 excel
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RequestMapping(value = "/export")
|
||||
public void export(HttpServletRequest request, HttpServletResponse response) {
|
||||
SearchProcessListDTO params = new SearchProcessListDTO();
|
||||
params.setTenantId(BaseUser.getInstance().getLoginUserAppId(request));
|
||||
String url = request.getServletContext().getRealPath("/");
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String exls = url + "/file/";
|
||||
String name = "角色清单" + "_" + df.format(new Date()) + ".xls";
|
||||
String path = exls.replace("/", File.separator);
|
||||
File file = new File(exls);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
XLSExportUtil exportUtil = new XLSExportUtil(name, path);
|
||||
exportUtil.removeSheetAt(0);
|
||||
String[] sheet1 = { "角色编码", "角色名称", "成员ID", "成员名称", "成员组织ID", "成员组织名称" };
|
||||
// 第一个sheet
|
||||
roleSheet(exportUtil, "角色列表", sheet1, params);
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
BufferedInputStream bis = null;
|
||||
BufferedOutputStream bos = null;
|
||||
try {
|
||||
exportUtil.exportXLS();
|
||||
response.setHeader("Content-disposition",
|
||||
"attachment;filename=" + new String(name.getBytes(), "iso-8859-1"));
|
||||
|
||||
FileInputStream is = new FileInputStream(exls + name);
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
bis = new BufferedInputStream(is);
|
||||
bos = new BufferedOutputStream(out);
|
||||
byte[] buff = new byte[2048];
|
||||
int bytesRead;
|
||||
// Simple read/write loop.
|
||||
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
|
||||
bos.write(buff, 0, bytesRead);
|
||||
}
|
||||
bis.close();
|
||||
bos.close();
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void roleSheet(XLSExportUtil exportUtil,String sheetName,String[] titles,SearchProcessListDTO params){
|
||||
int rowNum = 0; //行数
|
||||
int cellNum = 0; //列数
|
||||
exportUtil.createSheet(sheetName); //新增sheet设置名称
|
||||
exportUtil.createRow(rowNum++); //在sheet中新增一行、展示查询数据——标题
|
||||
for (String title : titles) {
|
||||
exportUtil.setCell(cellNum++, title);
|
||||
}
|
||||
Role prole=new Role();
|
||||
prole.setRoleAppId(params.getTenantId());
|
||||
List<Role> roles=this.roleManager.findRolesByParam(prole);
|
||||
for (Role role : roles) {
|
||||
List<User2role> user2roles=this.roleManager.getUser2roleList(role.getRoleId());
|
||||
if(user2roles.isEmpty()) {
|
||||
exportUtil.createRow(rowNum++);
|
||||
exportUtil.setCell(0,role.getRoleId());
|
||||
exportUtil.setCell(1,role.getRoleName());
|
||||
exportUtil.setCell(2,"");
|
||||
exportUtil.setCell(3,"");
|
||||
exportUtil.setCell(4,"");
|
||||
exportUtil.setCell(5,"");
|
||||
}
|
||||
for (User2role user2role : user2roles) {
|
||||
exportUtil.createRow(rowNum++);
|
||||
exportUtil.setCell(0,role.getRoleId());
|
||||
exportUtil.setCell(1,role.getRoleName());
|
||||
exportUtil.setCell(2,user2role.getUserCode());
|
||||
exportUtil.setCell(3,user2role.getUserName());
|
||||
exportUtil.setCell(4,user2role.getOrgId());
|
||||
exportUtil.setCell(5,user2role.getOrgName());
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 新增之后保存对象
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "sync/saveOrUpdate")
|
||||
@ResponseBody
|
||||
public String syncSave(HttpServletRequest request,@RequestBody Map<String,Object> params){
|
||||
Role role = new Role();
|
||||
role.setRoleId(params.get("roleId") != null ? params.get("roleId").toString():"");
|
||||
role.setRoleAppId(params.get("roleAppId") != null ? params.get("roleAppId").toString():"");
|
||||
role.setRoleName(params.get("roleName")!= null ? params.get("roleName").toString():"");
|
||||
role.setRoleSort(params.get("roleSort")!= null ? Integer.parseInt(params.get("roleSort").toString()):null);
|
||||
role.setRoleType(params.get("roleType")!= null ? params.get("roleType").toString():"");
|
||||
role.setRoleAppName(params.get("appName")!= null ? params.get("appName").toString():"");
|
||||
role.setRoleStatus(params.get("roleStatus")!= null? params.get("roleStatus").toString():"");
|
||||
role.setRemark(params.get("remark")!= null? params.get("remark").toString():"");
|
||||
role.setRoleCreator(params.get("userId")!= null? params.get("userId").toString():"");
|
||||
roleManager.saveRole(role);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* 保存角色用户
|
||||
**/
|
||||
@RequestMapping(value = "sync/saveUserrole")
|
||||
@ResponseBody
|
||||
public String syncSaveUserrole(HttpServletRequest request,@RequestBody Map<String,Object> params) {
|
||||
MyContants.saveUserOperate(request, "roleId;userIds", true,"角色人员变更成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
roleManager.saveUser2role(params.get("userIds").toString(), params.get("roleId").toString());
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* 删除角色
|
||||
**/
|
||||
@RequestMapping(value = "sync/delRole")
|
||||
@ResponseBody
|
||||
public Map<String,Object> delRole(HttpServletRequest request,@RequestBody Map<String,Object> params) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
boolean flag = false;
|
||||
String msg = "角色id不能为空!";
|
||||
if(params.get("roleId") == null){
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
String roleId = params.get("roleId").toString();
|
||||
//通过roleId得到role对象,从而得到AppId(系统Id)
|
||||
Role role =roleManager.selectByRoleId(roleId);
|
||||
String appId = role.getRoleAppId();
|
||||
//资源类型:分为三种(角色role、组织org、人员user)
|
||||
String resourceType = "role";
|
||||
//map返回结果,tenantId、procDefId、procDefName、activityId、activityName
|
||||
List<Map<String,String>> inProcess =null;
|
||||
try{
|
||||
inProcess = processDefinitionService.findProcessDefsByResource(appId,"",resourceType,roleId);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(inProcess!=null&&inProcess.size()>0){
|
||||
msg = "该角色已绑定在流程环节中,无法删除!";
|
||||
}else{
|
||||
roleManager.deleteBatch(roleId);
|
||||
flag = true;
|
||||
msg = "删除成功";
|
||||
}
|
||||
result.put("flag", flag);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.commons.collections.MultiMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.manage.config.model.SearchProcessResource;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/searchProcessResource/")
|
||||
public class SearchProcessResourceController extends BaseSpringController{
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
/**
|
||||
* 执行搜索(根据用户选择的系统ID、资源ID和资源类型查询流程)
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(SearchProcessResource searchProcessResource,HttpServletRequest request) throws Exception {
|
||||
//判断是否为系统管理员,是:显示系统编码文本框可以查询所有系统下的流程,不是只能查询本系统下的流程
|
||||
boolean isebpmAdmin =(Boolean) request.getSession().getAttribute(BaseUser.ROLE_EBPMADMIN);
|
||||
String appId = "";
|
||||
//不是系统管理员,从session中取出系统ID
|
||||
if(!isebpmAdmin){
|
||||
appId = request.getSession().getAttribute(MyContants.APP_ID_KEY).toString();
|
||||
searchProcessResource.setApplicationId(appId);
|
||||
}
|
||||
//系统ID
|
||||
appId = searchProcessResource.getApplicationId();
|
||||
|
||||
String resourceId = searchProcessResource.getResourceId();
|
||||
|
||||
//资源类型:分为三种(角色role、组织org、人员user)
|
||||
String resourceType = searchProcessResource.getResourceType();
|
||||
|
||||
//map返回结果,tenantId、proceDefId、procDefName、activityId、activityName
|
||||
List<Map<String,String>> inProcess = processDefinitionService.findProcessDefsByResource(appId,"",resourceType,resourceId);
|
||||
ModelAndView result = new ModelAndView("/searchProcessResource/list");
|
||||
|
||||
//回显资源编码和资源类型值
|
||||
result.addObject("searchProcessResource", searchProcessResource);
|
||||
|
||||
result.addObject("inProcess", inProcess);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索(根据用户选择的系统ID、资源ID和资源类型查询流程)
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "errorlistindex")
|
||||
public ModelAndView errorlistindex(SearchProcessResource searchProcessResource,HttpServletRequest request) throws Exception {
|
||||
/*//判断是否为系统管理员,是:显示系统编码文本框可以查询所有系统下的流程,不是只能查询本系统下的流程
|
||||
boolean isebpmAdmin =(Boolean) request.getSession().getAttribute(BaseUser.ROLE_EBPMADMIN);
|
||||
*/String appId = "";
|
||||
//不是系统管理员,从session中取出系统ID
|
||||
//if(!isebpmAdmin){
|
||||
appId = request.getSession().getAttribute(MyContants.APP_ID_KEY).toString();
|
||||
searchProcessResource.setApplicationId(appId);
|
||||
//}
|
||||
//系统ID
|
||||
appId = searchProcessResource.getApplicationId();
|
||||
|
||||
ModelAndView result = new ModelAndView("/searchProcessResource/errorlist");
|
||||
|
||||
//回显资源编码和资源类型值
|
||||
result.addObject("searchProcessResource", null);
|
||||
|
||||
result.addObject("inProcess", null);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索(根据用户选择的系统ID、资源ID和资源类型查询流程)
|
||||
* @throws Exception
|
||||
**/
|
||||
@RequestMapping(value = "errorlist")
|
||||
public ModelAndView errorlist(SearchProcessResource searchProcessResource,HttpServletRequest request) throws Exception {
|
||||
/*//判断是否为系统管理员,是:显示系统编码文本框可以查询所有系统下的流程,不是只能查询本系统下的流程
|
||||
boolean isebpmAdmin =(Boolean) request.getSession().getAttribute(BaseUser.ROLE_EBPMADMIN);
|
||||
*/String appId = "";
|
||||
//不是系统管理员,从session中取出系统ID
|
||||
//if(!isebpmAdmin){
|
||||
appId = request.getSession().getAttribute(MyContants.APP_ID_KEY).toString();
|
||||
searchProcessResource.setApplicationId(appId);
|
||||
//}
|
||||
//系统ID
|
||||
appId = searchProcessResource.getApplicationId();
|
||||
|
||||
|
||||
//map返回结果,tenantId、proceDefId、procDefName、activityId、activityName
|
||||
List<Map<String,Object>> inProcess = new ArrayList<Map<String,Object>>();
|
||||
ModelAndView result = new ModelAndView("/searchProcessResource/errorlist");
|
||||
|
||||
//回显资源编码和资源类型值
|
||||
result.addObject("searchProcessResource", searchProcessResource);
|
||||
|
||||
result.addObject("inProcess", inProcess);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.CallActivity;
|
||||
import org.activiti.bpmn.model.ExpandProperty;
|
||||
import org.activiti.bpmn.model.FlowElement;
|
||||
import org.activiti.bpmn.model.GraphicInfo;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
import org.activiti.bpmn.model.Task;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.util.ProcessModelUtils;
|
||||
import com.blueland.bpm.manage.util.ComparatorTransition;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/sequenceFlow")
|
||||
public class SequenceFlowController extends BaseProcessController{
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(String procDefId,String actId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/sequenceFlow/list");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
FlowElement flowElement=bpmnModel.getFlowElement(actId);
|
||||
Task task =null;
|
||||
CallActivity callActivity =null;
|
||||
List<SequenceFlow> sequenceFlows=null;
|
||||
if(flowElement instanceof Task){
|
||||
task = (Task)bpmnModel.getFlowElement(actId);
|
||||
sequenceFlows=task.getOutgoingFlows();
|
||||
}else if(flowElement instanceof CallActivity){
|
||||
callActivity = (CallActivity)bpmnModel.getFlowElement(actId);
|
||||
sequenceFlows=callActivity.getOutgoingFlows();
|
||||
}
|
||||
Collections.sort(sequenceFlows,new ComparatorTransition());
|
||||
for (SequenceFlow sequenceFlow : sequenceFlows) {
|
||||
sequenceFlow.setSourceRefName(bpmnModel.getFlowElement(sequenceFlow.getSourceRef()).getName());
|
||||
sequenceFlow.setTargetRefName(bpmnModel.getFlowElement(sequenceFlow.getTargetRef()).getName());
|
||||
}
|
||||
modelAndView.addObject("userTask", task instanceof UserTask?(UserTask)task:flowElement);
|
||||
modelAndView.addObject("procDefId", procDefId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView editSequenceFlow(String procDefId,String sequenceFlowId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/sequenceFlow/edit");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
initExpandProperties(sequenceFlow);
|
||||
ProcessModelUtils.filterExpandProperties(sequenceFlow);
|
||||
modelAndView.addObject("sequenceFlow", sequenceFlow);
|
||||
ExpandProperty nextActAliasEx=ProcessModelUtils.findExpandProperties(sequenceFlow.getExpandProperties(), "TRANSITION_NEXTACT_ALIAS");
|
||||
if(nextActAliasEx!=null) {
|
||||
modelAndView.addObject("nextActAlias", nextActAliasEx.getValue());
|
||||
}
|
||||
modelAndView.addObject("procDefId", procDefId);
|
||||
modelAndView.addObject("activitys", processDefinitionService.getProcessUserActivitys(procDefId));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "update")
|
||||
@ResponseBody
|
||||
public String updateSequenceFlow(String procDefId,SequenceFlow params,String nextActAlias) {
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(params.getId());
|
||||
sequenceFlow.setACTIVITY_USER_SAME_ORG_LEVEL(params.getACTIVITY_USER_SAME_ORG_LEVEL());
|
||||
sequenceFlow.setTRANSITION_DISPLAY_ORDER(params.getTRANSITION_DISPLAY_ORDER());
|
||||
sequenceFlow.setTRANSITION_RETURN_FORMER(params.getTRANSITION_RETURN_FORMER());
|
||||
sequenceFlow.setName(params.getName());
|
||||
sequenceFlow.setConditionExpression(params.getConditionExpression());
|
||||
ProcessModelUtils.addExpandProperties(sequenceFlow,"ACTIVITY_USER_SAME_ORG_LEVEL",sequenceFlow.getACTIVITY_USER_SAME_ORG_LEVEL(),"ACTIVITY_USER_SAME_ORG_LEVEL");
|
||||
ProcessModelUtils.addExpandProperties(sequenceFlow,"TRANSITION_DISPLAY_ORDER",sequenceFlow.getTRANSITION_DISPLAY_ORDER(),"TRANSITION_DISPLAY_ORDER");
|
||||
ProcessModelUtils.addExpandProperties(sequenceFlow,"TRANSITION_RETURN_FORMER",sequenceFlow.getTRANSITION_RETURN_FORMER(),"TRANSITION_RETURN_FORMER");
|
||||
ProcessModelUtils.addExpandProperties(sequenceFlow,"TRANSITION_NEXTACT_ALIAS",nextActAlias,"TRANSITION_NEXTACT_ALIAS");
|
||||
|
||||
boolean isUpdateProcessImage=false;
|
||||
if(params.getName()==null&&sequenceFlow.getName()!=null){
|
||||
isUpdateProcessImage=true;
|
||||
}else if(sequenceFlow.getName()==null||params.getName()!=null){
|
||||
isUpdateProcessImage=true;
|
||||
}else if(!sequenceFlow.getName().equals(params.getName())){
|
||||
isUpdateProcessImage=true;
|
||||
}
|
||||
GraphicInfo graphicInfo=new GraphicInfo();
|
||||
graphicInfo.setX(0.0);
|
||||
graphicInfo.setY(0.0);
|
||||
graphicInfo.setHeight(0.0);
|
||||
graphicInfo.setWidth(0.0);
|
||||
bpmnModel.addLabelGraphicInfo(sequenceFlow.getId(), graphicInfo);
|
||||
boolean result=updateBpmnModel(bpmnModel,procDefId,isUpdateProcessImage);
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "createProperty")
|
||||
public ModelAndView createProperty(String procDefId,String sequenceFlowId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/sequenceFlow/property/create");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
modelAndView.addObject("sequenceFlow", sequenceFlow);
|
||||
modelAndView.addObject("procDefId", procDefId);
|
||||
return modelAndView;
|
||||
}
|
||||
@RequestMapping(value = "saveProperty")
|
||||
@ResponseBody
|
||||
public String saveProperty(String procDefId,String sequenceFlowId,ExpandProperty expandProperty) {
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
List<ExpandProperty> expandPropertys= sequenceFlow.getExpandProperties();
|
||||
expandPropertys.add(expandProperty);
|
||||
boolean result=updateBpmnModel(bpmnModel,procDefId,false);
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "editProperty")
|
||||
public ModelAndView editProperty(String procDefId,String sequenceFlowId,String expandPropertyId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/sequenceFlow/property/edit");
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
ExpandProperty editExpandProperty=ProcessModelUtils.findExpandProperties(sequenceFlow.getExpandProperties(),expandPropertyId);
|
||||
modelAndView.addObject("sequenceFlow", sequenceFlow);
|
||||
modelAndView.addObject("expandProperty", editExpandProperty);
|
||||
modelAndView.addObject("procDefId", procDefId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateProperty")
|
||||
@ResponseBody
|
||||
public String updateProperty(String procDefId,String sequenceFlowId,ExpandProperty expandProperty) {
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
ProcessModelUtils.removeExpandProperties(sequenceFlow.getExpandProperties(),expandProperty.getId());
|
||||
sequenceFlow.getExpandProperties().add(expandProperty);
|
||||
boolean result=updateBpmnModel(bpmnModel,procDefId,false);
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteProperty")
|
||||
@ResponseBody
|
||||
public String deleteProperty(String procDefId,String id,String[] expandPropertyIds) {
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(id);
|
||||
for (String expandPropertyId : expandPropertyIds) {
|
||||
ProcessModelUtils.removeExpandProperties(sequenceFlow.getExpandProperties(),expandPropertyId);
|
||||
}
|
||||
boolean result=updateBpmnModel(bpmnModel,procDefId,false);
|
||||
return result?this.ACTION_SUCCESS:this.ACTION_ERROR;
|
||||
}
|
||||
/**
|
||||
* 查看输出线描述
|
||||
* @param procDefId
|
||||
* @param sequenceFlowId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "viewDescription")
|
||||
@ResponseBody
|
||||
public Map<String,Object> viewDescription(String procDefId,String sequenceFlowId) {
|
||||
Map<String,Object> result = new HashMap<String,Object>();
|
||||
BpmnModel bpmnModel=processModelService.getBpmnModelByProcDefId(procDefId);
|
||||
SequenceFlow sequenceFlow=(SequenceFlow) bpmnModel.getFlowElement(sequenceFlowId);
|
||||
initExpandProperties(sequenceFlow);
|
||||
ProcessModelUtils.filterExpandProperties(sequenceFlow);
|
||||
result.put("sequenceFlow", sequenceFlow);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static void initExpandProperties(SequenceFlow sequenceFlow){
|
||||
ExpandProperty ACTIVITY_USER_SAME_ORG_LEVEL=ProcessModelUtils.findExpandProperties(sequenceFlow.getExpandProperties(), "ACTIVITY_USER_SAME_ORG_LEVEL");
|
||||
ExpandProperty TRANSITION_DISPLAY_ORDER=ProcessModelUtils.findExpandProperties(sequenceFlow.getExpandProperties(), "TRANSITION_DISPLAY_ORDER");
|
||||
ExpandProperty TRANSITION_RETURN_FORMER=ProcessModelUtils.findExpandProperties(sequenceFlow.getExpandProperties(), "TRANSITION_RETURN_FORMER");
|
||||
if(ACTIVITY_USER_SAME_ORG_LEVEL!=null&&StringUtils.isNotEmpty(ACTIVITY_USER_SAME_ORG_LEVEL.getValue())){
|
||||
sequenceFlow.setACTIVITY_USER_SAME_ORG_LEVEL(ACTIVITY_USER_SAME_ORG_LEVEL.getValue());
|
||||
}
|
||||
if(TRANSITION_DISPLAY_ORDER!=null&&StringUtils.isNotEmpty(TRANSITION_DISPLAY_ORDER.getValue())){
|
||||
sequenceFlow.setTRANSITION_DISPLAY_ORDER(TRANSITION_DISPLAY_ORDER.getValue());
|
||||
}
|
||||
if(TRANSITION_RETURN_FORMER!=null&&StringUtils.isNotEmpty(TRANSITION_RETURN_FORMER.getValue())){
|
||||
sequenceFlow.setTRANSITION_RETURN_FORMER(TRANSITION_RETURN_FORMER.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import java.sql.Struct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.model.ActivityResourceModel;
|
||||
import com.blueland.bpm.engine.core.model.ProcessDefinitionModel;
|
||||
import com.blueland.bpm.engine.core.service.ProcessDefinitionService;
|
||||
import com.blueland.bpm.engine.core.service.ProcessModelService;
|
||||
import com.blueland.bpm.engine.util.ProcessModelUtils;
|
||||
import com.blueland.bpm.identity.OrgService;
|
||||
import com.blueland.bpm.identity.RoleService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.Org;
|
||||
import com.blueland.bpm.identity.model.Role;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/actInfo/setActResource")
|
||||
public class SetActUserController extends BaseProcessController {
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private ProcessModelService processModelService;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private OrgService orgService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(String procDefId, String actId,String opDataSource) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/setActResource/list");
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(procDefId);
|
||||
UserTask userTask = ProcessModelUtils.findUserTask(bpmnModel, actId);
|
||||
List<ActivityResourceModel> activityResources=new ArrayList<ActivityResourceModel>();
|
||||
|
||||
for (String groupId : userTask.getCandidateGroups()) {
|
||||
Role role=roleService.getRoleById(groupId);
|
||||
String roleName = "<font color='red'>该角色已失效</font>";
|
||||
Integer sort = 0;
|
||||
if(role != null&&role.getRoleName()!=null) {
|
||||
roleName = role.getRoleName();
|
||||
}if(role != null&&role.getRoleSort()!=null) {
|
||||
sort = role.getRoleSort();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(groupId,"角色",roleName,0,"ROLE", sort);
|
||||
actitityResource.setRemark(groupId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
for (String orgId : userTask.getCandidateOrgs()) {
|
||||
Org org=orgService.getOrgById(orgId);
|
||||
String orgName = "<font color='red'>该组组已失效</font>";
|
||||
int sort = 0;
|
||||
if(org != null) {
|
||||
orgName = orgService.getFullPathName(orgId,"/");
|
||||
if(StringUtils.isEmpty(orgName)) //fullpath只到公司,当绑定集团的时候,显示集团名称
|
||||
orgName = org.getOrgName();
|
||||
sort = org.getOrgSort();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(orgId,"组织",orgName,0,"ORG", sort);
|
||||
actitityResource.setRemark(orgId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
for (String userId : userTask.getCandidateUsers()) {
|
||||
User user=userService.getUserById(userId);
|
||||
String userName = "<font color='red'>该人员已失效</font>";
|
||||
String userCode=userId;
|
||||
int sort = 0;
|
||||
if(user != null && StrUtil.isNotEmpty(user.getUserId())){
|
||||
Org org = orgService.getOrgById(user.getOrgId());
|
||||
sort = user.getUserSort();
|
||||
if(org != null) {
|
||||
userName = orgService.getFullPathName(org.getOrgId(),"/") +"/"+ user.getUserName();
|
||||
}else{
|
||||
userName ="<font color='red'>组织无效</font>/"+ user.getUserName();
|
||||
}
|
||||
userCode=user.getUserCode();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(userId,"人员",userName,0,"USER", sort);
|
||||
actitityResource.setRemark(userId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
modelAndView.addObject("activityResources", activityResources);
|
||||
modelAndView.addObject("userTask", userTask);
|
||||
modelAndView.addObject("procDefId", procDefId);
|
||||
modelAndView.addObject("opDataSource",opDataSource);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "setAllResourcelist")
|
||||
public ModelAndView setAllResourcelist(String processDefId) {
|
||||
ModelAndView modelAndView = new ModelAndView(
|
||||
"/actInfo/setActResource/allResourceslist");
|
||||
if(StringUtils.isEmpty(processDefId)) {
|
||||
return new ModelAndView("/procDefModelMgr/info");
|
||||
}
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(processDefId);
|
||||
List<ActivityInfoConfig> actInfoConfigs = activityInfoConfigManager
|
||||
.findActivityInfoConfigs(processDefId);
|
||||
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
|
||||
for (ActivityInfoConfig actInfoConfig : actInfoConfigs) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
List<ActivityResourceModel> activityResources = new ArrayList<ActivityResourceModel>();
|
||||
UserTask userTask = ProcessModelUtils.findUserTask(bpmnModel,
|
||||
actInfoConfig.getActivityDefId());
|
||||
if (null != userTask) {
|
||||
for (String groupId : userTask.getCandidateGroups()) {
|
||||
Role role=roleService.getRoleById(groupId);
|
||||
String roleName = "<font color='red'>该角色已失效</font>";
|
||||
Integer sort = 0;
|
||||
if(role != null&&role.getRoleName()!=null) {
|
||||
roleName = role.getRoleName();
|
||||
}if(role != null&&role.getRoleSort()!=null) {
|
||||
sort = role.getRoleSort();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(groupId,"角色",roleName,0,"ROLE", sort);
|
||||
actitityResource.setRemark(groupId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
for (String orgId : userTask.getCandidateOrgs()) {
|
||||
Org org=orgService.getOrgById(orgId);
|
||||
String orgName = "<font color='red'>该组组已失效</font>";
|
||||
int sort = 0;
|
||||
if(org != null) {
|
||||
orgName = orgService.getFullPathName(orgId,"/");
|
||||
if(StringUtils.isEmpty(orgName)) //fullpath只到公司,当绑定集团的时候,显示集团名称
|
||||
orgName = org.getOrgName();
|
||||
sort = org.getOrgSort();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(orgId,"组织",orgName,0,"ORG", sort);
|
||||
actitityResource.setRemark(orgId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
for (String userId : userTask.getCandidateUsers()) {
|
||||
User user=userService.getUserById(userId);
|
||||
String userName = "<font color='red'>该人员已失效</font>";
|
||||
String userCode=userId;
|
||||
int sort = 0;
|
||||
if(user!=null && StrUtil.isNotEmpty(user.getUserId())){
|
||||
Org org = orgService.getOrgById(user.getOrgId());
|
||||
sort = user.getUserSort();
|
||||
if(org != null) {
|
||||
userName = orgService.getFullPathName(org.getOrgId(),"/") +"/"+ user.getUserName();
|
||||
}else{
|
||||
userName ="<font color='red'>组织无效</font>/"+ user.getUserName();
|
||||
}
|
||||
userCode=user.getUserCode();
|
||||
}
|
||||
ActivityResourceModel actitityResource=new ActivityResourceModel(userId,"人员",userName,0,"USER", sort);
|
||||
actitityResource.setRemark(userId);
|
||||
activityResources.add(actitityResource);
|
||||
}
|
||||
|
||||
|
||||
map.put("userTask", userTask);
|
||||
map.put("activityResources", activityResources);
|
||||
result.add(map);
|
||||
} else {
|
||||
// 这里除去用户任务的其他节点 不需要分配人员和角色,所以查询出来的userTask为空,在这里相当于排除掉这些节点
|
||||
System.out.println(actInfoConfig.getActivityDefId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
modelAndView.addObject("result", result);
|
||||
// modelAndView.addObject("activityResources", activityResources);
|
||||
// modelAndView.addObject("userTask", userTask);
|
||||
modelAndView.addObject("procDefId", processDefId);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(String procDefId, String actId, String resourceStr) {
|
||||
Set<String> orgs = new HashSet<String>();
|
||||
Set<String> users = new HashSet<String>();
|
||||
Set<String> groups = new HashSet<String>();
|
||||
// List<String> orgs = new ArrayList<String>();
|
||||
// List<String> users = new ArrayList<String>();
|
||||
// List<String> groups = new ArrayList<String>();
|
||||
if (StringUtils.isEmpty(resourceStr)) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
String[] resources = null;
|
||||
if (resourceStr.indexOf(",") != -1) {
|
||||
resources = resourceStr.split(",");
|
||||
} else {
|
||||
resources = new String[] { resourceStr };
|
||||
}
|
||||
if (resources == null || resources.length <= 0) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
for (String allResource : resources) {
|
||||
String[] temp = allResource.split("#");
|
||||
String resourceType = temp[0];
|
||||
String resourceId = temp[1];
|
||||
if ("ORG".equals(resourceType)) {
|
||||
orgs.add(resourceId);
|
||||
} else if ("USER".equals(resourceType)) {
|
||||
users.add(resourceId);
|
||||
} else if ("ROLE".equals(resourceType)) {
|
||||
groups.add(resourceId);
|
||||
}
|
||||
}
|
||||
if (groups.isEmpty() && users.isEmpty() && orgs.isEmpty()) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
boolean result = addActResource(procDefId, actId, orgs, groups, users);
|
||||
return result ? this.ACTION_SUCCESS : this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(String procDefId, String actId, String[] resources
|
||||
,HttpServletRequest request) {
|
||||
List<String> orgs = new ArrayList<String>();
|
||||
List<String> users = new ArrayList<String>();
|
||||
List<String> groups = new ArrayList<String>();
|
||||
if (resources == null || resources.length <= 0) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
for (String allResource : resources) {
|
||||
String[] temp = allResource.split("#");
|
||||
String resourceType = temp[0];
|
||||
String resourceId = temp[1];
|
||||
if ("ORG".equals(resourceType)) {
|
||||
orgs.add(resourceId);
|
||||
} else if ("USER".equals(resourceType)) {
|
||||
users.add(resourceId);
|
||||
} else if ("ROLE".equals(resourceType)) {
|
||||
groups.add(resourceId);
|
||||
}
|
||||
}
|
||||
if (groups.isEmpty() && users.isEmpty() && orgs.isEmpty()) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
boolean result = deleteActResource(procDefId, actId, orgs, groups,
|
||||
users);
|
||||
MyContants.saveUserOperate(request,"procDefId;actId,resources",
|
||||
result, result?"删除成功":"删除失败",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return result ? this.ACTION_SUCCESS : this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteForResourcesManage")
|
||||
@ResponseBody
|
||||
public String deleteForResourcesManage(String procDefId, String actId, String resources
|
||||
,HttpServletRequest request) {
|
||||
List<String> orgs = new ArrayList<String>();
|
||||
List<String> users = new ArrayList<String>();
|
||||
List<String> groups = new ArrayList<String>();
|
||||
String[] resourcesArr = resources.split(",");
|
||||
if (resourcesArr == null || resourcesArr.length <= 0) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
for (String allResource : resourcesArr) {
|
||||
String[] temp = allResource.split("#");
|
||||
String resourceType = temp[0];
|
||||
String resourceId = temp[1];
|
||||
if ("ORG".equals(resourceType)) {
|
||||
orgs.add(resourceId);
|
||||
} else if ("USER".equals(resourceType)) {
|
||||
users.add(resourceId);
|
||||
} else if ("ROLE".equals(resourceType)) {
|
||||
groups.add(resourceId);
|
||||
}
|
||||
}
|
||||
if (groups.isEmpty() && users.isEmpty() && orgs.isEmpty()) {
|
||||
return this.ACTION_ERROR;
|
||||
}
|
||||
boolean result = deleteActResource(procDefId, actId, orgs, groups,
|
||||
users);
|
||||
|
||||
MyContants.saveUserOperate(request,"procDefId;actId,resources",
|
||||
result, result?"删除成功":"删除失败",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return result ? this.ACTION_SUCCESS : this.ACTION_ERROR;
|
||||
}
|
||||
|
||||
private boolean addActResource(String procDefId, String actId,
|
||||
Set<String> orgs, Set<String> groups, Set<String> users) {
|
||||
// private boolean addActResource(String procDefId, String actId,
|
||||
// List<String> orgs, List<String> groups, List<String> users) {
|
||||
boolean result = false;
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDef(procDefId);
|
||||
if (processDefinition == null) {
|
||||
return result;
|
||||
}
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(procDefId);
|
||||
UserTask userTask = ProcessModelUtils.findUserTask(bpmnModel, actId);
|
||||
if (orgs != null && !orgs.isEmpty()) {
|
||||
orgs.addAll(userTask.getCandidateOrgs());
|
||||
List<String> orgIds = new ArrayList<String>();
|
||||
orgIds.addAll(orgs);
|
||||
userTask.setCandidateOrgs(orgIds);
|
||||
// userTask.getCandidateOrgs().addAll(orgs);
|
||||
}
|
||||
if (groups != null && !groups.isEmpty()) {
|
||||
groups.addAll(userTask.getCandidateGroups());
|
||||
List<String> groupIds = new ArrayList<String>();
|
||||
groupIds.addAll(groups);
|
||||
userTask.setCandidateGroups(groupIds);
|
||||
// userTask.getCandidateGroups().addAll(groups);
|
||||
}
|
||||
if (users != null && !users.isEmpty()) {
|
||||
users.addAll(userTask.getCandidateUsers());
|
||||
List<String> userIds = new ArrayList<String>();
|
||||
userIds.addAll(users);
|
||||
userTask.setCandidateUsers(userIds);
|
||||
// userTask.getCandidateUsers().addAll(users);
|
||||
}
|
||||
return updateBpmnModel(
|
||||
bpmnModel, processDefinition, false);
|
||||
|
||||
}
|
||||
|
||||
private boolean deleteActResource(String procDefId, String actId,
|
||||
List<String> orgs, List<String> groups, List<String> users) {
|
||||
boolean result = false;
|
||||
ProcessDefinitionModel processDefinition = processDefinitionService
|
||||
.getProcessDef(procDefId);
|
||||
if (processDefinition == null) {
|
||||
return result;
|
||||
}
|
||||
BpmnModel bpmnModel = processModelService
|
||||
.getBpmnModelByProcDefId(procDefId);
|
||||
UserTask userTask = ProcessModelUtils.findUserTask(bpmnModel, actId);
|
||||
if (orgs != null && !orgs.isEmpty()) {
|
||||
userTask.getCandidateOrgs().removeAll(orgs);
|
||||
}
|
||||
if (groups != null && !groups.isEmpty()) {
|
||||
userTask.getCandidateGroups().removeAll(groups);
|
||||
}
|
||||
if (users != null && !users.isEmpty()) {
|
||||
userTask.getCandidateUsers().removeAll(users);
|
||||
}
|
||||
return updateBpmnModel(
|
||||
bpmnModel, processDefinition, false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
import com.blueland.bpm.engine.config.model.SmsConfig;
|
||||
import com.blueland.bpm.engine.config.service.SmsConfigService;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "smsConfig")
|
||||
public class SmsConfigController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private SmsConfigService smsConfigService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/smsConfig/list.do";
|
||||
/**
|
||||
* 日志 服务
|
||||
*/
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
public SmsConfigController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(SmsConfig query,HttpServletRequest request) {
|
||||
Page page = this.smsConfigService.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/smsConfig/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(String smsid,HttpServletRequest request) {
|
||||
SmsConfig smsConfig = (SmsConfig)smsConfigService.getById(smsid);
|
||||
return new ModelAndView("/smsConfig/show","smsConfig",smsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(SmsConfig smsConfig,HttpServletRequest request) {
|
||||
String userId = request.getParameter("userId");
|
||||
User user = userService.getUserByCode(userId);
|
||||
smsConfig.setMobile(user.getUserMobile());
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setAppTypes("('task')");
|
||||
List<ApplicationEntity> appList = applicationManager.findByExample(application);
|
||||
smsConfig.setAppList(appList);
|
||||
return new ModelAndView("/smsConfig/create","smsConfig",smsConfig);
|
||||
}
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "backCreate")
|
||||
public ModelAndView backCreate(HttpServletRequest request,SmsConfig smsConfig,String userId){
|
||||
ModelAndView result = new ModelAndView("/smsConfig/create");
|
||||
User user = userService.getUserByCode(userId);
|
||||
smsConfig.setMobile(user.getUserMobile());
|
||||
ApplicationEntity application = new ApplicationEntity();
|
||||
application.setAppTypes("('task')");
|
||||
List<ApplicationEntity> appList = applicationManager.findByExample(application);
|
||||
smsConfig.setAppList(appList);
|
||||
List<SmsConfig> SmsConfigList = smsConfigService.findByExample(smsConfig);
|
||||
String apps = "";
|
||||
Integer existApp = 0;
|
||||
for(SmsConfig exsitSmsConfig:SmsConfigList){
|
||||
if(StringUtils.isEmpty(apps)){
|
||||
apps = exsitSmsConfig.getAppEname()+",";
|
||||
}else{
|
||||
apps = apps+exsitSmsConfig.getAppEname()+",";
|
||||
}
|
||||
existApp++;
|
||||
smsConfig.setWeekday(exsitSmsConfig.getWeekday());
|
||||
if(StringUtils.isNotEmpty(exsitSmsConfig.getTimezone())){
|
||||
smsConfig.setTimeStart(exsitSmsConfig.getTimezone().split("-")[0]);
|
||||
smsConfig.setTimeEnd(exsitSmsConfig.getTimezone().split("-")[1]);
|
||||
}
|
||||
}
|
||||
result.addObject("apps", apps);
|
||||
result.addObject("smsConfig",smsConfig);
|
||||
result.addObject("existApp", existApp);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
@ResponseBody
|
||||
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
|
||||
public Map save(SmsConfig smsConfig,HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
Map result = new HashMap();
|
||||
result.put("success",true);
|
||||
List<String> appNameList = smsConfig.getAppNameList();
|
||||
|
||||
if(StringUtils.isNotEmpty(smsConfig.getWeekday()) && StringUtils.isNotEmpty(smsConfig.getTimezone())
|
||||
&& appNameList.size()>0){
|
||||
SmsConfig existSmsConfig = new SmsConfig();
|
||||
existSmsConfig.setUserId(smsConfig.getUserId());
|
||||
smsConfigService.delete(existSmsConfig);
|
||||
logger.info(String.format("删除用户的短信设置,用户:[%s]",
|
||||
existSmsConfig.getUserId()));
|
||||
for(String appName :appNameList){
|
||||
try{
|
||||
if(StringUtils.isNotEmpty(appName)){
|
||||
smsConfig.setAppEname(appName);
|
||||
smsConfigService.save(smsConfig);
|
||||
logger.info(String.format("开始保存短信配置,用户:[%s],时间段:[%s],星期几:[%s],系统简写:[%s],流程定义id[%s]",
|
||||
smsConfig.getUserId(),smsConfig.getTimezone(),smsConfig.getWeekday(),smsConfig.getAppEname(),
|
||||
smsConfig.getProcessDefId()));
|
||||
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error(String.format("短信配置失败,用户:[%s],时间段:[%s],星期几:[%s],系统简写:[%s],流程定义id[%s]",smsConfig.getUserId(),
|
||||
smsConfig.getTimezone(),smsConfig.getWeekday(),smsConfig.getAppEname(),smsConfig.getProcessDefId()),e);
|
||||
result.put("success",false);
|
||||
}
|
||||
|
||||
}
|
||||
logger.info(String.format("用户[%s]的短信配置保存完毕!",smsConfig.getUserId()));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(String smsid,HttpServletRequest request) {
|
||||
SmsConfig smsConfig = (SmsConfig)smsConfigService.getById(smsid);
|
||||
return new ModelAndView("/smsConfig/edit","smsConfig",smsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(SmsConfig smsConfig,HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String id = request.getParameter("smsid");
|
||||
smsConfigService.update(smsConfig);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
String id = new String((String)params.get("smsId"));
|
||||
smsConfigService.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.common.util.HttpUtils;
|
||||
/**
|
||||
* @author lw
|
||||
* @version 1.0
|
||||
* @since
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.blueland.bpm.engine.config.model.SmsConfigLog;
|
||||
import com.blueland.bpm.engine.config.service.SmsConfigLogService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "smsConfigLog")
|
||||
public class SmsConfigLogController extends BaseSpringController{
|
||||
//默认多列排序,example: username desc,createTime asc
|
||||
protected static final String DEFAULT_SORT_COLUMNS = null;
|
||||
@Autowired
|
||||
private SmsConfigLogService smsConfigLogService;
|
||||
|
||||
private final String LIST_ACTION = "redirect:/smsConfigLog/list.do";
|
||||
|
||||
public SmsConfigLogController() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加了@ModelAttribute的方法可以在本controller的方法调用前执行,可以存放一些共享变量,如枚举值
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void init(ModelMap model) {
|
||||
//model.put("now", new java.sql.Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "list")
|
||||
public ModelAndView list(SmsConfigLog query,HttpServletRequest request) {
|
||||
try {
|
||||
if(!BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request))||StringUtils.isEmpty(query.getAppId())){
|
||||
String loginUserAppId = BaseUser.getInstance().getLoginUserAppId(request);
|
||||
query.setAppId(loginUserAppId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(query.getStartTime() == null ) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DATE, 1);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
query.setEndTime(cal.getTime());
|
||||
cal.add(Calendar.DATE, -1);
|
||||
query.setStartTime(cal.getTime());
|
||||
}
|
||||
query.setSortColumns("CREATE_TIME desc");
|
||||
Page page = this.smsConfigLogService.findPage(query);
|
||||
ModelAndView result = new ModelAndView("/smsConfigLog/list");
|
||||
result.addAllObjects(toModelMap(page, query));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看对象
|
||||
**/
|
||||
@RequestMapping(value = "show")
|
||||
public ModelAndView show(String logid,HttpServletRequest request) {
|
||||
SmsConfigLog smsConfigLog = (SmsConfigLog)smsConfigLogService.getById(logid);
|
||||
return new ModelAndView("/smsConfigLog/show","smsConfigLog",smsConfigLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入新增页面
|
||||
**/
|
||||
@RequestMapping(value = "create")
|
||||
public ModelAndView create(SmsConfigLog smsConfigLog,HttpServletRequest request) {
|
||||
return new ModelAndView("/smsConfigLog/create","smsConfigLog",smsConfigLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存新增对象
|
||||
**/
|
||||
@RequestMapping(value = "save")
|
||||
public ModelAndView save(SmsConfigLog smsConfigLog,HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
smsConfigLogService.save(smsConfigLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, CREATED_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入更新页面
|
||||
**/
|
||||
@RequestMapping(value = "edit")
|
||||
public ModelAndView edit(String logid,HttpServletRequest request) {
|
||||
SmsConfigLog smsConfigLog = (SmsConfigLog)smsConfigLogService.getById(logid);
|
||||
return new ModelAndView("/smsConfigLog/edit","smsConfigLog",smsConfigLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存更新对象
|
||||
**/
|
||||
@RequestMapping(value = "update")
|
||||
public ModelAndView update(SmsConfigLog smsConfigLog,HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String id = request.getParameter("logid");
|
||||
smsConfigLogService.update(smsConfigLog);
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, UPDATE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
/**
|
||||
*删除对象
|
||||
**/
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(HttpServletRequest request,RedirectAttributes redirectAttributes) {
|
||||
String[] items = request.getParameterValues("items");
|
||||
for(int i = 0; i < items.length; i++) {
|
||||
Hashtable params = HttpUtils.parseQueryString(items[i]);
|
||||
|
||||
String id = new String((String)params.get("logid"));
|
||||
|
||||
smsConfigLogService.removeById(id);
|
||||
}
|
||||
redirectAttributes.addFlashAttribute(ACTION_MESSAGE, DELETE_SUCCESS);
|
||||
return new ModelAndView(LIST_ACTION);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,230 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
public class TreeNode {
|
||||
//private String tId;
|
||||
private String id;
|
||||
private String pId;
|
||||
private String name;
|
||||
private boolean checked;
|
||||
private boolean open;
|
||||
private boolean isParent;
|
||||
private String type;
|
||||
private String isAccessTopNode;
|
||||
private Integer level;
|
||||
private static final String pre_icon_path="/ebpm-process-manage/resource/js/plugins/zTree/";
|
||||
private String icon=pre_icon_path+"css/zTreeStyle/img/diy/1_open.png";
|
||||
|
||||
//private boolean isMulti;
|
||||
public static final String TOPORGIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/home.png";
|
||||
public static final String ORGIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_open.png";
|
||||
public static final String USERIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_openUser.png";
|
||||
public static final String GROUPIMAGE = pre_icon_path+"css/zTreeStyle/img/diy/1_openGroup.png";
|
||||
// 红勾选(流程未结束)
|
||||
public static final String TOPNOTFINISH = pre_icon_path+"css/zTreeStyle/img/diy/ico-agree1.png";
|
||||
//绿勾选(流程已结束)
|
||||
public static final String TOPFINISH = pre_icon_path+"css/zTreeStyle/img/diy/ico-agree.png";
|
||||
|
||||
public TreeNode(String id, String pId, String name, boolean checked, boolean open,boolean isParent,String type,String isAccessTopNode,Integer level) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = checked;
|
||||
this.open = open;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
this.isAccessTopNode=isAccessTopNode;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}
|
||||
this.level=level;
|
||||
//this.isMulti=isMulti;
|
||||
|
||||
}
|
||||
|
||||
public TreeNode(String id, String pId, String name,boolean isParent,String type) {
|
||||
super();
|
||||
this.id = id;
|
||||
//this.tId=id;
|
||||
this.pId = pId;
|
||||
this.name = name;
|
||||
this.checked = false;
|
||||
this.open = true;
|
||||
this.isParent = isParent;
|
||||
this.type=type;
|
||||
if(type.equals("TOPORG")){
|
||||
this.icon=TOPORGIMAGE;
|
||||
}else if(type.equals("ORG")){
|
||||
this.icon=ORGIMAGE;
|
||||
}else if(type.equals("USER")){
|
||||
this.icon=USERIMAGE;
|
||||
}else if(type.equals("NODEFINISH")){
|
||||
this.icon=TOPFINISH;
|
||||
}else if(type.equals("NODENOTFINISH")){
|
||||
this.icon=TOPNOTFINISH;
|
||||
}
|
||||
// this.isMulti=isMulti;
|
||||
|
||||
}
|
||||
|
||||
public TreeNode() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the checked
|
||||
*/
|
||||
public boolean getChecked() {
|
||||
return checked;
|
||||
}
|
||||
/**
|
||||
* @param checked the checked to set
|
||||
*/
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
/**
|
||||
* @return the open
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
return open;
|
||||
}
|
||||
/**
|
||||
* @param open the open to set
|
||||
*/
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
}
|
||||
/**
|
||||
* @return the pId
|
||||
*/
|
||||
public String getpId() {
|
||||
return pId;
|
||||
}
|
||||
/**
|
||||
* @param pId the pId to set
|
||||
*/
|
||||
public void setpId(String pId) {
|
||||
this.pId = pId;
|
||||
}
|
||||
/**
|
||||
* @return the isParent
|
||||
*/
|
||||
public boolean getIsParent() {
|
||||
return isParent;
|
||||
}
|
||||
/**
|
||||
* @param isParent the isParent to set
|
||||
*/
|
||||
public void setIsParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the isAccess
|
||||
*/
|
||||
public String getIsAccessTopNode() {
|
||||
return isAccessTopNode;
|
||||
}
|
||||
/**
|
||||
* @param isAccess the isAccess to set
|
||||
*/
|
||||
public void setIsAccessTopNode(String isAccessTopNode) {
|
||||
this.isAccessTopNode = isAccessTopNode;
|
||||
}
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
public void setParent(boolean isParent) {
|
||||
this.isParent = isParent;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
// public boolean isMulti() {
|
||||
// return isMulti;
|
||||
// }
|
||||
//
|
||||
// public void setMulti(boolean isMulti) {
|
||||
// this.isMulti = isMulti;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TreeNode other = (TreeNode) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.identity.UserService;
|
||||
import com.blueland.bpm.identity.model.User;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping(value = "/")
|
||||
public class UserLoginController extends BaseSpringController{
|
||||
protected static final String LOGIN_JSP = "redirect:/login.jsp";
|
||||
protected static final String INDEX_JSP = "redirect:/index.jsp";
|
||||
protected static final String SSO_INDEX_JSP = "redirect:/index.jsp";
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
private static final String bpaUrl = "http://192.168.1.199/bpm";
|
||||
//"http://192.168.1.4/bpm";
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/pages/user/login", produces="text/plain; charset=UTF-8")
|
||||
public String login(User query,HttpServletRequest request,HttpServletResponse response) {
|
||||
// String userId=request.getHeader("iv-user");
|
||||
// boolean isPortalAccess=false;
|
||||
// if(StringUtils.isEmpty(userId)){
|
||||
// userId=query.getUserId();
|
||||
// }else{
|
||||
// isPortalAccess=true;
|
||||
// }
|
||||
User user = userService.getUserById(query.getUserId());
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
System.out.println("用户登录返回的用户信息===>" + JSONUtil.toJsonStr(user));
|
||||
System.out.println("BaseUser===>" + bUser);
|
||||
if(user!=null && StrUtil.isNotEmpty(user.getUserId())){
|
||||
if(user.getUserPwd()==null||!user.getUserPwd().equals(request.getParameter("password"))) {
|
||||
return "密码错误!";
|
||||
}
|
||||
else {
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response, BaseUser.toUpperCase(user.getUserId()));
|
||||
List<ApplicationEntity> list=null;
|
||||
if(bUser.isEbpmAdmin(user)) {
|
||||
ApplicationEntity appQuery=new ApplicationEntity();
|
||||
appQuery.setAppType("inner");
|
||||
list = applicationManager.findByExample(appQuery);
|
||||
}else {
|
||||
list = applicationManager.selectByUserId(user.getUserId());
|
||||
}
|
||||
filter(list,"task");
|
||||
if(list.size() == 0) {
|
||||
return "您没有需要管理的应用!";
|
||||
}else {
|
||||
bUser.saveUserToSession(request,user, list);
|
||||
|
||||
//记录操作日志
|
||||
MyContants.saveUserOperate(request,"userId",true,"登陆成功",
|
||||
MyContants.LOGIN_SESSION_USER,MyContants.APPLICATION);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return "帐号不存在,请您重新登陆!";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/index")
|
||||
public String index(HttpServletRequest request,HttpServletResponse response) {
|
||||
String userId=request.getHeader("iv-user");
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
this.dealFlowBpa(request);
|
||||
if(!StringUtils.isEmpty(userId)) {
|
||||
User user=userService.getUserById(userId);
|
||||
List<ApplicationEntity> list=null;
|
||||
if(bUser.isEbpmAdmin(user)) {
|
||||
ApplicationEntity query=new ApplicationEntity();
|
||||
query.setAppType("inner");
|
||||
list = applicationManager.findByExample(query);
|
||||
}else {
|
||||
list = applicationManager.selectByUserId(userId);
|
||||
}
|
||||
filter(list,"task");
|
||||
if(list.size() == 0) {
|
||||
return "redirect:/login.jsp";
|
||||
}else {
|
||||
bUser.saveUserToSession(request,user, list);
|
||||
}
|
||||
}else {
|
||||
bUser = BaseUser.getInstance();
|
||||
try {
|
||||
if(bUser.getSessionUser(request)==null){
|
||||
return "redirect:/login.jsp";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return "redirect:/index.jsp";
|
||||
}
|
||||
/**
|
||||
* 拼写流程梳理地址
|
||||
* @param request
|
||||
*/
|
||||
private void dealFlowBpa(HttpServletRequest request) {
|
||||
HttpSession session=request.getSession(true);
|
||||
String token = "sa";
|
||||
Date date=new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = formatter.format(date);
|
||||
String secretkey = "2wersd99f81fl09ad13abcRT";
|
||||
String noncestr = GenerateRandomNumber(6);
|
||||
String str = noncestr+token+timestamp+secretkey;
|
||||
String signature =DigestUtils.md5DigestAsHex(str.getBytes()).toUpperCase();
|
||||
String bpaUrl = this.bpaUrl+"/?token=" + token+ "×tamp="+ timestamp+ "&noncestr="+ noncestr+ "&signature=" + signature;
|
||||
String bpmUrl = this.bpaUrl+"/?StartApp=2020/BPM&token=" + token+ "×tamp="+ timestamp+ "&noncestr="+ noncestr+ "&signature=" + signature;
|
||||
session.setAttribute("bpaUrl",bpaUrl);
|
||||
session.setAttribute("bpmUrl",bpmUrl);
|
||||
|
||||
}
|
||||
private static char[] constant ={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
|
||||
public String GenerateRandomNumber(int Length)
|
||||
{
|
||||
StringBuilder newRandom = new StringBuilder(62);
|
||||
Random rd = new Random();
|
||||
for (int i = 0; i < Length; i++)
|
||||
{
|
||||
newRandom.append(constant[rd.nextInt(62)]);
|
||||
}
|
||||
return newRandom.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**//*
|
||||
@ResponseBody
|
||||
@RequestMapping(value="login", produces="text/plain; charset=UTF-8")
|
||||
public String login(User query,HttpServletRequest request,HttpServletResponse response) {
|
||||
User user=userService.getUserById(query.getUserId());
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
if(user!=null){
|
||||
if(!user.getUserPwd().equals(request.getParameter("password"))) {
|
||||
return "密码错误!";
|
||||
}
|
||||
else {
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response, BaseUser.toUpperCase(user.getUserId()));
|
||||
List<ApplicationEntity> list = applicationManager.selectByUserId(query.getUserId());
|
||||
if(list.size() == 0) {
|
||||
return "您没有需要管理的应用!";
|
||||
}else {
|
||||
bUser.saveUserToSession(request,user, list);
|
||||
return ACTION_SUCCESS;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return "帐号不存在,请您重新登陆!";
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value="/pages/user/ssologin")
|
||||
public ModelAndView ssologin(User query,HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes) {
|
||||
ModelAndView result = new ModelAndView();
|
||||
User user=userService.getUserById(query.getUserId());
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
if(user!=null && StrUtil.isNotEmpty(user.getUserId())){
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response, BaseUser.toUpperCase(user.getUserId()));
|
||||
List<ApplicationEntity> list = applicationManager.selectByUserId(query.getUserId());
|
||||
filter(list,"task");
|
||||
bUser.saveUserToSession(request,user,list);
|
||||
result.setViewName(SSO_INDEX_JSP);
|
||||
}else{
|
||||
redirectAttributes.addFlashAttribute("login_msg","登陆失败,请您重新登陆!");
|
||||
result.setViewName(LOGIN_JSP);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/custom/sso")
|
||||
public ModelAndView customSso(User query, HttpServletRequest request, HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
ModelAndView result = new ModelAndView();
|
||||
User user = userService.getUserById(query.getUserId());
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
if(user != null && StrUtil.isNotEmpty(user.getUserId())){
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response, BaseUser.toUpperCase(user.getUserId()));
|
||||
List<ApplicationEntity> list = applicationManager.selectByUserId(query.getUserId());
|
||||
filter(list,"task");
|
||||
bUser.saveUserToSession(request,user,list);
|
||||
HttpSession session=request.getSession(true);
|
||||
session.setAttribute("customSso", true);
|
||||
result.setViewName(SSO_INDEX_JSP);
|
||||
}else{
|
||||
redirectAttributes.addFlashAttribute("login_msg","登陆失败,请您重新登陆!");
|
||||
result.setViewName(LOGIN_JSP);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value = "/pages/user/ssobacklogin")
|
||||
public void ssologin(String userId, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
response.setHeader("P3P","CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
|
||||
User user = userService.getUserById(userId);
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
if (user != null && StrUtil.isNotEmpty(user.getUserId())) {
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.setCookieUser(response,
|
||||
BaseUser.toUpperCase(user.getUserId()));
|
||||
bUser.saveUserToSession(request, user, new ArrayList(0));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 改变系统
|
||||
**/
|
||||
@RequestMapping(value="/pages/user/changeApp")
|
||||
@ResponseBody
|
||||
public void changeApp(String appId,HttpServletRequest request,HttpServletResponse response) {
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
ApplicationEntity application = applicationManager.getById(appId);
|
||||
bUser.saveLoginUserAppId(application, request);
|
||||
/*try {
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.getWriter().write("操作成功");
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行搜索
|
||||
**/
|
||||
@RequestMapping(value="/pages/user/logout")
|
||||
public ModelAndView logout(HttpServletRequest request,HttpServletResponse response) {
|
||||
ModelAndView result = new ModelAndView();
|
||||
BaseUser bUser = BaseUser.getInstance();
|
||||
bUser.cleanCookieUser(request, response);
|
||||
bUser.removeUserToSession(request);
|
||||
result.setViewName(LOGIN_JSP);
|
||||
return result;
|
||||
}
|
||||
public void filter(List<ApplicationEntity> list,String task){
|
||||
for (int i=0;i<list.size();i++) {
|
||||
if(list.get(i).getAppType()==null||list.get(i).getAppType().equals(task)){
|
||||
list.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,593 @@
|
||||
package com.blueland.bpm.manage.web;
|
||||
|
||||
import com.blueland.bpm.application.model.ApplicationEntity;
|
||||
import com.blueland.bpm.application.service.ApplicationManager;
|
||||
import com.blueland.bpm.common.base.BaseSpringController;
|
||||
import com.blueland.bpm.common.page.Page;
|
||||
import com.blueland.bpm.engine.config.model.ActivityInfoConfig;
|
||||
import com.blueland.bpm.engine.config.service.ActivityInfoConfigManager;
|
||||
import com.blueland.bpm.engine.core.model.SearchProcessListDTO;
|
||||
import com.blueland.bpm.engine.core.service.ProcessInstanceService;
|
||||
import com.blueland.bpm.manage.countAnalysis.service.AnalysisService;
|
||||
import com.blueland.bpm.manage.util.BaseUser;
|
||||
import com.blueland.bpm.manage.util.MyContants;
|
||||
import com.blueland.unitework.service.UniteworkService;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstanceQuery;
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 作者: 李立灿
|
||||
* 日期: 2018年10月22日
|
||||
* 时间: 2018年10月22日
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "sysMgr")
|
||||
public class sysMgrController extends BaseSpringController{
|
||||
@Autowired
|
||||
private ProcessInstanceService processInstanceService;
|
||||
@Autowired
|
||||
private ApplicationManager applicationManager;
|
||||
@Autowired
|
||||
private ActivityInfoConfigManager activityInfoConfigManager;
|
||||
@Autowired
|
||||
private AnalysisService analysisService;
|
||||
@Autowired
|
||||
private UniteworkService uniteworkService;
|
||||
|
||||
/**
|
||||
* 流程运行统计 查询
|
||||
**/
|
||||
@RequestMapping(value = "appProcessList")
|
||||
public ModelAndView appProcessList(HttpServletRequest request) throws Exception{
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
String searchYear = "";
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchMouth"))){
|
||||
System.out.println(getMonthEndTime(Integer.parseInt(request.getParameter("searchMouth"))));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getParameter("toSearchYear"))){
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchYear"))){
|
||||
searchYear = request.getParameter("searchYear");
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchMouth"))){
|
||||
int dayNum = getMonthEndTime(Integer.parseInt(request.getParameter("searchMouth")));
|
||||
startDate = searchYear + "-"+request.getParameter("searchMouth").toString()+"-01";
|
||||
endDate = searchYear + "-"+request.getParameter("searchMouth").toString()+"-"+dayNum;
|
||||
}else{
|
||||
startDate = searchYear + "-01-01";
|
||||
endDate = (Integer.parseInt(searchYear) + 1) + "-01-01";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Date nowDate = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
searchYear = format.format(nowDate);
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchMouth"))){
|
||||
int dayNum = getMonthEndTime(Integer.parseInt(request.getParameter("searchMouth")));
|
||||
startDate = searchYear + "-"+request.getParameter("searchMouth").toString()+"-01";
|
||||
endDate = searchYear + "-"+request.getParameter("searchMouth").toString()+"-"+dayNum;
|
||||
}else{
|
||||
startDate = searchYear + "-01-01";
|
||||
endDate = (Integer.parseInt(searchYear) + 1) + "-01-01";
|
||||
}
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", request.getParameter("appId"));
|
||||
params.put("searchYear", searchYear);
|
||||
params.put("searchMouth", request.getParameter("searchMouth"));
|
||||
params.put("startDate", startDate);
|
||||
params.put("endDate", endDate);
|
||||
List<Map<String , Object>> resultMap = analysisService.getAppProcessRunIndex(params);
|
||||
|
||||
int appSum = 0;
|
||||
int runtaskSum = 0;
|
||||
int procinstOneSum = 0;
|
||||
int procinstFiveSum = 0;
|
||||
int procdefSum = 0;
|
||||
for (Map<String, Object> map : resultMap) {
|
||||
appSum += 1;
|
||||
if(map.get("RUNTASKNUM") != null && map.get("RUNTASKNUM") != ""){
|
||||
runtaskSum += Integer.parseInt(map.get("RUNTASKNUM").toString());
|
||||
}
|
||||
if(map.get("PROCINSTONENUM") != null && map.get("PROCINSTONENUM") != ""){
|
||||
procinstOneSum += Integer.parseInt(map.get("PROCINSTONENUM").toString());
|
||||
}
|
||||
if(map.get("PROCINSTFIVENUM") != null && map.get("PROCINSTFIVENUM") != ""){
|
||||
procinstFiveSum += Integer.parseInt(map.get("PROCINSTFIVENUM").toString());
|
||||
}
|
||||
if(map.get("PROCDEFNUM") != null && map.get("PROCDEFNUM") != ""){
|
||||
procdefSum += Integer.parseInt(map.get("PROCDEFNUM").toString());
|
||||
}
|
||||
}
|
||||
params.put("appSum", appSum);
|
||||
params.put("runtaskSum", runtaskSum);
|
||||
params.put("procinstOneSum", procinstOneSum);
|
||||
params.put("procinstFiveSum", procinstFiveSum);
|
||||
params.put("procdefSum", procdefSum);
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
|
||||
ModelAndView result = new ModelAndView("/sysMgr/appProcessList");
|
||||
result.addObject("params", params);
|
||||
result.addObject("resultMap", resultMap);
|
||||
result.addObject("applicationList", applicationList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程实例查询
|
||||
**/
|
||||
@RequestMapping(value="/sysProcessInstList")
|
||||
public ModelAndView sysProcessInstlist(SearchProcessListDTO pageRequest,HttpServletRequest request) throws Exception {
|
||||
HistoricProcessInstanceQuery query=processInstanceService.getHistoryService().createHistoricProcessInstanceQuery();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,pageRequest, "");
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", request.getParameter("appId"));
|
||||
params.put("title", request.getParameter("title"));
|
||||
params.put("processInstanceId", request.getParameter("processInstanceId"));
|
||||
params.put("userId", request.getParameter("userId"));
|
||||
params.put("procState", request.getParameter("procState"));
|
||||
params.put("searchYear", request.getParameter("searchYear"));
|
||||
params.put("toSearchYear", request.getParameter("toSearchYear"));
|
||||
params.put("searchMouth", request.getParameter("searchMouth"));
|
||||
params.put("toProcState", request.getParameter("toProcState"));
|
||||
params.put("processDefName", request.getParameter("processDefName"));
|
||||
String toSearchYear = "";
|
||||
if(StringUtils.isNotEmpty(request.getParameter("toSearchYear"))){
|
||||
toSearchYear = request.getParameter("toSearchYear");
|
||||
}else if(StringUtils.isNotEmpty(request.getParameter("searchYear"))){
|
||||
toSearchYear = request.getParameter("searchYear");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pageRequest.getProcessDefName())) {
|
||||
query.processDefinitionName(request.getParameter("processDefName"));
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("toProcState"))) {
|
||||
query.procState(Integer.parseInt(request.getParameter("toProcState")));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("appId"))) {
|
||||
query.processInstanceTenantId(request.getParameter("appId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("title"))) {
|
||||
query.procTitle(request.getParameter("title"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("processInstanceId"))) {
|
||||
query.processInstanceId(request.getParameter("processInstanceId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("procState"))) {
|
||||
query.procState(Integer.parseInt(request.getParameter("procState")));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("userId"))) {
|
||||
query.startedBy(request.getParameter("userId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(toSearchYear)) {
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchMouth"))){
|
||||
int dayNum = getMonthEndTime(Integer.parseInt(request.getParameter("searchMouth")));
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String searchYear = toSearchYear + "-" + request.getParameter("searchMouth").toString()+"-01";
|
||||
String endDateStr = toSearchYear + "-" + request.getParameter("searchMouth").toString()+"-"+dayNum;
|
||||
Date startDate = format.parse(searchYear);
|
||||
Date endDate = format.parse(endDateStr);
|
||||
query.startedAfter(startDate);
|
||||
query.startedBefore(endDate);
|
||||
}else{
|
||||
if(StringUtils.isEmpty(request.getParameter("flag"))){
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
String searchYear = toSearchYear;
|
||||
String endDateStr = (Integer.parseInt(searchYear) + 1) + "";
|
||||
Date startDate = format.parse(searchYear);
|
||||
Date endDate = format.parse(endDateStr);
|
||||
query.startedAfter(startDate);
|
||||
query.startedBefore(endDate);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtils.isEmpty(request.getParameter("flag"))){
|
||||
Date nowDate = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
String searchYear = format.format(nowDate);
|
||||
String endDateStr = (Integer.parseInt(searchYear) + 1) + "";
|
||||
Date startDate = format.parse(searchYear);
|
||||
Date endDate = format.parse(endDateStr);
|
||||
query.startedAfter(startDate);
|
||||
query.startedBefore(endDate);
|
||||
params.put("searchYear", searchYear);
|
||||
params.put("searchMouth", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Page page = new Page(pageRequest, (int) query.count());
|
||||
List<HistoricProcessInstance> historicProcessInstances=query.orderByProcessInstanceStartTime().desc().listPage(page.getFirstResult(),page.getPageSize());
|
||||
page.setResult(historicProcessInstances);
|
||||
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
ModelAndView modelAndView = new ModelAndView("/sysMgr/sysProcessInstList");
|
||||
modelAndView.addObject("params", params);
|
||||
modelAndView.addObject("applicationList", applicationList);
|
||||
modelAndView.addObject("isBpmAdmin",BaseUser.isEbpmAdmin(BaseUser.getInstance().getSessionUser(request)));
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程待办查询
|
||||
**/
|
||||
@RequestMapping(value = "/sysTaskList")
|
||||
public ModelAndView sysTaskList(SearchProcessListDTO pageRequest, HttpServletRequest request) throws Exception {
|
||||
TaskQuery query = processInstanceService.getTaskService().createTaskQuery();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,pageRequest, "");
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", request.getParameter("appId"));
|
||||
params.put("title", request.getParameter("title"));
|
||||
params.put("processInstanceId", request.getParameter("processInstanceId"));
|
||||
params.put("processDefName", request.getParameter("processDefName"));
|
||||
params.put("assignee", request.getParameter("assignee"));
|
||||
params.put("actInstId", request.getParameter("actInstId"));
|
||||
params.put("actInstName", request.getParameter("actInstName"));
|
||||
params.put("toSearchYear", request.getParameter("toSearchYear"));
|
||||
params.put("taskDefName", request.getParameter("taskDefName"));
|
||||
if (StringUtils.isNotEmpty(request.getParameter("taskDefName"))) {
|
||||
query.preTaskDefName(request.getParameter("taskDefName"));
|
||||
}
|
||||
if ("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT) && (StringUtils.isNotEmpty(request.getParameter("appId")))) {
|
||||
query.taskTenantId(request.getParameter("appId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("title"))) {
|
||||
query.procTitle(request.getParameter("title"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("processInstanceId"))) {
|
||||
query.processInstanceId(request.getParameter("processInstanceId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("processDefName"))) {
|
||||
query.processDefinitionNameLike("%"+request.getParameter("processDefName")+"%");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("assignee"))) {
|
||||
query.taskAssignee(request.getParameter("assignee"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("actInstId"))) {
|
||||
query.taskId(request.getParameter("actInstId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("actInstName"))) {
|
||||
query.taskName(request.getParameter("actInstName"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("toSearchYear"))) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
String searchYear = request.getParameter("toSearchYear");
|
||||
String endDateStr = (Integer.parseInt(searchYear) + 1) + "";
|
||||
Date startDate = format.parse(searchYear);
|
||||
Date endDate = format.parse(endDateStr);
|
||||
query.taskCreatedAfter(startDate);
|
||||
query.taskCreatedBefore(endDate);
|
||||
}
|
||||
Page<Task> page = new Page<Task>(pageRequest, (int) query.count());
|
||||
List<Task> tasks = query.orderByTaskCreateTime().desc().listPage(page.getFirstResult(), page.getPageSize());
|
||||
page.setResult(tasks);
|
||||
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
ModelAndView modelAndView = new ModelAndView("/sysMgr/sysTaskList");
|
||||
modelAndView.addObject("params", params);
|
||||
modelAndView.addObject("applicationList", applicationList);
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流程接口调用时序
|
||||
**/
|
||||
@RequestMapping(value = "/appProcessLogByYear")
|
||||
public ModelAndView appProcessLogByYear(HttpServletRequest request) throws Exception {
|
||||
// String column = "{name: '个人印章使用申请',data: eval([0,0,0,0,0,0,0,0,0,4,0,0])},{name: '临时出入证申请',data: eval([0,0,0,0,0,0,0,0,0,9,0,0])},{name: '公务印章使用申请',data: eval([0,0,0,0,0,0,0,0,0,1,0,0])},{name: '收入证明申请',data: eval([0,0,0,0,0,0,0,0,0,2,0,0])},{name: '综合协调事项',data: eval([0,0,0,0,0,0,0,0,0,6,0,0])},{name: '请假',data: eval([0,0,0,0,0,0,0,0,0,2,0,0])},{name: '车辆出入证申请',data: eval([0,0,0,0,0,0,0,0,0,5,0,0])},";
|
||||
String column = "";
|
||||
String row = "";
|
||||
int total = 0;
|
||||
//获取横坐标数据
|
||||
List<String> monthList = initMonth();
|
||||
for (String month : monthList) {
|
||||
row += "'" + month + "月',";
|
||||
}
|
||||
if (!StringUtils.isEmpty(row)) {
|
||||
row = row.substring(0, row.length() - 1);
|
||||
}
|
||||
//获取流程接口调用时序总数
|
||||
String searchYear = "";
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchYear"))){
|
||||
searchYear = request.getParameter("searchYear");
|
||||
}else{
|
||||
Date nowDate = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
searchYear = format.format(nowDate);
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchYear", searchYear);
|
||||
params.put("appId", request.getParameter("appId"));
|
||||
List<Map<String , Object>> processLogResult = analysisService.getAppProcessLogByYear(params);
|
||||
|
||||
Map<String, List> resultMap = new LinkedHashMap<String, List>();
|
||||
for (Map<String , Object> result : processLogResult) {
|
||||
if (resultMap.containsKey(result.get("APPNAME"))) {
|
||||
List resultList = (List) resultMap.get(result.get("APPNAME"));
|
||||
resultList.add(result);
|
||||
} else {
|
||||
List resultList = new ArrayList();
|
||||
resultList.add(result);
|
||||
resultMap.put(result.get("APPNAME").toString(), resultList);
|
||||
}
|
||||
int runCountInt = Integer.parseInt(result.get("RUNCOUNT").toString());
|
||||
if (!StringUtils.isEmpty(result.get("RUNCOUNT").toString())) {
|
||||
total += runCountInt;
|
||||
}
|
||||
}
|
||||
//获取纵坐标数据
|
||||
for (Map.Entry<String, List> entry : resultMap.entrySet()) {
|
||||
List<Map<String, List>> processLogResultList = entry.getValue();
|
||||
String data = "";
|
||||
column += "{name: '" + entry.getKey() + "',";
|
||||
for (String month : monthList) {
|
||||
boolean isContains = false;
|
||||
Map<String, List> processLog = null;
|
||||
for (Map<String, List> processLog1 : processLogResultList) {
|
||||
if (month.equals(processLog1.get("MONTH"))) {
|
||||
isContains = true;
|
||||
processLog = processLog1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isContains) {
|
||||
data += processLog.get("RUNCOUNT") + ",";
|
||||
} else {
|
||||
data += "0,";
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(data)) {
|
||||
data = data.substring(0, data.length() - 1);
|
||||
}
|
||||
column += "data: eval([" + data + "])},";
|
||||
}
|
||||
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
ModelAndView modelAndView = new ModelAndView("/sysMgr/appProcessLogByYear");
|
||||
modelAndView.addObject("applicationList", applicationList);
|
||||
modelAndView.addObject("params", params);
|
||||
modelAndView.addObject("column", column);
|
||||
modelAndView.addObject("row", row);
|
||||
modelAndView.addObject("total", total);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程接口调用时序
|
||||
**/
|
||||
@RequestMapping(value = "/appProcessLogByDay")
|
||||
public ModelAndView appProcessLogByDay(HttpServletRequest request) throws Exception {
|
||||
// String column = "{name: '运行中(20)',data: eval([6,5,3,2,2,1,1])},{name: '已结束(9)',data: eval([3,2,2,1,1])},";
|
||||
// String row = "'临时出入证申请','综合协调事项','临时出入证申请','车辆出入证申请','请假','个人印章使用申请','个人印章使用申请','车辆出入证申请','综合协调事项','公务印章使用申请','收入证明申请','收入证明申请'";
|
||||
String column = "";
|
||||
String row = "";
|
||||
int total = 0;
|
||||
//获取流程接口调用时序数据
|
||||
String searchDay = "";
|
||||
if(StringUtils.isNotEmpty(request.getParameter("searchDay"))){
|
||||
searchDay = request.getParameter("searchDay");
|
||||
}else{
|
||||
Date nowDate = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
searchDay = format.format(nowDate);
|
||||
}
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("searchDay", searchDay);
|
||||
params.put("appId", request.getParameter("appId"));
|
||||
List<Map<String , Object>> processLogResult = analysisService.getAppProcessLogByDay(params);
|
||||
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
String data = "";
|
||||
for (Map<String, Object> processLog : processLogResult) {
|
||||
//获取横坐标数据
|
||||
row += "'" + processLog.get("APPNAME") + "',";
|
||||
//获取totle
|
||||
int runCountInt = Integer.parseInt(processLog.get("RUNCOUNT").toString());
|
||||
if (StringUtils.isNotEmpty(processLog.get("RUNCOUNT").toString())) {
|
||||
total += runCountInt;
|
||||
}
|
||||
data += processLog.get("RUNCOUNT") + ",";
|
||||
}
|
||||
if (!StringUtils.isEmpty(row)) {
|
||||
row = row.substring(0, row.length() - 1);
|
||||
}
|
||||
//获取纵坐标数据
|
||||
column += "{name: '今日各流程调用数',";
|
||||
if (!StringUtils.isEmpty(data)) {
|
||||
data = data.substring(0, data.length() - 1);
|
||||
}
|
||||
column += "data: eval([" + data + "])},";
|
||||
// for (Map<String, Object> processLog : processLogResult) {
|
||||
// data += processLog.get("RUNCOUNT") + ",";
|
||||
// }
|
||||
// for (ApplicationEntity model : applicationList) {
|
||||
// row += "'" + model.getAppName() + "',";
|
||||
// }
|
||||
//获取totle
|
||||
// for (Map<String, Object> processLog1 : processLogResult) {
|
||||
// int runCountInt = Integer.parseInt(processLog1.get("RUNCOUNT").toString());
|
||||
// if (StringUtils.isNotEmpty(processLog1.get("RUNCOUNT").toString())) {
|
||||
// total += runCountInt;
|
||||
// }
|
||||
// }
|
||||
// for (ApplicationEntity model : applicationList) {
|
||||
// boolean isContains = false;
|
||||
// Map<String, Object> processLog = null;
|
||||
// for (Map<String, Object> processLog1 : processLogResult) {
|
||||
// if (model.getAppName().equals(processLog1.get("APPNAME"))) {
|
||||
// isContains = true;
|
||||
// processLog = processLog1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (isContains) {
|
||||
// data += processLog.get("RUNCOUNT") + ",";
|
||||
// } else {
|
||||
// data += "0,";
|
||||
// }
|
||||
// }
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("/sysMgr/appProcessLogByDay");
|
||||
modelAndView.addObject("applicationList", applicationList);
|
||||
modelAndView.addObject("params", params);
|
||||
modelAndView.addObject("column", column);
|
||||
modelAndView.addObject("row", row);
|
||||
modelAndView.addObject("total", total);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/getAppName", method = RequestMethod.GET)
|
||||
public @ResponseBody String getAppName(HttpServletRequest request) {
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
String appName = "";
|
||||
for (ApplicationEntity entity : applicationList) {
|
||||
if(request.getParameter("appId").equals(entity.getAppId())){
|
||||
appName = entity.getAppName();
|
||||
}
|
||||
}
|
||||
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
|
||||
String s = gson.toJson(appName);
|
||||
return s;
|
||||
}
|
||||
/**
|
||||
* 流程已办查询
|
||||
**/
|
||||
@RequestMapping(value = "/sysYibanTaskList")
|
||||
public ModelAndView sysYibanTaskList(SearchProcessListDTO pageRequest, HttpServletRequest request) throws Exception {
|
||||
HistoricTaskInstanceQuery query = processInstanceService.getHistoryService().createHistoricTaskInstanceQuery();
|
||||
pageRequest = (SearchProcessListDTO) bindPageRequest(request,pageRequest, "");
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("appId", request.getParameter("appId"));;
|
||||
params.put("title", request.getParameter("title"));
|
||||
params.put("processInstanceId", request.getParameter("processInstanceId"));
|
||||
params.put("processDefName", request.getParameter("processDefName"));
|
||||
params.put("assignee", request.getParameter("assignee"));
|
||||
params.put("actInstId", request.getParameter("actInstId"));
|
||||
params.put("actInstName", request.getParameter("actInstName"));
|
||||
params.put("toSearchYear", request.getParameter("toSearchYear"));
|
||||
params.put("taskDefName", request.getParameter("taskDefName"));
|
||||
if ("true".equalsIgnoreCase(MyContants.IS_OPEN_TENANT) && (StringUtils.isNotEmpty(request.getParameter("appId")))) {
|
||||
query.taskTenantId(request.getParameter("appId"));
|
||||
}
|
||||
/*if (StringUtils.isNotEmpty(request.getParameter("title"))) {
|
||||
query.taskNameLike("%"+request.getParameter("title")+"%");
|
||||
}*/
|
||||
if (StringUtils.isNotEmpty(request.getParameter("processInstanceId"))) {
|
||||
query.processInstanceId(request.getParameter("processInstanceId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("processDefName"))) {
|
||||
query.processDefinitionNameLike("%"+request.getParameter("processDefName")+"%");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("assignee"))) {
|
||||
query.taskAssignee(request.getParameter("assignee"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("actInstId"))) {
|
||||
query.taskId(request.getParameter("actInstId"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("actInstName"))) {
|
||||
query.taskName(request.getParameter("actInstName"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getParameter("toSearchYear"))) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy");
|
||||
String searchYear = request.getParameter("toSearchYear");
|
||||
String endDateStr = (Integer.parseInt(searchYear) + 1) + "";
|
||||
Date startDate = format.parse(searchYear);
|
||||
Date endDate = format.parse(endDateStr);
|
||||
query.taskCreatedAfter(startDate);
|
||||
query.taskCreatedBefore(endDate);
|
||||
}
|
||||
Page<HistoricTaskInstance> page = new Page<HistoricTaskInstance>(pageRequest, (int) query.count());
|
||||
List<HistoricTaskInstance> tasks = query.orderByTaskCreateTime().desc().listPage(page.getFirstResult(), page.getPageSize());
|
||||
for (HistoricTaskInstance task : tasks) {
|
||||
try {
|
||||
HistoricTaskInstanceEntity taskEntity = (HistoricTaskInstanceEntity) task;
|
||||
String desc = "";
|
||||
ActivityInfoConfig activityInfoConfig = activityInfoConfigManager.getActivityInfoConfig(taskEntity.getProcessDefinitionId(), taskEntity.getTaskDefinitionKey());
|
||||
if (activityInfoConfig.getActivityLimitTime() != null && activityInfoConfig.getActivityLimitTime() != 0) {
|
||||
Date dueDate = DateUtils.addDays(taskEntity.getCreateTime(), activityInfoConfig.getActivityLimitTime());
|
||||
long limitDate = differByDay(dueDate, new Date());
|
||||
if (limitDate > 0) {
|
||||
desc = "超时" + limitDate + "天";
|
||||
} else {
|
||||
desc = "剩余" + Math.abs(limitDate) + "天";
|
||||
}
|
||||
} else {
|
||||
desc = "耗时" + differByDay(taskEntity.getCreateTime(), new Date()) + "天";
|
||||
}
|
||||
taskEntity.setDescription(desc);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
page.setResult(tasks);
|
||||
|
||||
ApplicationEntity appModel = new ApplicationEntity();
|
||||
appModel.setAppType("inner");
|
||||
List<ApplicationEntity> applicationList = applicationManager.findByExample(appModel);
|
||||
ModelAndView modelAndView = new ModelAndView("/sysMgr/sysYibanTaskList");
|
||||
modelAndView.addObject("params", params);
|
||||
modelAndView.addObject("applicationList", applicationList);
|
||||
modelAndView.addAllObjects(toModelMap(page, pageRequest));
|
||||
return modelAndView;
|
||||
}
|
||||
public static long differByDay(Date startDate, Date endDate) {
|
||||
if (startDate == null || endDate == null) {
|
||||
return 0;
|
||||
}
|
||||
return (endDate.getTime() / 86400000 - startDate.getTime() / 86400000);
|
||||
}
|
||||
private List initMonth(){
|
||||
List months=new ArrayList();
|
||||
for (int i = 1; i <=12; i++) {
|
||||
if(i<10){
|
||||
months.add("0"+i);
|
||||
}else{
|
||||
months.add(""+i);
|
||||
}
|
||||
}
|
||||
return months;
|
||||
}
|
||||
|
||||
//获得最后一天,传入的参数是一个int类型的年份与月份
|
||||
private int getMonthEndTime(int month) throws Exception {
|
||||
//选中月份的最后一天
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
return lastDay;
|
||||
}
|
||||
}
|
||||
13
ebpm-process-manage/src/main/resources/configuration.xml
Normal file
13
ebpm-process-manage/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>
|
||||
24
ebpm-process-manage/src/main/resources/jdbc_dev.properties
Normal file
24
ebpm-process-manage/src/main/resources/jdbc_dev.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
jdbc.driverClass=com.mysql.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://192.168.1.168:3307/tool_tech_bpmc?useUnicode=true&characterEncoding=UTF-8
|
||||
jdbc.username=tool_tech
|
||||
jdbc.password=Tooltech@123
|
||||
cpool.minPoolSize=3
|
||||
cpool.maxPoolSize=20
|
||||
cpool.initialPoolSize=3
|
||||
cpool.acquireIncrement=3
|
||||
|
||||
# Redis settings
|
||||
# server IP
|
||||
redis.host=192.168.1.168
|
||||
# server port
|
||||
redis.port=6379
|
||||
# server pass
|
||||
redis.pass=
|
||||
# use dbIndex
|
||||
redis.database=7
|
||||
redis.maxIdle=300
|
||||
redis.maxWait=3000
|
||||
redis.testOnBorrow=true
|
||||
|
||||
rzdata.bpmcRestUrl=http://localhost:8081/ebpm-process-rest
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
24
ebpm-process-manage/src/main/resources/jdbc_preot.properties
Normal file
24
ebpm-process-manage/src/main/resources/jdbc_preot.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
jdbc.driverClass=com.mysql.cj.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://rm-2tn06021ed601bk7r.mysql.rds.ops.zgs.yun:3306/dzy_bpm?useUnicode=true&characterEncoding=UTF-8
|
||||
jdbc.username=dzydb_test
|
||||
jdbc.password=DZY2022#test
|
||||
cpool.minPoolSize=3
|
||||
cpool.maxPoolSize=20
|
||||
cpool.initialPoolSize=3
|
||||
cpool.acquireIncrement=3
|
||||
|
||||
# Redis settings
|
||||
# server IP
|
||||
redis.host=r-2tn0c051c60728c4.redis.rds.ops.zgs.yun
|
||||
# server port
|
||||
redis.port=6379
|
||||
# server pass
|
||||
redis.pass=Dzy0118redistest
|
||||
# use dbIndex
|
||||
redis.database=7
|
||||
redis.maxIdle=300
|
||||
redis.maxWait=3000
|
||||
redis.testOnBorrow=true
|
||||
|
||||
rzdata.bpmcRestUrl=http://ebpm-process-rest-svc:8080/ebpm-process-rest
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
24
ebpm-process-manage/src/main/resources/jdbc_prod.properties
Normal file
24
ebpm-process-manage/src/main/resources/jdbc_prod.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
jdbc.driverClass=com.mysql.cj.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://rm-2tnk30mw0444u7fy2.mysql.rds.ops.zgs.yun:3306/dzy_bpm?useUnicode=true&characterEncoding=UTF-8
|
||||
jdbc.username=dzydb_prod
|
||||
jdbc.password=DZYprod2022
|
||||
cpool.minPoolSize=3
|
||||
cpool.maxPoolSize=20
|
||||
cpool.initialPoolSize=3
|
||||
cpool.acquireIncrement=3
|
||||
|
||||
# Redis settings
|
||||
# server IP
|
||||
redis.host=r-2tn004a93cb7df24.redis.rds.ops.zgs.yun
|
||||
# server port
|
||||
redis.port=6379
|
||||
# server pass
|
||||
redis.pass=DZY0118redisprod
|
||||
# use dbIndex
|
||||
redis.database=7
|
||||
redis.maxIdle=300
|
||||
redis.maxWait=3000
|
||||
redis.testOnBorrow=true
|
||||
|
||||
rzdata.bpmcRestUrl=http://ebpm-process-rest-svc:8080/ebpm-process-rest
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
24
ebpm-process-manage/src/main/resources/jdbc_test.properties
Normal file
24
ebpm-process-manage/src/main/resources/jdbc_test.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
jdbc.driverClass=com.mysql.cj.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://192.168.1.168:3307/tool_tech_bpmc?useUnicode=true&characterEncoding=UTF-8
|
||||
jdbc.username=tool_tech
|
||||
jdbc.password=Tooltech@123
|
||||
cpool.minPoolSize=3
|
||||
cpool.maxPoolSize=20
|
||||
cpool.initialPoolSize=3
|
||||
cpool.acquireIncrement=3
|
||||
|
||||
# Redis settings
|
||||
# server IP
|
||||
redis.host=192.168.1.168
|
||||
# server port
|
||||
redis.port=6379
|
||||
# server pass
|
||||
redis.pass=
|
||||
# use dbIndex
|
||||
redis.database=7
|
||||
redis.maxIdle=300
|
||||
redis.maxWait=3000
|
||||
redis.testOnBorrow=true
|
||||
|
||||
rzdata.bpmcRestUrl=http://192.168.2.128:8081/ebpm-process-rest
|
||||
rzdata.userDomain=http://bizworks-user-center.ubcp-dev.szzt.api.zgs.yun
|
||||
58
ebpm-process-manage/src/main/resources/log4j.properties
Normal file
58
ebpm-process-manage/src/main/resources/log4j.properties
Normal file
@@ -0,0 +1,58 @@
|
||||
# This is the configuring for logging displayed in the Application Server
|
||||
log4j.rootCategory=debug,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 %-5p %C{1} - %m%n
|
||||
|
||||
#web file appender
|
||||
log4j.appender.web=org.apache.log4j.DailyRollingFileAppender
|
||||
log4j.appender.web.file=../ebpmlogs/ebpm-process-manage-web.log
|
||||
log4j.appender.web.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.web.layout.conversionPattern= %d %-5p %C{1} - %m%n
|
||||
|
||||
|
||||
|
||||
################################
|
||||
# sql loggers
|
||||
################################
|
||||
log4j.logger.jdbc.sqlonly=OFF
|
||||
log4j.logger.jdbc.sqltiming=ERROR
|
||||
#log4j.logger.jdbc.sqltiming=OFF
|
||||
#log4j.additivity.jdbc.sqltiming=false
|
||||
log4j.logger.jdbc.audit=ERROR
|
||||
log4j.logger.jdbc.resultset=ERROR
|
||||
log4j.logger.jdbc.connection=ERROR
|
||||
|
||||
################################
|
||||
# bpm loggers
|
||||
################################
|
||||
log4j.logger.org.activiti = ERROR
|
||||
log4j.logger.org.activiti.engine.impl.persistence.entity=ERROR
|
||||
log4j.logger.org.activiti.engine.impl.history.DefaultHistoryManager=ERROR
|
||||
log4j.logger.org.activiti.engine.impl.interceptor.CommandContextInterceptor=ERROR
|
||||
log4j.logger.org.activiti.engine.impl.jobexecutor=ERROR
|
||||
log4j.logger.org.activiti.engine.impl.interceptor.LogInterceptor=ERROR
|
||||
log4j.logger.org.activiti.spring=ERROR
|
||||
log4j.logger.org.activiti.engine.impl.db.DbSqlSession = ERROR
|
||||
log4j.logger.com.blueland.bpm.engine.util= DEBUG
|
||||
################################
|
||||
# open source framework loggers
|
||||
################################
|
||||
log4j.logger.org.springframework=ERROR
|
||||
log4j.logger.org.springframework.jdbc=ERROR
|
||||
log4j.logger.org.springframework.web=ERROR
|
||||
log4j.logger.org.mybatis.spring=ERROR
|
||||
#log4j.logger.log4jdbc.debug=ERROR
|
||||
log4j.logger.net.sf.ehcache.util=ERROR
|
||||
log4j.logger.net.sf.ehcache.statistics=ERROR
|
||||
log4j.logger.org.apache.commons=ERROR
|
||||
log4j.logger.org.hibernate=ERROR
|
||||
log4j.logger.org.apache.ibatis=ERROR
|
||||
log4j.logger.cn.org.rapid_framework=ERROR
|
||||
log4j.logger.org.directwebremoting = ERROR
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#全局变量 配置文件
|
||||
MAX_COOKIE=36000000
|
||||
MAX_SESSION=8640000
|
||||
bpm_process_modeler_path=http://192.168.2.128/ebpm-process-modeler/
|
||||
#顶层组织ID
|
||||
TOP_ORG_ID=402880e447e99cf10147e9a03b320003
|
||||
IS_OPEN_TENANT=true
|
||||
CTX=
|
||||
|
||||
#配置邮件地址
|
||||
SMS_EMAIL_URL=
|
||||
#短信发送地址
|
||||
SEND_SMS_URL=
|
||||
|
||||
#userservice.type=userServiceRestImpl
|
||||
#orgservice.type=orgServiceRestImpl
|
||||
#presource.type=processDefinitionResourceOther
|
||||
|
||||
userservice.type=userServiceImpl
|
||||
orgservice.type=orgServiceImpl
|
||||
presource.type=processDefinitionResource
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="GBK"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
default-autowire="byName" default-lazy-init="false"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
|
||||
|
||||
<bean id="propertyConfigurer"
|
||||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath:jdbc_${SPRING_PROFILES_ACTIVE}.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
||||
<property name="driverClassName" value="${jdbc.driverClass}" />
|
||||
<property name="url" value="${jdbc.url}" />
|
||||
<property name="username" value="${jdbc.username}" />
|
||||
<property name="password" value="${jdbc.password}" />
|
||||
<property name="initialSize" value="${cpool.initialPoolSize}"/>
|
||||
<property name="minIdle" value="${cpool.minPoolSize}"/>
|
||||
<property name="maxActive" value="${cpool.maxPoolSize}"/>
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
||||
<property name="minEvictableIdleTimeMillis" value="300000" />
|
||||
<property name="testWhileIdle" value="true" />
|
||||
<property name="testOnBorrow" value="false" />
|
||||
<property name="testOnReturn" value="false" />
|
||||
<property name="poolPreparedStatements" value="true" />
|
||||
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
|
||||
<property name="filters" value="stat" />
|
||||
<property name="connectionProperties" value="druid.stat.slowSqlMillis=5000" />
|
||||
</bean>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-3.1.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"
|
||||
default-autowire="byName" default-lazy-init="false">
|
||||
|
||||
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
|
||||
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<!-- Transaction manager for a single JDBC DataSource -->
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="configLocation" value="classpath:/configuration.xml"/>
|
||||
<property name="mapperLocations" value="classpath*:/com/**/model/**/*Mapper.xml"/>
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
<!-- component-scan自动搜索@Component , @Controller , @Service , @Repository等标注的类 -->
|
||||
<context:component-scan base-package="com.**.dao,com.**.**.dao"/>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="GBK"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/cache
|
||||
http://www.springframework.org/schema/cache/spring-cache.xsd">
|
||||
|
||||
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||
<property name="maxIdle" value="${redis.maxIdle}" />
|
||||
<property name="maxWaitMillis" value="${redis.maxWait}" />
|
||||
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
|
||||
</bean>
|
||||
|
||||
<bean id="JedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
||||
p:host-name="${redis.host}" p:port="${redis.port}" p:password="${redis.pass}" p:database="${redis.database}" p:pool-config-ref="poolConfig"/>
|
||||
|
||||
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
|
||||
<property name="connectionFactory" ref="JedisConnectionFactory" />
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="GBK"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-autowire="byName" default-lazy-init="false">
|
||||
<!-- component-scan<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>@Component , @Controller , @Service , @Repository<72>ȱ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD> -->
|
||||
<!-- Ĭ<><C4AC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ʺϣ<CABA><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD> -->
|
||||
<context:component-scan base-package="com.**" />
|
||||
|
||||
<!-- <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>ApplicationContext,<2C><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ApplicationContextHolder.getBean('xxxx')<29>ľ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>spring bean<61><6E><EFBFBD><EFBFBD> -->
|
||||
<bean class="com.blueland.bpm.common.util.ApplicationContextHolder"/>
|
||||
<bean id="applicationContextHolder" class="com.blueland.bpm.manage.util.ApplicationContextHolder" lazy-init="false"/>
|
||||
</beans>
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
<context:component-scan base-package="com.blueland.bpm.engine.identity,com.blueland.bpm.engine.core.power" />
|
||||
<!-- Activiti begin -->
|
||||
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
<property name="transactionManager" ref="transactionManager" />
|
||||
<property name="databaseSchemaUpdate" value="false" />
|
||||
<property name="jobExecutorActivate" value="true" />
|
||||
<property name="history" value="audit" />
|
||||
<property name="activityFontName" value="宋体"></property>
|
||||
<property name="labelFontName" value="宋体"/>
|
||||
<property name="idGenerator" ref="uuidGenerator"/>
|
||||
<property name="dbIdentityUsed" value="false"/>
|
||||
<property name="enableDatabaseEventLogging" value="true"/>
|
||||
<property name="jobExecutor">
|
||||
<bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">
|
||||
<property name="waitTimeInMillis" value="10000" />
|
||||
</bean>
|
||||
</property>
|
||||
<!-- 自定义用户和组工厂 -->
|
||||
<property name="customSessionFactories">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.engine.core.identity.CustomUserManagerFactory" />
|
||||
<bean class="com.blueland.bpm.engine.core.identity.CustomGroupManagerFactory" />
|
||||
</list>
|
||||
</property>
|
||||
<!-- 全局监听器 -->
|
||||
<property name="globalTaskCreateListeners">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.engine.core.listener.GlobalTaskAssigneeListener" />
|
||||
<bean class="com.blueland.bpm.engine.core.listener.GlobalTaskDutDateListener" />
|
||||
<bean class="com.blueland.bpm.unitework.TaskCreateListener" />
|
||||
</list>
|
||||
</property>
|
||||
<property name="typedEventListeners">
|
||||
<map>
|
||||
<entry key="PROCESS_COMPLETED">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.unitework.ProcessEndEvent" />
|
||||
</list>
|
||||
</entry>
|
||||
<entry key="PROCESS_CANCEL">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.unitework.ProcessCancelEvent" />
|
||||
</list>
|
||||
</entry>
|
||||
<entry key="TASK_ASSIGNED_TRANSFER">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.unitework.TaskAssigneTransferEvent" />
|
||||
</list>
|
||||
</entry>
|
||||
<entry key="ENTITY_DELETED">
|
||||
<list>
|
||||
<bean class="com.blueland.bpm.unitework.TaskDeleleEvent" />
|
||||
</list>
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
<!-- 流程定义缓存-->
|
||||
<property name="processDefinitionCache">
|
||||
<bean class="com.blueland.bpm.engine.util.cache.MyProcessDefinitionCache">
|
||||
<property name="redisTemplate" ref="redisTemplate" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="uuidGenerator" class="org.activiti.engine.impl.persistence.StrongUuidGenerator"/>
|
||||
|
||||
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
|
||||
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
|
||||
</bean>
|
||||
|
||||
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
|
||||
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
|
||||
<bean id="formService" factory-bean="processEngine" factory-method="getFormService" />
|
||||
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
|
||||
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
|
||||
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
|
||||
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
|
||||
<!-- Activiti end -->
|
||||
</beans>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||
xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd ">
|
||||
|
||||
<bean id="applicationContextHolder" class="com.blueland.bpm.manage.util.ApplicationContextHolder" lazy-init="false"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
修改说明:
|
||||
1.修改<context:component-scan以确定要加载的controller,默认为com.**.controller
|
||||
2.修改class=ControllerClassNameHandlerMapping节点的pathPrefix以确定要生成的前缀
|
||||
-->
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
|
||||
|
||||
<!-- 对controller包进行扫描,实现注释驱动Bean定义,同时将bean自动注入容器中使用。即解决了@Controller标识的类的bean的注入和使用 -->
|
||||
<context:component-scan base-package="com.**.web"/>
|
||||
|
||||
<!-- 相当于注册了DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter两个bean,配置一些messageconverter。即解决了@Controller注解的使用前提配置 -->
|
||||
<mvc:annotation-driven>
|
||||
<mvc:message-converters register-defaults="true">
|
||||
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||
<property name="supportedMediaTypes" value="text/plain;charset=UTF-8" />
|
||||
</bean>
|
||||
</mvc:message-converters>
|
||||
</mvc:annotation-driven>
|
||||
|
||||
<mvc:interceptors>
|
||||
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
|
||||
<mvc:interceptor>
|
||||
<!-- 匹配的是url路径, 如果不配置或/**,将拦截所有的Controller -->
|
||||
<mvc:mapping path="/**"/>
|
||||
<bean class="com.blueland.bpm.manage.interceptor.ProcessModelerUrlInterceptor"></bean>
|
||||
</mvc:interceptor>
|
||||
</mvc:interceptors>
|
||||
|
||||
<!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
|
||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
|
||||
<property name="prefix" value="/pages"/>
|
||||
<property name="suffix" value=".jsp"></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<!-- one of the properties available; the maximum file size in bytes -->
|
||||
<property name="maxUploadSize" value="10000000"/>
|
||||
</bean>
|
||||
|
||||
<!-- Mapping exception to the handler view -->
|
||||
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
|
||||
<property name="exceptionMappings">
|
||||
<props>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
3
ebpm-process-manage/webapp/Dockerfile
Normal file
3
ebpm-process-manage/webapp/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM REGISTRY_URL/tomcat:8.0.51-jre8-alpine
|
||||
ADD ./build/ebpm-process-manage.war /usr/local/tomcat/webapps/ebpm-process-manage.war
|
||||
COPY ./process-ehcache-manage.xml /
|
||||
3
ebpm-process-manage/webapp/META-INF/MANIFEST.MF
Normal file
3
ebpm-process-manage/webapp/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
2
ebpm-process-manage/webapp/META-INF/context.xml
Normal file
2
ebpm-process-manage/webapp/META-INF/context.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Context antiJARLocking="true" path="/activiti-explorer2"/>
|
||||
@@ -0,0 +1,78 @@
|
||||
<%@ tag pageEncoding="GBK"%>
|
||||
<%@ attribute name="page" required="true" type="com.blueland.bpm.common.page.Page" description="Page.java" %>
|
||||
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
|
||||
<%
|
||||
// set default values
|
||||
|
||||
java.lang.Integer[] defaultPageSizes = new java.lang.Integer[]{10,50,100};
|
||||
if(jspContext.getAttribute("pageSizeSelectList") == null) {
|
||||
jspContext.setAttribute("pageSizeSelectList",defaultPageSizes);
|
||||
}
|
||||
|
||||
if(jspContext.getAttribute("isShowPageSizeList") == null) {
|
||||
jspContext.setAttribute("isShowPageSizeList",true);
|
||||
}
|
||||
|
||||
|
||||
%>
|
||||
<div class="pagination-box">
|
||||
<ul class="pagination">
|
||||
<% if(page.isFirstPage()){%>
|
||||
<li class="disabled"><a href="javascript:void(0);"><3E><>ҳ</a></li>
|
||||
|
||||
<% }else{%>
|
||||
<li>
|
||||
<a href="javascript:simpleTable.togglePage(1);"><i class="icon-double-angle-left"></i><3E><>ҳ</a>
|
||||
</li>
|
||||
<% }%>
|
||||
<% if(page.isHasPreviousPage()){%>
|
||||
<li>
|
||||
<a href="javascript:simpleTable.togglePage(${page.previousPageNumber});"><span class="icon_page_prev hand"><3E><>һҳ</span></a>
|
||||
</li>
|
||||
<% }else{%>
|
||||
<li class="disabled"><a href="javascript:void(0);"><3E><>һҳ</a></li>
|
||||
<% }%>
|
||||
<%--
|
||||
<%
|
||||
java.util.List linkPageNumbers=page.getLinkPageNumbers();
|
||||
for(int i=0;i<linkPageNumbers.size();i++){
|
||||
if((Integer)linkPageNumbers.get(i)==page.getThisPageNumber()){%>
|
||||
<li class="active"><a><%=linkPageNumbers.get(i)%></a></li>
|
||||
<%}else{%>
|
||||
<li>
|
||||
<a href="javascript:simpleTable.togglePage(<%=linkPageNumbers.get(i)%>);">[<%=linkPageNumbers.get(i)%>]</a>
|
||||
</li>
|
||||
<%}
|
||||
|
||||
}
|
||||
%> --%>
|
||||
<% if(page.isHasNextPage()){%>
|
||||
<li>
|
||||
<a href="javascript:simpleTable.togglePage(${page.nextPageNumber});"><span class="icon_page_next hand"><3E><>һҳ</span></a>
|
||||
</li>
|
||||
<% }else{%>
|
||||
<li class="disabled"><a href="javascript:void(0);"><3E><>һҳ</a></li>
|
||||
<% }%>
|
||||
|
||||
|
||||
|
||||
<% if(page.isLastPage()){%>
|
||||
<li class="disabled"><a href="javascript:void(0);">βҳ</a></li>
|
||||
<% }else{%>
|
||||
<li>
|
||||
<a href="javascript:simpleTable.togglePage(${page.lastPageNumber});"><i class="icon-double-angle-right"></i>βҳ</a>
|
||||
</li>
|
||||
<% }%>
|
||||
|
||||
|
||||
<li class="disabled">
|
||||
<a> <3B><>ǰ<EFBFBD>ǵ<EFBFBD><font color="blue"><%=page.getThisPageNumber()%></font>ҳ
|
||||
<% if(page.getTotalCount()<100000000){%>
|
||||
<09><><EFBFBD>ܹ<EFBFBD><font color="blue"><%=page.getTotalCount()%></font><3E><><EFBFBD><EFBFBD>¼</a>
|
||||
<% }%>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
157
ebpm-process-manage/webapp/WEB-INF/web.xml
Normal file
157
ebpm-process-manage/webapp/WEB-INF/web.xml
Normal file
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
|
||||
<!-- session超时定义,单位为分钟 -->
|
||||
<session-config>
|
||||
<session-timeout>600</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<!-- 默认首页定义 -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>/index.do</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<!-- Error Page定义 -->
|
||||
<error-page>
|
||||
<error-code>500</error-code>
|
||||
<location>/commons/error.jsp</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>404</error-code>
|
||||
<location>/commons/404.jsp</location>
|
||||
</error-page>
|
||||
<error-page>
|
||||
<error-code>403</error-code>
|
||||
<location>/commons/403.jsp</location>
|
||||
</error-page>
|
||||
|
||||
<!-- Spring ApplicationContext配置文件的路径<E8B7AF>,可使用通配符,多个路径用<E5BE84>1,号分隔
|
||||
此参数用于后面的Spring-Context loader -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath*:spring/*.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- JSTL i18n定义-->
|
||||
<context-param>
|
||||
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
|
||||
<param-value>i18n/messages</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>SimpleCORSFilter</filter-name>
|
||||
<filter-class>com.blueland.bpm.manage.service.SimpleCORSFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>SimpleCORSFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter>
|
||||
<filter-name>XssFilter</filter-name>
|
||||
<filter-class>com.blueland.bpm.manage.util.XssFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>XssFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
<!-- 直接从客户端过来的请求以及通过forward过来的请求都要经过该过滤器 -->
|
||||
<dispatcher>REQUEST</dispatcher>
|
||||
<dispatcher>FORWARD</dispatcher>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
<!-- Character Encoding filter -->
|
||||
<filter>
|
||||
<filter-name>CharacterEncodingFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
|
||||
<filter>
|
||||
<filter-name>CheckUserLoginFilter</filter-name>
|
||||
<filter-class>com.blueland.bpm.manage.util.CheckUserLoginFilter</filter-class>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>CheckUserLoginFilter</filter-name>
|
||||
<url-pattern>*.do</url-pattern> </filter-mapping>
|
||||
<filter-mapping>
|
||||
<filter-name>CheckUserLoginFilter</filter-name>
|
||||
<url-pattern>*.jsp</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>CharacterEncodingFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
<!--Spring ApplicationContext 载入 -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- 使Spring支持request与session的scope,如:<bean id="loginAction" class="com.foo.LoginAction" scope="request"/> -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Spring 刷新Introspector防止内存泄露 -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- springmvc 配置 -->
|
||||
<servlet>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath*:/spring/springmvc-servlet.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>springmvc</servlet-name>
|
||||
<url-pattern>*.do</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
|
||||
<!-- druid config start -->
|
||||
<filter>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>exclusions</param-name>
|
||||
<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.swf,*.ico,/druid/*</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>profileEnable</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>DruidWebStatFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>DruidStatView</servlet-name>
|
||||
<url-pattern>/druid/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<!-- druid config end -->
|
||||
</web-app>
|
||||
37
ebpm-process-manage/webapp/commons/403.jsp
Normal file
37
ebpm-process-manage/webapp/commons/403.jsp
Normal file
@@ -0,0 +1,37 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" isErrorPage="true" %>
|
||||
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ include file="/commons/taglibs.jsp" %>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a { color:#555}
|
||||
html { height: 100%; width: 100%; background: url(${ctx}/resource/css/images/bj.png) repeat; }
|
||||
body {margin: 0px auto;}
|
||||
.cw404 { width:755px; margin: 0px auto; }
|
||||
.cw404_nr { height: 284px; width: 750px; background: #e5e5e5; border: 1px solid #aaaaaa; margin: 0px auto; }
|
||||
.cw404_top { height: 200px; width: 750px; margin: 0px auto; }
|
||||
.top_left { float: left; height: 150px; width: 150px; }
|
||||
.top_right { font-size: 100px; line-height: 150px; text-align: center; float: left; height: 150px; width: 600px; color: #3f8bc7; font-family: "΢ÈíÑźÚ"; font-weight: bold; }
|
||||
.nr_top { font-size: 25px; line-height: 40px; height: 40px; margin-right: 5px; margin-left: 5px; border-bottom: 1px solid #aaaaaa; text-align: center; font-weight: bold; color: #555555; }
|
||||
.nr_min { height: 200px; border-top: 1px solid #FFFFFF; margin-right: 5px; margin-left: 5px; border-bottom: 1px solid #aaaaaa; }
|
||||
.nr_foot { font-size: 12px; line-height: 40px; background: #eaeaea; height: 40px; border-top: 1px solid #FFFFFF; color: #555; margin-right: 5px; margin-left: 5px; }
|
||||
.min_top { font-size: 14px; line-height: 30px; height: 30px; }
|
||||
.min_choose { height: 30px; width: 100px; border: 1px solid #aaa; font-size: 12px; line-height: 30px; text-align: center; background: #eaeaea; }
|
||||
.else { height: 30px; }
|
||||
.else li{ width:100px; float:left; margin-left:10px; font-size:12px; line-height:30px; display:inline}
|
||||
a:link { text-decoration: none; }
|
||||
a:visited { text-decoration: none; }
|
||||
a:hover { text-decoration: none; }
|
||||
a:active { text-decoration: none; }
|
||||
-->
|
||||
</style>
|
||||
<div class="cw404">
|
||||
<div class="cw404_top">
|
||||
<div class="top_left"><img src="${ctx}/resource/css/images/cw4.png"></div>
|
||||
<div class="top_right">404</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="nr_top">抱歉,您没有权限访问请求的页面</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
37
ebpm-process-manage/webapp/commons/404.jsp
Normal file
37
ebpm-process-manage/webapp/commons/404.jsp
Normal file
@@ -0,0 +1,37 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" isErrorPage="true" %>
|
||||
<%@ page import="org.apache.commons.logging.LogFactory" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ include file="/commons/taglibs.jsp" %>
|
||||
<style type="text/css">
|
||||
<!--
|
||||
a { color:#555}
|
||||
html { height: 100%; width: 100%; background: url(${ctx}/resource/css/images/bj.png) repeat; }
|
||||
body {margin: 0px auto;}
|
||||
.cw404 { width:755px; margin: 0px auto; }
|
||||
.cw404_nr { height: 284px; width: 750px; background: #e5e5e5; border: 1px solid #aaaaaa; margin: 0px auto; }
|
||||
.cw404_top { height: 200px; width: 750px; margin: 0px auto; }
|
||||
.top_left { float: left; height: 150px; width: 150px; }
|
||||
.top_right { font-size: 100px; line-height: 150px; text-align: center; float: left; height: 150px; width: 600px; color: #3f8bc7; font-family: "΢ÈíÑźÚ"; font-weight: bold; }
|
||||
.nr_top { font-size: 25px; line-height: 40px; height: 40px; margin-right: 5px; margin-left: 5px; border-bottom: 1px solid #aaaaaa; text-align: center; font-weight: bold; color: #555555; }
|
||||
.nr_min { height: 200px; border-top: 1px solid #FFFFFF; margin-right: 5px; margin-left: 5px; border-bottom: 1px solid #aaaaaa; }
|
||||
.nr_foot { font-size: 12px; line-height: 40px; background: #eaeaea; height: 40px; border-top: 1px solid #FFFFFF; color: #555; margin-right: 5px; margin-left: 5px; }
|
||||
.min_top { font-size: 14px; line-height: 30px; height: 30px; }
|
||||
.min_choose { height: 30px; width: 100px; border: 1px solid #aaa; font-size: 12px; line-height: 30px; text-align: center; background: #eaeaea; }
|
||||
.else { height: 30px; }
|
||||
.else li{ width:100px; float:left; margin-left:10px; font-size:12px; line-height:30px; display:inline}
|
||||
a:link { text-decoration: none; }
|
||||
a:visited { text-decoration: none; }
|
||||
a:hover { text-decoration: none; }
|
||||
a:active { text-decoration: none; }
|
||||
-->
|
||||
</style>
|
||||
<div class="cw404">
|
||||
<div class="cw404_top">
|
||||
<div class="top_left"><img src="${ctx}/resource/css/images/cw4.png"></div>
|
||||
<div class="top_right">404</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="nr_top">抱歉,您访问的页面不存在</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user