Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
8220af95
提交
8220af95
authored
4月 22, 2021
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[流程模块] 修改了回调函数时会发生类型错误的Bug
上级
f0d4f878
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
117 行增加
和
89 行删除
+117
-89
WorkflowCoreApplication.java
...n/java/com/tykj/workflowcore/WorkflowCoreApplication.java
+2
-0
Parameter.java
...main/java/com/tykj/workflowcore/api/entity/Parameter.java
+1
-1
ApiService.java
...in/java/com/tykj/workflowcore/api/service/ApiService.java
+3
-2
ApiException.java
.../java/com/tykj/workflowcore/base/result/ApiException.java
+1
-1
SearchTableInfoVo.java
...workflowcore/model_layer/entity/vo/SearchTableInfoVo.java
+1
-1
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+1
-1
FlowsInfoController.java
...wcore/workflow_editer/controller/FlowsInfoController.java
+4
-4
VariableStorage.java
.../workflowcore/workflow_editer/entity/VariableStorage.java
+9
-6
ParameterVo.java
...j/workflowcore/workflow_editer/entity/vo/ParameterVo.java
+1
-1
VariableStorageVo.java
...flowcore/workflow_editer/entity/vo/VariableStorageVo.java
+4
-1
ProcessEndListener.java
...flowcore/workflow_editer/listener/ProcessEndListener.java
+88
-69
VariableStorageServiceImpl.java
...kflow_editer/service/impl/VariableStorageServiceImpl.java
+2
-2
没有找到文件。
src/main/java/com/tykj/workflowcore/WorkflowCoreApplication.java
浏览文件 @
8220af95
...
@@ -13,6 +13,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -13,6 +13,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
public
class
WorkflowCoreApplication
{
public
class
WorkflowCoreApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
WorkflowCoreApplication
.
class
,
args
);
SpringApplication
.
run
(
WorkflowCoreApplication
.
class
,
args
);
System
.
out
.
println
(
System
.
out
.
println
(
"█▀▀▀▀▀▀▀█▀▀▀█▀▀▀█▀▀▀█▀█▀▀▀▀▀▀▀█\n"
+
"█▀▀▀▀▀▀▀█▀▀▀█▀▀▀█▀▀▀█▀█▀▀▀▀▀▀▀█\n"
+
...
...
src/main/java/com/tykj/workflowcore/api/entity/Parameter.java
浏览文件 @
8220af95
...
@@ -23,6 +23,6 @@ public class Parameter {
...
@@ -23,6 +23,6 @@ public class Parameter {
* key为字段名 value为字段值
* key为字段名 value为字段值
*/
*/
@ApiModelProperty
(
value
=
"实例对象"
)
@ApiModelProperty
(
value
=
"实例对象"
)
private
Map
<
String
,
Object
>
instance
;
private
Object
instance
;
}
}
src/main/java/com/tykj/workflowcore/api/service/ApiService.java
浏览文件 @
8220af95
...
@@ -161,8 +161,8 @@ public class ApiService {
...
@@ -161,8 +161,8 @@ public class ApiService {
/**
/**
* 把map转成指定类型的JavaBean对象
* 把map转成指定类型的JavaBean对象
*/
*/
public
static
<
T
>
T
toBean
(
Map
<
String
,
Object
>
map
,
Class
<
T
>
clazz
)
{
public
static
<
T
>
T
toBean
(
Object
o
,
Class
<
T
>
clazz
)
{
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
clazz
);
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
),
clazz
);
}
}
}
}
\ No newline at end of file
src/main/java/com/tykj/workflowcore/base/result/ApiException.java
浏览文件 @
8220af95
...
@@ -16,7 +16,7 @@ public class ApiException extends RuntimeException {
...
@@ -16,7 +16,7 @@ public class ApiException extends RuntimeException {
}
}
public
ApiException
(
String
message
)
{
public
ApiException
(
String
message
)
{
this
.
responseEntity
=
ResponseEntity
.
status
(
500
).
body
(
new
ResultObj
(
message
));
this
.
responseEntity
=
ResponseEntity
.
status
(
500
).
body
(
new
ResultObj
(
""
,
message
));
}
}
public
ApiException
(
Object
data
,
String
message
)
{
public
ApiException
(
Object
data
,
String
message
)
{
...
...
src/main/java/com/tykj/workflowcore/model_layer/entity/vo/SearchTableInfoVo.java
浏览文件 @
8220af95
...
@@ -25,5 +25,5 @@ public class SearchTableInfoVo extends JpaCustomPage {
...
@@ -25,5 +25,5 @@ public class SearchTableInfoVo extends JpaCustomPage {
private
String
modelTitle
;
private
String
modelTitle
;
private
List
<
Integer
>
modelType
;
private
Integer
[]
modelType
;
}
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
8220af95
...
@@ -95,7 +95,7 @@ public class ModelImpl implements ModelService {
...
@@ -95,7 +95,7 @@ public class ModelImpl implements ModelService {
PredicateBuilder
<
TableInfo
>
and
=
Specifications
.
and
();
PredicateBuilder
<
TableInfo
>
and
=
Specifications
.
and
();
and
.
like
(
searchTableInfoVo
.
getModelName
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchTableInfoVo
.
getModelName
()),
"modelName"
,
"%"
+
searchTableInfoVo
.
getModelName
()
+
"%"
);
and
.
like
(
searchTableInfoVo
.
getModelName
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchTableInfoVo
.
getModelName
()),
"modelName"
,
"%"
+
searchTableInfoVo
.
getModelName
()
+
"%"
);
and
.
like
(
searchTableInfoVo
.
getModelTitle
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchTableInfoVo
.
getModelTitle
()),
"modelTitle"
,
"%"
+
searchTableInfoVo
.
getModelTitle
()
+
"%"
);
and
.
like
(
searchTableInfoVo
.
getModelTitle
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchTableInfoVo
.
getModelTitle
()),
"modelTitle"
,
"%"
+
searchTableInfoVo
.
getModelTitle
()
+
"%"
);
and
.
in
(
searchTableInfoVo
.
getModelType
()
!=
null
&&
searchTableInfoVo
.
getModelType
().
size
()
>
0
,
"modelType"
,
searchTableInfoVo
.
getModelType
());
and
.
in
(
searchTableInfoVo
.
getModelType
()
!=
null
&&
searchTableInfoVo
.
getModelType
().
length
>
0
,
"modelType"
,
searchTableInfoVo
.
getModelType
());
return
tableInfoDao
.
findAll
(
and
.
build
(),
searchTableInfoVo
.
getPageable
());
return
tableInfoDao
.
findAll
(
and
.
build
(),
searchTableInfoVo
.
getPageable
());
}
}
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/controller/FlowsInfoController.java
浏览文件 @
8220af95
...
@@ -97,26 +97,26 @@ public class FlowsInfoController {
...
@@ -97,26 +97,26 @@ public class FlowsInfoController {
}
}
@PostMapping
(
"/createFlow"
)
@PostMapping
(
"/createFlow"
)
@Api
ModelProperty
(
"创建流程"
)
@Api
Operation
(
"创建流程"
)
public
ResponseEntity
createFlow
(
@RequestBody
FlowsInfoVo
flowsInfovo
){
public
ResponseEntity
createFlow
(
@RequestBody
FlowsInfoVo
flowsInfovo
){
return
ResultUtil
.
success
(
workFlowService
.
createFlow
(
flowsInfovo
.
toEntity
()),
"流程创建成功"
);
return
ResultUtil
.
success
(
workFlowService
.
createFlow
(
flowsInfovo
.
toEntity
()),
"流程创建成功"
);
}
}
@PostMapping
(
"/saveVariableStorage"
)
@PostMapping
(
"/saveVariableStorage"
)
@Api
ModelProperty
(
"保存函数调用配置"
)
@Api
Operation
(
"保存函数调用配置"
)
public
ResponseEntity
saveVariableStorage
(
@RequestBody
VariableStorageVo
variableStorageVo
){
public
ResponseEntity
saveVariableStorage
(
@RequestBody
VariableStorageVo
variableStorageVo
){
VariableStorage
variableStorage
=
variableStorageService
.
saveVariableStorageService
(
variableStorageVo
.
toEntity
());
VariableStorage
variableStorage
=
variableStorageService
.
saveVariableStorageService
(
variableStorageVo
.
toEntity
());
return
ResultUtil
.
success
(
variableStorage
,
"保存接口调用配置成功"
);
return
ResultUtil
.
success
(
variableStorage
,
"保存接口调用配置成功"
);
}
}
@PostMapping
(
"/searchVariableStorage"
)
@PostMapping
(
"/searchVariableStorage"
)
@Api
ModelProperty
(
"查找函数调用配置"
)
@Api
Operation
(
"查找函数调用配置"
)
public
ResponseEntity
searchVariableStorage
(
@RequestBody
SearchVariableStorageVo
searchVariableStorageVo
){
public
ResponseEntity
searchVariableStorage
(
@RequestBody
SearchVariableStorageVo
searchVariableStorageVo
){
return
ResultUtil
.
success
(
variableStorageService
.
searchVariableStoragePage
(
searchVariableStorageVo
),
"查询接口调用配置成功"
);
return
ResultUtil
.
success
(
variableStorageService
.
searchVariableStoragePage
(
searchVariableStorageVo
),
"查询接口调用配置成功"
);
}
}
@GetMapping
(
"/searchVariableStorage"
)
@GetMapping
(
"/searchVariableStorage"
)
@Api
ModelProperty
(
"根据ID查找函数调用配置"
)
@Api
Operation
(
"根据ID查找函数调用配置"
)
public
ResponseEntity
searchVariableStorageById
(
Integer
id
){
public
ResponseEntity
searchVariableStorageById
(
Integer
id
){
return
ResultUtil
.
success
(
variableStorageService
.
searchVariableById
(
id
),
"查询接口调用配置成功"
);
return
ResultUtil
.
success
(
variableStorageService
.
searchVariableById
(
id
),
"查询接口调用配置成功"
);
}
}
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/entity/VariableStorage.java
浏览文件 @
8220af95
...
@@ -14,6 +14,7 @@ import lombok.Data;
...
@@ -14,6 +14,7 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.Lob
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -41,14 +42,16 @@ public class VariableStorage extends BaseEntity {
...
@@ -41,14 +42,16 @@ public class VariableStorage extends BaseEntity {
private
String
className
;
private
String
className
;
@ApiModelProperty
(
"调用方法"
)
@ApiModelProperty
(
"调用方法"
)
private
String
method
;
private
String
name
;
@ApiModelProperty
(
"方法描述"
)
private
String
description
;
@Lob
@ApiModelProperty
(
"详情json"
)
@ApiModelProperty
(
"详情json"
)
private
String
param
eterInfo
;
private
String
param
s
;
@JsonGetter
public
List
<
ParameterVo
>
getParams
()
{
public
List
<
ParameterVo
>
getParameterInfo
()
{
return
JSON
.
parseObject
(
params
,
new
TypeReference
<
List
<
ParameterVo
>>(){});
return
JSON
.
parseObject
(
parameterInfo
,
new
TypeReference
<
List
<
ParameterVo
>>(){});
}
}
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/entity/vo/ParameterVo.java
浏览文件 @
8220af95
...
@@ -24,6 +24,6 @@ public class ParameterVo {
...
@@ -24,6 +24,6 @@ public class ParameterVo {
private
String
name
;
private
String
name
;
private
List
<
ParameterVo
>
param
s
;
private
List
<
ParameterVo
>
field
s
;
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/entity/vo/VariableStorageVo.java
浏览文件 @
8220af95
...
@@ -38,12 +38,15 @@ public class VariableStorageVo {
...
@@ -38,12 +38,15 @@ public class VariableStorageVo {
@ApiModelProperty
(
"调用方法名"
)
@ApiModelProperty
(
"调用方法名"
)
private
String
name
;
private
String
name
;
@ApiModelProperty
(
"方法描述"
)
private
String
description
;
private
List
<
ParameterVo
>
params
;
private
List
<
ParameterVo
>
params
;
public
VariableStorage
toEntity
(){
public
VariableStorage
toEntity
(){
VariableStorage
variableStorage
=
new
VariableStorage
();
VariableStorage
variableStorage
=
new
VariableStorage
();
BeanUtils
.
copyProperties
(
this
,
variableStorage
);
BeanUtils
.
copyProperties
(
this
,
variableStorage
);
variableStorage
.
setParam
eterInfo
(
JSON
.
toJSONString
(
params
));
variableStorage
.
setParam
s
(
JSON
.
toJSONString
(
params
));
return
variableStorage
;
return
variableStorage
;
}
}
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/listener/ProcessEndListener.java
浏览文件 @
8220af95
...
@@ -6,14 +6,17 @@ import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
...
@@ -6,14 +6,17 @@ import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import
com.tykj.workflowcore.api.controller.ApiController
;
import
com.tykj.workflowcore.api.controller.ApiController
;
import
com.tykj.workflowcore.api.entity.InvokeRequest
;
import
com.tykj.workflowcore.api.entity.InvokeRequest
;
import
com.tykj.workflowcore.api.entity.Parameter
;
import
com.tykj.workflowcore.api.entity.Parameter
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.workflow_editer.entity.CommandGetValue
;
import
com.tykj.workflowcore.workflow_editer.entity.CommandGetValue
;
import
com.tykj.workflowcore.workflow_editer.entity.DataHistory
;
import
com.tykj.workflowcore.workflow_editer.entity.DataHistory
;
import
com.tykj.workflowcore.workflow_editer.entity.JavaTypeEnum
;
import
com.tykj.workflowcore.workflow_editer.entity.VariableStorage
;
import
com.tykj.workflowcore.workflow_editer.entity.VariableStorage
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.InvokeRequestVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.InvokeRequestVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.ParameterVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.ParameterVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.SearchVariableStorageVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.SearchVariableStorageVo
;
import
com.tykj.workflowcore.workflow_editer.service.DataHistoryService
;
import
com.tykj.workflowcore.workflow_editer.service.DataHistoryService
;
import
com.tykj.workflowcore.workflow_editer.service.VariableStorageService
;
import
com.tykj.workflowcore.workflow_editer.service.VariableStorageService
;
import
io.swagger.annotations.Api
;
import
org.flowable.bpmn.model.*
;
import
org.flowable.bpmn.model.*
;
import
liquibase.pro.packaged.I
;
import
liquibase.pro.packaged.I
;
import
org.flowable.bpmn.model.EndEvent
;
import
org.flowable.bpmn.model.EndEvent
;
...
@@ -26,11 +29,6 @@ import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
...
@@ -26,11 +29,6 @@ import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import
org.flowable.engine.delegate.event.FlowableActivityEvent
;
import
org.flowable.engine.delegate.event.FlowableActivityEvent
;
import
org.flowable.engine.delegate.event.impl.FlowableActivityEventImpl
;
import
org.flowable.engine.delegate.event.impl.FlowableActivityEventImpl
;
import
org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.flowable.engine.impl.persistence.entity.ExecutionEntity
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.task.api.Task
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -73,25 +71,6 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
...
@@ -73,25 +71,6 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
@Override
@Override
protected
void
processCompleted
(
FlowableEngineEntityEvent
event
)
{
protected
void
processCompleted
(
FlowableEngineEntityEvent
event
)
{
//流程结束了
// if (event.getEntity() instanceof ProcessInstance){
// ProcessInstance processInstance = (ProcessInstance) event.getEntity();
// String processDefinitionId = processInstance.getProcessDefinitionId();
// String flowKey = processDefinitionId;
// if (processDefinitionId.indexOf(":")>=0){
// flowKey = processDefinitionId.substring(0,processDefinitionId.indexOf(":"));
// }
// List<VariableStorage> variableStorageList = variableStorageService.searchVariableStorageList(new SearchVariableStorageVo(flowKey));
// for (VariableStorage variableStorage : variableStorageList) {
// InvokeRequestVo variableInfo = variableStorage.getInvokeRequest();
// variableInfo.setProcessInstance(processInstance);
// //调用服务接口
//
// //1. 获取调用的具体数值
// apiController.invoke(getApiInvokeParam(variableInfo));
// }
// }
// throw new ApiException("强行报错");
}
}
@Override
@Override
...
@@ -111,55 +90,54 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
...
@@ -111,55 +90,54 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
DelegateExecution
execution
=
((
FlowableActivityEventImpl
)
event
).
getExecution
();
DelegateExecution
execution
=
((
FlowableActivityEventImpl
)
event
).
getExecution
();
if
(
execution
.
getCurrentFlowElement
()
instanceof
EndEvent
){
if
(
execution
.
getCurrentFlowElement
()
instanceof
EndEvent
){
System
.
out
.
println
(
"流程结束了"
);
System
.
out
.
println
(
"流程结束了"
);
String
processDefinitionId
=
((
ExecutionEntityImpl
)
execution
).
getProcessDefinitionKey
();
//拿到流程定义ID
String
flowKey
=
processDefinitionId
;
String
processDefinitionId
=
execution
.
getProcessDefinitionId
();
if
(
processDefinitionId
.
indexOf
(
":"
)>=
0
){
//通过定义Id取到flowKey
flowKey
=
processDefinitionId
.
substring
(
0
,
processDefinitionId
.
indexOf
(
":"
));
String
flowKey
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionId
(
processDefinitionId
).
list
().
get
(
0
).
getKey
();
}
List
<
VariableStorage
>
variableStorageList
=
variableStorageService
.
searchVariableStorageList
(
new
SearchVariableStorageVo
(
flowKey
,
execution
.
getCurrentActivityId
()));
List
<
VariableStorage
>
variableStorageList
=
variableStorageService
.
searchVariableStorageList
(
new
SearchVariableStorageVo
(
flowKey
,
execution
.
getCurrentActivityId
()));
for
(
VariableStorage
variableStorage
:
variableStorageList
)
{
for
(
VariableStorage
variableStorage
:
variableStorageList
)
{
List
<
ParameterVo
>
parameterVoList
=
variableStorage
.
getParam
eterInfo
();
List
<
ParameterVo
>
parameterVoList
=
variableStorage
.
getParam
s
();
InvokeRequest
invokeRequest
=
new
InvokeRequest
();
InvokeRequest
invokeRequest
=
new
InvokeRequest
();
invokeRequest
.
setClassName
(
variableStorage
.
getClassName
());
invokeRequest
.
setClassName
(
variableStorage
.
getClassName
());
invokeRequest
.
setName
(
variableStorage
.
get
Method
());
invokeRequest
.
setName
(
variableStorage
.
get
Name
());
invokeRequest
.
setParams
(
getApiInvokeParam
(
parameterVoList
,
execution
));
invokeRequest
.
setParams
(
getApiInvokeParam
(
parameterVoList
,
execution
));
//调用服务接口
//调用服务接口
apiController
.
invoke
(
invokeRequest
);
apiController
.
invoke
(
invokeRequest
);
}
}
}
}
//开始节点
//
//开始节点
if
(
execution
.
getCurrentFlowElement
()
instanceof
StartEvent
){
//
if (execution.getCurrentFlowElement() instanceof StartEvent){
DataHistory
dataHistory
=
new
DataHistory
();
//
DataHistory dataHistory = new DataHistory();
StartEvent
startEvent
=
(
StartEvent
)
execution
.
getCurrentFlowElement
();
//
StartEvent startEvent = (StartEvent) execution.getCurrentFlowElement();
//流程id 实例id pageId datas userId
//
//流程id 实例id pageId datas userId
String
processInstanceBusinessKey
=
execution
.
getProcessInstanceBusinessKey
();
//
String processInstanceBusinessKey = execution.getProcessInstanceBusinessKey();
dataHistory
.
setFlowKey
(
processInstanceBusinessKey
);
//
dataHistory.setFlowKey(processInstanceBusinessKey);
dataHistory
.
setProcessInstanceId
(
execution
.
getProcessInstanceId
());
//
dataHistory.setProcessInstanceId(execution.getProcessInstanceId());
dataHistory
.
setPageId
(
startEvent
.
getFormKey
());
//
dataHistory.setPageId(startEvent.getFormKey());
// dataHistory.setUserId();
//
//
dataHistory.setUserId();
// dataHistory.setDatas();
//
//
dataHistory.setDatas();
System
.
out
.
println
(
processInstanceBusinessKey
);
//
System.out.println(processInstanceBusinessKey);
//
String
formKey
=
startEvent
.
getFormKey
();
//
String formKey = startEvent.getFormKey();
//通过formKey查询出页面
//
//通过formKey查询出页面
//
}
//
}
if
(
execution
.
getCurrentFlowElement
()
instanceof
UserTask
){
//
if (execution.getCurrentFlowElement() instanceof UserTask){
//查询任务
//
//查询任务
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
//
Task task = taskService.createTaskQuery().singleResult();
Map
<
String
,
Object
>
variables
=
taskService
.
getVariables
(
task
.
getId
());
//
Map<String, Object> variables = taskService.getVariables(task.getId());
DataHistory
dataHistory
=
new
DataHistory
();
//
DataHistory dataHistory = new DataHistory();
String
datas
=
JSON
.
toJSONString
(
variables
);
//
String datas = JSON.toJSONString(variables);
//流程实例id
//
//流程实例id
String
processInstanceId
=
task
.
getProcessInstanceId
();
//
String processInstanceId = task.getProcessInstanceId();
//当前节点id
//
//当前节点id
String
processInstanceBusinessKey
=
execution
.
getProcessInstanceBusinessKey
();
//
String processInstanceBusinessKey = execution.getProcessInstanceBusinessKey();
//
// dataHistory.setTaskId(taskId);
//
//
dataHistory.setTaskId(taskId);
dataHistory
.
setDatas
(
datas
);
//
dataHistory.setDatas(datas);
dataHistory
.
setProcessInstanceId
(
processInstanceId
);
//
dataHistory.setProcessInstanceId(processInstanceId);
dataHistoryService
.
saveData
(
dataHistory
);
//
dataHistoryService.saveData(dataHistory);
}
//
}
}
}
}
}
...
@@ -178,23 +156,47 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
...
@@ -178,23 +156,47 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
parameter
.
setClassName
(
parameterVo
.
getClassName
());
parameter
.
setClassName
(
parameterVo
.
getClassName
());
Map
<
String
,
Object
>
instance
=
new
HashMap
<>();
Map
<
String
,
Object
>
instance
=
new
HashMap
<>();
FillParameter
(
instance
,
parameterVoList
.
get
(
i
),
execution
);
FillParameter
(
instance
,
parameterVoList
.
get
(
i
),
execution
);
parameter
.
setInstance
(
(
Map
<
String
,
Object
>)
instance
.
get
(
parameterVo
.
getName
()));
parameter
.
setInstance
(
instance
.
get
(
parameterVo
.
getName
()));
parameterList
.
add
(
parameter
);
parameterList
.
add
(
parameter
);
}
}
return
parameterList
;
return
parameterList
;
}
}
public
Map
<
String
,
Object
>
FillParameter
(
Map
<
String
,
Object
>
instance
,
ParameterVo
parameterVo
,
DelegateExecution
execution
){
public
Map
<
String
,
Object
>
FillParameter
(
Map
<
String
,
Object
>
instance
,
ParameterVo
parameterVo
,
DelegateExecution
execution
)
{
if
(!
StringUtils
.
isEmpty
(
parameterVo
.
getExp
()))
{
if
(!
StringUtils
.
isEmpty
(
parameterVo
.
getExp
()))
{
//如果是表示式 如:${people}
//如果是表示式 如:${people}
instance
.
put
(
parameterVo
.
getName
(),
getProcessValue
(
execution
,
parameterVo
.
getExp
()));
instance
.
put
(
parameterVo
.
getName
(),
getProcessValue
(
execution
,
parameterVo
.
getExp
()));
}
else
{
}
else
{
instance
.
put
(
parameterVo
.
getName
(),
""
);
if
(
instance
.
get
(
parameterVo
.
getName
())==
null
){
//判断基础类型 为基础类型
Class
<?>
aClass
=
null
;
try
{
aClass
=
Class
.
forName
(
parameterVo
.
getClassName
());
}
catch
(
ClassNotFoundException
e
){
throw
new
ApiException
(
"填充参数时类型转换失败,className:"
+
parameterVo
.
getClassName
());
}
if
(
checkIn
(
parameterVo
.
getClassName
())){
instance
.
put
(
parameterVo
.
getName
(),
null
);
}
else
if
(
Collection
.
class
.
isAssignableFrom
(
aClass
)){
try
{
instance
.
put
(
parameterVo
.
getName
(),
aClass
.
newInstance
());
}
catch
(
InstantiationException
e
)
{
throw
new
ApiException
(
"目标类型无法被实例化,className:"
+
parameterVo
.
getClassName
());
}
catch
(
IllegalAccessException
e
)
{
throw
new
ApiException
(
"无法访问目标类型,className:"
+
parameterVo
.
getClassName
());
}
}
else
{
instance
.
put
(
parameterVo
.
getName
(),
new
HashMap
<>());
}
}
}
}
List
<
ParameterVo
>
parameterVoList
=
parameterVo
.
get
Param
s
();
List
<
ParameterVo
>
parameterVoList
=
parameterVo
.
get
Field
s
();
if
(
parameterVoList
!=
null
&&
parameterVoList
.
size
()>
0
){
if
(
parameterVoList
!=
null
&&
parameterVoList
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
parameterVoList
.
size
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
parameterVoList
.
size
()
;
i
++)
{
FillParameter
(
instance
,
parameterVoList
.
get
(
i
),
execution
);
if
(
instance
.
get
(
parameterVo
.
getName
())
instanceof
Map
){
FillParameter
((
Map
<
String
,
Object
>)
instance
.
get
(
parameterVo
.
getName
()),
parameterVoList
.
get
(
i
),
execution
);
}
}
}
}
}
return
instance
;
return
instance
;
...
@@ -206,4 +208,21 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
...
@@ -206,4 +208,21 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
return
expression
.
getValue
(
execution
);
return
expression
.
getValue
(
execution
);
}
}
public
Boolean
checkIn
(
String
className
){
JavaTypeEnum
[]
values
=
JavaTypeEnum
.
values
();
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
if
(
className
.
equals
(
values
[
i
].
getName
())){
return
true
;
};
}
return
false
;
}
public
static
void
main
(
String
[]
args
)
throws
ClassNotFoundException
{
Class
<?>
aClass
=
Class
.
forName
(
ArrayList
.
class
.
getName
());
if
(
Collection
.
class
.
isAssignableFrom
(
aClass
)){
System
.
out
.
println
(
"1"
);
}
}
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/VariableStorageServiceImpl.java
浏览文件 @
8220af95
...
@@ -56,8 +56,8 @@ public class VariableStorageServiceImpl implements VariableStorageService {
...
@@ -56,8 +56,8 @@ public class VariableStorageServiceImpl implements VariableStorageService {
PredicateBuilder
predicateBuilder
=
Specifications
.
and
();
PredicateBuilder
predicateBuilder
=
Specifications
.
and
();
if
(
searchVariableStorageVo
!=
null
){
if
(
searchVariableStorageVo
!=
null
){
predicateBuilder
.
eq
(
searchVariableStorageVo
.
getId
()!=
null
,
"id"
,
searchVariableStorageVo
.
getId
());
predicateBuilder
.
eq
(
searchVariableStorageVo
.
getId
()!=
null
,
"id"
,
searchVariableStorageVo
.
getId
());
predicateBuilder
.
eq
(
StringUtils
.
isEmpty
(
searchVariableStorageVo
.
getFlowKey
()),
"flowKey"
,
searchVariableStorageVo
.
getFlowKey
());
predicateBuilder
.
eq
(
!
StringUtils
.
isEmpty
(
searchVariableStorageVo
.
getFlowKey
()),
"flowKey"
,
searchVariableStorageVo
.
getFlowKey
());
predicateBuilder
.
eq
(
StringUtils
.
isEmpty
(
searchVariableStorageVo
.
getActivityId
()),
"activityId"
,
searchVariableStorageVo
.
getActivityId
());
predicateBuilder
.
eq
(
!
StringUtils
.
isEmpty
(
searchVariableStorageVo
.
getActivityId
()),
"activityId"
,
searchVariableStorageVo
.
getActivityId
());
}
}
return
variableStorageMapper
.
findAll
(
predicateBuilder
.
build
(),
searchVariableStorageVo
.
getPageable
());
return
variableStorageMapper
.
findAll
(
predicateBuilder
.
build
(),
searchVariableStorageVo
.
getPageable
());
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论