Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bpm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王厚康
bpm
Commits
dee824e5
Commit
dee824e5
authored
Aug 20, 2019
by
王厚康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加serviceTask处理类
parent
72fc67a0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
186 deletions
+9
-186
WebSecurityConfig.java
src/main/java/com/bbd/bpm/config/WebSecurityConfig.java
+1
-1
AsminController.java
src/main/java/com/bbd/bpm/controller/AsminController.java
+2
-4
DemoController.java
src/main/java/com/bbd/bpm/controller/DemoController.java
+0
-103
ProcessTaskController.java
src/main/java/com/bbd/bpm/controller/ProcessTaskController.java
+0
-77
UserTaskController.java
src/main/java/com/bbd/bpm/controller/UserTaskController.java
+2
-1
LoginController.java
src/main/java/com/bbd/bpm/controller/user/LoginController.java
+2
-0
UserApiController.java
src/main/java/com/bbd/bpm/controller/user/UserApiController.java
+2
-0
No files found.
src/main/java/com/bbd/bpm/config/WebSecurityConfig.java
View file @
dee824e5
...
@@ -39,7 +39,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -39,7 +39,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
//配置策略
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
//配置策略
http
.
csrf
().
disable
();
http
.
csrf
().
disable
();
http
.
authorizeRequests
().
http
.
authorizeRequests
().
antMatchers
(
"/v2/api-docs"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/images/**"
,
"/loadverify"
,
"/static/images/**"
).
permitAll
().
anyRequest
().
authenticated
().
antMatchers
(
"/
api/**"
,
"/
v2/api-docs"
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/images/**"
,
"/loadverify"
,
"/static/images/**"
).
permitAll
().
anyRequest
().
authenticated
().
and
().
headers
().
frameOptions
().
disable
().
and
().
headers
().
frameOptions
().
disable
().
and
().
formLogin
().
loginPage
(
"/login"
).
permitAll
().
successHandler
(
loginSuccessHandler
()).
and
().
formLogin
().
loginPage
(
"/login"
).
permitAll
().
successHandler
(
loginSuccessHandler
()).
and
().
logout
().
permitAll
().
invalidateHttpSession
(
true
).
and
().
logout
().
permitAll
().
invalidateHttpSession
(
true
).
...
...
src/main/java/com/bbd/bpm/controller/AsminController.java
View file @
dee824e5
...
@@ -11,13 +11,14 @@ import org.springframework.http.MediaType;
...
@@ -11,13 +11,14 @@ import org.springframework.http.MediaType;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
/**
/**
* Created by houkang on 2019/1/3.
* Created by houkang on 2019/1/3.
*/
*/
@RestController
@RestController
@RequestMapping
(
value
=
"/api/bpm"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/api/bpm"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@Api
(
tags
=
{
"Asmin Controller"
})
@Api
Ignore
public
class
AsminController
{
public
class
AsminController
{
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
AsminController
.
class
);
private
static
final
Logger
Log
=
LoggerFactory
.
getLogger
(
AsminController
.
class
);
...
@@ -42,7 +43,6 @@ public class AsminController {
...
@@ -42,7 +43,6 @@ public class AsminController {
}
}
@ApiOperation
(
value
=
"Find asminMap"
)
@GetMapping
(
value
=
"/asminMap"
)
@GetMapping
(
value
=
"/asminMap"
)
public
BpmResponse
asminMap
()
{
public
BpmResponse
asminMap
()
{
BpmResponse
resp
=
new
BpmResponse
();
BpmResponse
resp
=
new
BpmResponse
();
...
@@ -58,7 +58,6 @@ public class AsminController {
...
@@ -58,7 +58,6 @@ public class AsminController {
return
resp
;
return
resp
;
}
}
@ApiOperation
(
value
=
"Find asmin by "
)
@GetMapping
(
value
=
"/asminby"
)
@GetMapping
(
value
=
"/asminby"
)
public
BpmResponse
searchAgents
()
{
public
BpmResponse
searchAgents
()
{
BpmResponse
resp
=
new
BpmResponse
();
BpmResponse
resp
=
new
BpmResponse
();
...
@@ -77,7 +76,6 @@ public class AsminController {
...
@@ -77,7 +76,6 @@ public class AsminController {
}
}
@ApiOperation
(
value
=
"save demo "
)
@GetMapping
(
value
=
"/addDemo"
)
@GetMapping
(
value
=
"/addDemo"
)
public
BpmResponse
addDemo
()
{
public
BpmResponse
addDemo
()
{
BpmResponse
resp
=
new
BpmResponse
();
BpmResponse
resp
=
new
BpmResponse
();
...
...
src/main/java/com/bbd/bpm/controller/DemoController.java
deleted
100644 → 0
View file @
72fc67a0
package
com
.
bbd
.
bpm
.
controller
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by houkang on 2019/1/15.
*/
@RestController
@RequestMapping
(
"/demo"
)
public
class
DemoController
{
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
TaskService
taskService
;
@RequestMapping
(
"/firstDemo"
)
public
void
firstDemo
()
{
//根据bpmn文件部署流程
Deployment
deployment
=
repositoryService
.
createDeployment
().
addClasspathResource
(
"processes/bpm_one.bpmn"
).
deploy
();
//获取流程定义
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
deploymentId
(
deployment
.
getId
()).
singleResult
();
//启动流程定义,返回流程实例
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
processDefinition
.
getKey
(),
"1111bussinessKey1111"
);
String
processId
=
pi
.
getId
();
System
.
out
.
println
(
"流程创建成功,当前流程实例ID:"
+
processId
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processId
).
singleResult
();
System
.
out
.
println
(
"第一次执行前,任务名称:"
+
task
.
getName
());
taskService
.
complete
(
task
.
getId
());
//2 通过任务对象获取流程实例
ProcessInstance
pit
=
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
task
.
getProcessInstanceId
()).
singleResult
();
//3 通过流程实例获取“业务键”
String
businessKey
=
pit
.
getBusinessKey
();
System
.
out
.
println
(
"Businesskey:"
+
businessKey
);
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processId
).
singleResult
();
System
.
out
.
println
(
"第二次执行前,任务名称:"
+
task
.
getName
());
taskService
.
complete
(
task
.
getId
());
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processId
).
singleResult
();
System
.
out
.
println
(
"task为null,任务执行完毕:"
+
task
);
}
@RequestMapping
(
"/twoDemo"
)
public
void
twoDemo
()
{
//根据bpmn文件部署流程
Deployment
deployment
=
repositoryService
.
createDeployment
().
addClasspathResource
(
"processes/bpm_one.bpmn"
).
deploy
();
//获取流程定义
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
deploymentId
(
deployment
.
getId
()).
singleResult
();
//启动流程定义,返回流程实例
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"user"
,
"wang"
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
processDefinition
.
getKey
(),
"1111bussinessKey1111"
,
variables
);
String
processId
=
pi
.
getId
();
System
.
out
.
println
(
"流程创建成功,当前流程实例ID:"
+
processId
);
}
@RequestMapping
(
"/threeDemo"
)
public
void
threeDemo
()
{
List
<
Task
>
taskList
=
taskService
.
createTaskQuery
().
taskAssignee
(
"wang"
).
list
();
if
(
taskList
!=
null
){
for
(
Task
t:
taskList
){
System
.
out
.
println
(
t
.
getName
()+
t
.
getId
());
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"user"
,
"houkang"
);
taskService
.
complete
(
t
.
getId
(),
variables
);
}
}
}
@RequestMapping
(
"/fourDemo"
)
public
void
fourDemo
()
{
List
<
Task
>
taskList
=
taskService
.
createTaskQuery
().
taskAssignee
(
"houkang"
).
list
();
if
(
taskList
!=
null
){
for
(
Task
t:
taskList
){
// t.
System
.
out
.
println
(
t
.
getName
());
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
taskService
.
complete
(
t
.
getId
(),
variables
);
}
}
}
}
src/main/java/com/bbd/bpm/controller/ProcessTaskController.java
deleted
100644 → 0
View file @
72fc67a0
package
com
.
bbd
.
bpm
.
controller
;
import
org.activiti.engine.RepositoryService
;
import
org.activiti.engine.RuntimeService
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.impl.identity.Authentication
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.ProcessDefinition
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by houkang on 2019/1/28.
*/
@RestController
@RequestMapping
(
"/bpm/task"
)
public
class
ProcessTaskController
{
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
TaskService
taskService
;
//启动工作流 并执行到下一节点
@GetMapping
(
"/beginTask"
)
public
void
beginTask
(
String
bussinessKey
,
String
job
)
{
//根据bpmn文件部署流程
Deployment
deployment
=
repositoryService
.
createDeployment
().
addClasspathResource
(
"processes/bpm_two.bpmn"
).
deploy
();
//获取流程定义
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
deploymentId
(
deployment
.
getId
()).
singleResult
();
//启动流程定义,返回流程实例
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"user"
,
"yuagong1"
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
processDefinition
.
getKey
(),
bussinessKey
,
variables
);
String
processId
=
pi
.
getId
();
System
.
out
.
println
(
"流程创建成功,当前流程实例ID:"
+
processId
);
//完成并执行到下一节点
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processId
).
singleResult
();
System
.
out
.
println
(
"第一次执行前,任务名称:"
+
task
.
getName
());
Map
<
String
,
Object
>
assMap
=
new
HashMap
<
String
,
Object
>();
assMap
.
put
(
"job"
,
job
);
taskService
.
complete
(
task
.
getId
(),
assMap
);
System
.
out
.
println
(
"执行结束"
);
}
//完成工作
@GetMapping
(
"/processTask"
)
public
void
processTask
(
String
taskId
)
{
Task
task
=
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
();
if
(
task
==
null
){
System
.
out
.
println
(
"任务不存在"
);
return
;
}
// 由于流程用户上下文对象是线程独立的,所以要在需要的位置设置,要保证设置和获取操作在同一个线程中
Authentication
.
setAuthenticatedUserId
(
"lingdao"
);
//批注人的名称 一定要写,不然查看的时候不知道人物信息
// 添加批注信息
taskService
.
addComment
(
taskId
,
null
,
""
);
//comment为批注内容
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
taskService
.
complete
(
taskId
,
variables
);
}
}
src/main/java/com/bbd/bpm/controller/UserTaskController.java
View file @
dee824e5
...
@@ -15,6 +15,7 @@ import org.springframework.http.MediaType;
...
@@ -15,6 +15,7 @@ import org.springframework.http.MediaType;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,7 +24,7 @@ import java.util.List;
...
@@ -23,7 +24,7 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
value
=
"/api/bpm/userTask"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/api/bpm/userTask"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@Api
(
tags
=
{
"task Controller"
})
@Api
Ignore
public
class
UserTaskController
{
public
class
UserTaskController
{
@Autowired
@Autowired
...
...
src/main/java/com/bbd/bpm/controller/user/LoginController.java
View file @
dee824e5
...
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -21,6 +22,7 @@ import java.security.Principal;
...
@@ -21,6 +22,7 @@ import java.security.Principal;
* Created by houkang on 2019/3/19.
* Created by houkang on 2019/3/19.
*/
*/
@Controller
@Controller
@ApiIgnore
public
class
LoginController
{
public
class
LoginController
{
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/com/bbd/bpm/controller/user/UserApiController.java
View file @
dee824e5
...
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -40,6 +41,7 @@ import java.io.*;
...
@@ -40,6 +41,7 @@ import java.io.*;
**/
**/
@Controller
@Controller
@RequestMapping
(
value
=
"bpm/user"
)
@RequestMapping
(
value
=
"bpm/user"
)
@ApiIgnore
public
class
UserApiController
{
public
class
UserApiController
{
@Autowired
@Autowired
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment