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
771dac8c
Commit
771dac8c
authored
Jul 16, 2019
by
Java-曹文达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监听测试 添加工具类解决无法注入bean的问题
parent
a8c1e2d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
4 deletions
+54
-4
UserInfoMapper.xml
src/main/java/com/bbd/bpm/dao/UserInfoMapper.xml
+1
-1
BpmEmployee.java
src/main/java/com/bbd/bpm/domain/BpmEmployee.java
+3
-0
ApprovedDetailBean.java
src/main/java/com/bbd/bpm/dto/response/ApprovedDetailBean.java
+4
-0
PutAssigneeListener.java
src/main/java/com/bbd/bpm/listener/PutAssigneeListener.java
+6
-3
ApplicationContextHolder.java
src/main/java/com/bbd/bpm/util/ApplicationContextHolder.java
+40
-0
No files found.
src/main/java/com/bbd/bpm/dao/UserInfoMapper.xml
View file @
771dac8c
...
@@ -136,7 +136,7 @@
...
@@ -136,7 +136,7 @@
<select
id=
"getUserId"
parameterType=
"com.bbd.bpm.domain.BpmEmployee"
resultType=
"com.bbd.bpm.domain.BpmEmployee"
>
<select
id=
"getUserId"
parameterType=
"com.bbd.bpm.domain.BpmEmployee"
resultType=
"com.bbd.bpm.domain.BpmEmployee"
>
SELECT
SELECT
user_
id userId
user_
code userCode
FROM
FROM
bpm_employee
bpm_employee
where position=#{position}
where position=#{position}
...
...
src/main/java/com/bbd/bpm/domain/BpmEmployee.java
View file @
771dac8c
...
@@ -28,6 +28,9 @@ public class BpmEmployee extends BaseEntity {
...
@@ -28,6 +28,9 @@ public class BpmEmployee extends BaseEntity {
//用户标识
//用户标识
@Column
(
name
=
"user_id"
)
@Column
(
name
=
"user_id"
)
private
Integer
userId
;
private
Integer
userId
;
//用户code
@Column
(
name
=
"user_code"
)
private
String
userCode
;
}
}
src/main/java/com/bbd/bpm/dto/response/ApprovedDetailBean.java
View file @
771dac8c
package
com
.
bbd
.
bpm
.
dto
.
response
;
package
com
.
bbd
.
bpm
.
dto
.
response
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -11,8 +13,10 @@ public class ApprovedDetailBean {
...
@@ -11,8 +13,10 @@ public class ApprovedDetailBean {
private
String
assigneeUserId
;
private
String
assigneeUserId
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
private
Date
startTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
private
Date
endTime
;
private
String
comments
;
private
String
comments
;
...
...
src/main/java/com/bbd/bpm/listener/PutAssigneeListener.java
View file @
771dac8c
...
@@ -5,6 +5,7 @@ import com.bbd.bpm.repository.UserRepository;
...
@@ -5,6 +5,7 @@ import com.bbd.bpm.repository.UserRepository;
import
com.bbd.bpm.result.Result
;
import
com.bbd.bpm.result.Result
;
import
com.bbd.bpm.service.UserInfoService
;
import
com.bbd.bpm.service.UserInfoService
;
import
com.bbd.bpm.serviceImpl.UserInfoServiceImpl
;
import
com.bbd.bpm.serviceImpl.UserInfoServiceImpl
;
import
com.bbd.bpm.util.ApplicationContextHolder
;
import
com.bbd.bpm.util.ContextUtils
;
import
com.bbd.bpm.util.ContextUtils
;
import
org.activiti.engine.ProcessEngine
;
import
org.activiti.engine.ProcessEngine
;
import
org.activiti.engine.ProcessEngines
;
import
org.activiti.engine.ProcessEngines
;
...
@@ -16,10 +17,12 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,10 +17,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Optional
;
/**
/**
* Created by houkang on 2019/1/28.
* Created by houkang on 2019/1/28.
*/
*/
@Component
public
class
PutAssigneeListener
implements
Serializable
,
TaskListener
{
public
class
PutAssigneeListener
implements
Serializable
,
TaskListener
{
private
FixedValue
job
;
private
FixedValue
job
;
...
@@ -29,8 +32,6 @@ public class PutAssigneeListener implements Serializable, TaskListener {
...
@@ -29,8 +32,6 @@ public class PutAssigneeListener implements Serializable, TaskListener {
private
FixedValue
company
;
private
FixedValue
company
;
@Autowired
private
UserInfoService
userInfoService
;
@Override
@Override
...
@@ -49,6 +50,8 @@ public class PutAssigneeListener implements Serializable, TaskListener {
...
@@ -49,6 +50,8 @@ public class PutAssigneeListener implements Serializable, TaskListener {
ProcessEngine
processEngine
=
ProcessEngines
.
getDefaultProcessEngine
();
ProcessEngine
processEngine
=
ProcessEngines
.
getDefaultProcessEngine
();
TaskService
taskService
=
processEngine
.
getTaskService
();
TaskService
taskService
=
processEngine
.
getTaskService
();
UserInfoService
userInfoService
=
ApplicationContextHolder
.
getBean
(
UserInfoService
.
class
).
orElse
(
null
);
BpmEmployee
bpmEmployee
=
new
BpmEmployee
();
BpmEmployee
bpmEmployee
=
new
BpmEmployee
();
BpmEmployee
bpmEmployee1
=
new
BpmEmployee
();
BpmEmployee
bpmEmployee1
=
new
BpmEmployee
();
...
@@ -74,7 +77,7 @@ public class PutAssigneeListener implements Serializable, TaskListener {
...
@@ -74,7 +77,7 @@ public class PutAssigneeListener implements Serializable, TaskListener {
}
}
}
}
//取出查到的userId 标识
//取出查到的userId 标识
delegateTask
.
setAssignee
(
bpmEmployee
.
getUser
Id
().
toString
());
delegateTask
.
setAssignee
(
bpmEmployee
.
getUser
Code
());
}
}
}
else
{
}
else
{
taskService
.
setAssignee
(
delegateTask
.
getId
(),
"hr"
);
taskService
.
setAssignee
(
delegateTask
.
getId
(),
"hr"
);
...
...
src/main/java/com/bbd/bpm/util/ApplicationContextHolder.java
0 → 100644
View file @
771dac8c
package
com
.
bbd
.
bpm
.
util
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Component
;
import
java.util.Optional
;
/**
* Created by houkang on 2019/3/19.
*/
@Component
public
class
ApplicationContextHolder
implements
ApplicationContextAware
{
private
static
ApplicationContext
context
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
context
=
applicationContext
;
}
public
static
<
T
>
Optional
<
T
>
getBean
(
Class
<
T
>
type
){
if
(
context
==
null
){
return
Optional
.
empty
();
}
return
Optional
.
of
(
context
.
getBean
(
type
));
}
public
static
<
T
>
Optional
<
T
>
getBean
(
String
name
,
Class
<
T
>
type
){
if
(
context
==
null
){
return
Optional
.
empty
();
}
return
Optional
.
of
(
context
.
getBean
(
name
,
type
));
}
}
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