Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
c42911a4
提交
c42911a4
authored
4月 19, 2021
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[流程编辑器] 修改了保存流程的逻辑
[流程编辑器] 更新了回调函数的逻辑-》支持回调函数
上级
656b4923
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
99 行增加
和
114 行删除
+99
-114
Parameter.java
...main/java/com/tykj/workflowcore/api/entity/Parameter.java
+0
-3
AggregationController.java
...lowcore/model_layer/controller/AggregationController.java
+6
-0
AggregationDao.java
...com/tykj/workflowcore/model_layer/dao/AggregationDao.java
+2
-1
AggregationImpl.java
...orkflowcore/model_layer/service/impl/AggregationImpl.java
+0
-52
FlowsInfoController.java
...wcore/workflow_editer/controller/FlowsInfoController.java
+1
-1
VariableStorage.java
.../workflowcore/workflow_editer/entity/VariableStorage.java
+6
-4
FlowsInfoVo.java
...j/workflowcore/workflow_editer/entity/vo/FlowsInfoVo.java
+11
-20
ParameterVo.java
...j/workflowcore/workflow_editer/entity/vo/ParameterVo.java
+29
-0
VariableStorageVo.java
...flowcore/workflow_editer/entity/vo/VariableStorageVo.java
+4
-2
ProcessEndListener.java
...flowcore/workflow_editer/listener/ProcessEndListener.java
+39
-31
VariableStorageServiceImpl.java
...kflow_editer/service/impl/VariableStorageServiceImpl.java
+1
-0
WorkFlowServiceImpl.java
...ore/workflow_editer/service/impl/WorkFlowServiceImpl.java
+0
-0
没有找到文件。
src/main/java/com/tykj/workflowcore/api/entity/Parameter.java
浏览文件 @
c42911a4
...
...
@@ -18,9 +18,6 @@ public class Parameter {
@ApiModelProperty
(
value
=
"类名"
)
private
String
className
;
@ApiModelProperty
(
"流程表达式"
)
private
String
exp
;
/**
* Map形式的实例对象
* key为字段名 value为字段值
...
...
src/main/java/com/tykj/workflowcore/model_layer/controller/AggregationController.java
浏览文件 @
c42911a4
...
...
@@ -43,6 +43,12 @@ public class AggregationController {
return
ResultUtil
.
success
(
""
,
"保存成功!"
);
}
@PostMapping
(
"/findTest"
)
public
ResponseEntity
findTest
(
Integer
id
)
{
return
ResultUtil
.
success
(
aggregationDao
.
findAllByTableInfoExIdAndParentId
(
id
,
null
),
"保存成功!"
);
}
@PostMapping
(
"/test"
)
public
ResponseEntity
test
(
@RequestBody
AggregationVO
AggregationVO
)
{
String
result
=
""
;
...
...
src/main/java/com/tykj/workflowcore/model_layer/dao/AggregationDao.java
浏览文件 @
c42911a4
...
...
@@ -15,6 +15,7 @@ import java.util.List;
*/
public
interface
AggregationDao
extends
JpaRepository
<
Aggregation
,
Integer
>,
JpaSpecificationExecutor
<
Aggregation
>
{
List
<
Aggregation
>
findAllByTableInfoExIdAndParentId
(
Integer
tableExId
,
Integer
parentId
);
List
<
Aggregation
>
findAllByTableInfoExIdAndParentId
(
Integer
tableExId
,
Integer
parrentId
);
}
src/main/java/com/tykj/workflowcore/model_layer/service/impl/AggregationImpl.java
浏览文件 @
c42911a4
...
...
@@ -88,7 +88,6 @@ public class AggregationImpl implements AggregationService {
}
else
{
throw
new
ApiException
(
"id为:"
+
parentAggregation
.
getSideTableId
()+
"的副表不存在"
);
}
parentModeName
=
sideTableInfoOptional
.
get
().
getModelName
();
}
else
{
//如果是第一层 则通过rootElement 查出副表的XML字符串
...
...
@@ -157,55 +156,4 @@ public class AggregationImpl implements AggregationService {
return
null
;
}
// 假设获得的是一份XML
// public Element testDG(List<Aggregation> aggregations, Aggregation parentAggregation, Integer mainId, Element element){
// //循环
// Element elementCLass = DocumentHelper.createElement("class");
// if (parentAggregation!=null){
// elementCLass.addAttribute("name",parentAggregation.getSideTableId()+"_");
// }else {
// elementCLass.addAttribute("name",mainId+"_");
// }
// for (int i = 0; i < aggregations.size(); i++) {
// Aggregation aggregationChild = aggregations.get(i);
// if (aggregationChild.getAggregations()!=null&&aggregationChild.getAggregations().size()>0){
// Element elementClassChild = testDG(aggregationChild.getAggregations(), aggregationChild, mainId, element);
// Element elementSet = DocumentHelper.createElement("set");
// elementSet.addAttribute("setName","c"+elementClassChild.attribute("name").getValue());
// elementCLass.add(elementSet);
// }else {
// Element elementSet = DocumentHelper.createElement("set");
// elementSet.addAttribute("setName","c"+aggregationChild.getSideTableId());
// elementCLass.add(elementSet);
// }
// }
// element.add(elementCLass);
// return elementCLass;
// }
// Optional<TableInfo> sideTableById = tableInfoDao.findById(aggregationChild.getSideTableId());
// aggregationChild.setTableInfoExId(tableExId);
// if (!sideTableById.isPresent()){
// throw new ApiException("id为:"+aggregationChild.getSideTableId()+"的副表不存在");
// }
// if (aggregationChild.getRelationship().equals(AggregationType.ONE_TO_ONE)){
// AggregationUtil.addOneToOne(aggregationChild.getSideTableConnectionKey(), sideTableById.get().getModelName(), document);
// }
// if (aggregationChild.getRelationship().equals(AggregationType.ONE_TO_MANY)){
// //如果是一对多需要 为 aggregationRelationship 生成连接的KEY
// String mainTableConnectionKey = sideTableById.get().getModelName();
// AggregationUtil.addOneToMany(sideTableById.get().getModelName(), mainTableConnectionKey, aggregationChild.getSideTableConnectionKey(), document);
// }
// if (aggregationChild.getRelationship().equals(AggregationType.MANY_TO_MANY)){
// //如果是多对多需要 为 aggregationRelationship 生成连接的KEY
// String mainTableConnectionKey = mainTableInfo.getModelName()+"_Id";
// String sideTableConnectionKey = sideTableById.get().getModelName()+"_Id";
// aggregationChild.setMainTableConnectionKey(mainTableConnectionKey);
// aggregationChild.setSideTableConnectionKey(sideTableConnectionKey);
// //如果是多对多需要 为 aggregationRelationship 生成连接的中间表名
// String connectionTableName = mainTableInfo.getModelName()+"_"+sideTableById.get().getModelName()+"_"+ (UUID.randomUUID().toString().substring(0,8));
// aggregationChild.setConnectionTableName(connectionTableName);
// //Util.addManyToMany
// AggregationUtil.addManyToMany(sideTableById.get().getModelName(),connectionTableName,mainTableConnectionKey,sideTableConnectionKey,document);
// }
}
src/main/java/com/tykj/workflowcore/workflow_editer/controller/FlowsInfoController.java
浏览文件 @
c42911a4
...
...
@@ -76,7 +76,7 @@ public class FlowsInfoController {
@ApiOperation
(
value
=
"保存xml以及其他流程信息"
)
public
ResponseEntity
saveXml
(
@RequestBody
FlowsInfoVo
flowsInfoVo
)
throws
IOException
,
XMLStreamException
{
//保存节点信息
nodeInfoService
.
saveNodeInfoList
(
flowsInfoVo
.
getNodeInfoList
());
//
nodeInfoService.saveNodeInfoList(flowsInfoVo.getNodeInfoList());
//保存xml信息
workFlowService
.
flowXml
(
flowsInfoVo
);
return
ResultUtil
.
success
(
"文件保存成功"
);
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/entity/VariableStorage.java
浏览文件 @
c42911a4
package
com
.
tykj
.
workflowcore
.
workflow_editer
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.fasterxml.jackson.annotation.JsonGetter
;
import
com.tykj.workflowcore.base.entity.BaseEntity
;
import
com.tykj.workflowcore.model_layer.annotations.WorkFlowCoreNoScan
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.InvokeRequestVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.ParameterVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
...
...
@@ -12,6 +14,7 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
java.util.List
;
/**
* ClassName: VariableStorage
...
...
@@ -41,12 +44,11 @@ public class VariableStorage extends BaseEntity {
private
String
method
;
@ApiModelProperty
(
"详情json"
)
private
String
invokeRequest
;
private
String
parameterInfo
;
@JsonGetter
public
InvokeRequestVo
getInvokeRequest
()
{
return
JSON
.
parseObject
(
invokeRequest
,
InvokeRequestVo
.
class
);
public
List
<
ParameterVo
>
getParameterInfo
()
{
return
JSON
.
parseObject
(
parameterInfo
,
new
TypeReference
<
List
<
ParameterVo
>>(){}
);
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/entity/vo/FlowsInfoVo.java
浏览文件 @
c42911a4
package
com
.
tykj
.
workflowcore
.
workflow_editer
.
entity
.
vo
;
import
cn.hutool.core.util.StrUtil
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.tykj.workflowcore.workflow_editer.entity.FlowsInfo
;
import
com.tykj.workflowcore.workflow_editer.entity.NodeInfo
;
...
...
@@ -28,9 +29,6 @@ public class FlowsInfoVo {
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
"发起人的名字"
)
private
Integer
userName
;
@ApiModelProperty
(
"流程名称"
)
private
String
flowName
;
...
...
@@ -40,32 +38,25 @@ public class FlowsInfoVo {
@ApiModelProperty
(
value
=
"部署状态"
,
notes
=
"0 已部署,1 未部署"
)
private
Integer
state
=
1
;
@ApiModelProperty
(
"流程创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"流程修改时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
"流程描述"
)
private
String
flowDescribe
;
@ApiModelProperty
private
String
fileXml
;
@ApiModelProperty
(
"开始节点的id"
)
private
String
startId
;
@ApiModelProperty
(
"开始节点的id"
)
private
String
startPageId
;
@ApiModelProperty
(
"是否和之前一样 0是一样 1不一样"
)
private
Integer
isOld
=
1
;
@ApiModelProperty
()
private
List
<
NodeInfo
>
nodeInfoList
;
public
FlowsInfo
toEntity
(){
FlowsInfo
flowsInfo
=
new
FlowsInfo
();
BeanUtils
.
copyProperties
(
this
,
flowsInfo
);
return
flowsInfo
;
}
public
FlowsInfo
toEntity
(
FlowsInfo
oldFlowsInfo
){
if
(!
StrUtil
.
isEmpty
(
flowName
)){
oldFlowsInfo
.
setFlowName
(
flowName
);
}
if
(!
StrUtil
.
isEmpty
(
flowDescribe
)){
oldFlowsInfo
.
setFlowDescribe
(
flowDescribe
);
}
return
oldFlowsInfo
;
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/entity/vo/ParameterVo.java
0 → 100644
浏览文件 @
c42911a4
package
com
.
tykj
.
workflowcore
.
workflow_editer
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* 回调接口配置Vo
* @author HuangXiahao
* @version V1.0
* @class parameterVo
* @packageName com.tykj.workflowcore.workflow_editer.entity.vo
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ParameterVo
{
private
String
className
;
private
String
exp
;
private
String
name
;
private
List
<
ParameterVo
>
parameterVoList
;
}
src/main/java/com/tykj/workflowcore/workflow_editer/entity/vo/VariableStorageVo.java
浏览文件 @
c42911a4
...
...
@@ -10,6 +10,8 @@ import lombok.NoArgsConstructor;
import
org.springframework.beans.BeanUtils
;
import
springfox.documentation.spring.web.json.Json
;
import
java.util.List
;
/**
* @author HuangXiahao
* @version V1.0
...
...
@@ -36,12 +38,12 @@ public class VariableStorageVo {
@ApiModelProperty
(
"调用方法名"
)
private
String
method
;
private
InvokeRequestVo
invokeReque
st
;
private
List
<
ParameterVo
>
parameterLi
st
;
public
VariableStorage
toEntity
(){
VariableStorage
variableStorage
=
new
VariableStorage
();
BeanUtils
.
copyProperties
(
this
,
variableStorage
);
variableStorage
.
set
InvokeRequest
(
JSON
.
toJSONString
(
invokeReque
st
));
variableStorage
.
set
ParameterInfo
(
JSON
.
toJSONString
(
parameterLi
st
));
return
variableStorage
;
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/listener/ProcessEndListener.java
浏览文件 @
c42911a4
...
...
@@ -7,8 +7,10 @@ import com.tykj.workflowcore.api.entity.Parameter;
import
com.tykj.workflowcore.workflow_editer.entity.CommandGetValue
;
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.ParameterVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.SearchVariableStorageVo
;
import
com.tykj.workflowcore.workflow_editer.service.VariableStorageService
;
import
liquibase.pro.packaged.I
;
import
org.flowable.bpmn.model.EndEvent
;
import
org.flowable.common.engine.api.delegate.Expression
;
import
org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent
;
...
...
@@ -20,16 +22,14 @@ import org.flowable.engine.delegate.event.FlowableActivityEvent;
import
org.flowable.engine.delegate.event.impl.FlowableActivityEventImpl
;
import
org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl
;
import
org.flowable.engine.impl.persistence.entity.ExecutionEntity
;
import
org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.*
;
/**
* @author HuangXiahao
...
...
@@ -97,17 +97,20 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
DelegateExecution
execution
=
((
FlowableActivityEventImpl
)
event
).
getExecution
();
if
(
execution
.
getCurrentFlowElement
()
instanceof
EndEvent
){
System
.
out
.
println
(
"流程结束了"
);
String
processDefinitionId
=
execution
.
getProcessDefinitionId
();
String
processDefinitionId
=
((
ExecutionEntityImpl
)
execution
).
getProcessDefinitionKey
();
String
flowKey
=
processDefinitionId
;
if
(
processDefinitionId
.
indexOf
(
":"
)>=
0
){
flowKey
=
processDefinitionId
.
substring
(
0
,
processDefinitionId
.
indexOf
(
":"
));
}
}
List
<
VariableStorage
>
variableStorageList
=
variableStorageService
.
searchVariableStorageList
(
new
SearchVariableStorageVo
(
flowKey
,
execution
.
getCurrentActivityId
()));
for
(
VariableStorage
variableStorage
:
variableStorageList
)
{
InvokeRequestVo
variableInfo
=
variableStorage
.
getInvokeRequest
();
variableInfo
.
setProcessInstance
(
execution
);
List
<
ParameterVo
>
parameterVoList
=
variableStorage
.
getParameterInfo
();
InvokeRequest
invokeRequest
=
new
InvokeRequest
();
invokeRequest
.
setClassName
(
variableStorage
.
getClassName
());
invokeRequest
.
setName
(
variableStorage
.
getMethod
());
invokeRequest
.
setParams
(
getApiInvokeParam
(
parameterVoList
,
execution
));
//调用服务接口
apiController
.
invoke
(
getApiInvokeParam
(
variableInfo
)
);
apiController
.
invoke
(
invokeRequest
);
}
}
}
...
...
@@ -116,33 +119,38 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
/**
* 获取调用Api用的参数
*
* @param
invokeRequestVo
调用服务接口vo
* @param
parameterVoList
调用服务接口vo
* @return 调用服务接口实体
*/
public
InvokeRequest
getApiInvokeParam
(
InvokeRequestVo
invokeRequestVo
)
{
public
List
<
Parameter
>
getApiInvokeParam
(
List
<
ParameterVo
>
parameterVoList
,
DelegateExecution
execution
)
{
//拿出taskId
DelegateExecution
execution
=
invokeRequestVo
.
getProcessInstance
();
List
<
Parameter
>
parameterList
=
invokeRequestVo
.
getParams
();
List
<
Parameter
>
newParameterList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
parameterList
.
size
();
i
++)
{
Parameter
parameter
=
parameterList
.
get
(
i
);
if
(!
StringUtils
.
isEmpty
(
parameter
.
getExp
()))
{
//如果是表示式 如:${people}
parameter
.
setInstance
((
Map
<
String
,
Object
>)
getProcessValue
(
execution
,
parameter
.
getExp
()));
}
else
{
Map
<
String
,
Object
>
instance
=
parameter
.
getInstance
();
JSONObject
newInstance
=
new
JSONObject
();
//遍历param的key
Set
<
String
>
oldInstanceKey
=
instance
.
keySet
();
for
(
String
key
:
oldInstanceKey
)
{
newInstance
.
put
(
key
,
getProcessValue
(
execution
,
(
String
)
instance
.
get
(
key
)));
}
parameter
.
setInstance
(
newInstance
);
List
<
Parameter
>
parameterList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
parameterVoList
.
size
();
i
++)
{
ParameterVo
parameterVo
=
parameterVoList
.
get
(
i
);
Parameter
parameter
=
new
Parameter
();
parameter
.
setClassName
(
parameterVo
.
getClassName
());
Map
<
String
,
Object
>
instance
=
new
HashMap
<>();
FillParameter
(
instance
,
parameterVoList
.
get
(
i
),
execution
);
parameter
.
setInstance
((
Map
<
String
,
Object
>)
instance
.
get
(
parameterVo
.
getName
()));
parameterList
.
add
(
parameter
);
}
return
parameterList
;
}
public
Map
<
String
,
Object
>
FillParameter
(
Map
<
String
,
Object
>
instance
,
ParameterVo
parameterVo
,
DelegateExecution
execution
){
if
(!
StringUtils
.
isEmpty
(
parameterVo
.
getExp
()))
{
//如果是表示式 如:${people}
instance
.
put
(
parameterVo
.
getName
(),
getProcessValue
(
execution
,
parameterVo
.
getExp
()));
}
else
{
instance
.
put
(
parameterVo
.
getName
(),
""
);
}
List
<
ParameterVo
>
parameterVoList
=
parameterVo
.
getParameterVoList
();
if
(
parameterVoList
!=
null
&&
parameterVoList
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
parameterVoList
.
size
()
;
i
++)
{
FillParameter
(
instance
,
parameterVoList
.
get
(
i
),
execution
);
}
newParameterList
.
add
(
i
,
parameter
);
}
invokeRequestVo
.
setParams
(
newParameterList
);
return
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
invokeRequestVo
),
InvokeRequest
.
class
);
return
instance
;
}
public
Object
getProcessValue
(
DelegateExecution
execution
,
String
exp
)
{
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/VariableStorageServiceImpl.java
浏览文件 @
c42911a4
...
...
@@ -40,6 +40,7 @@ public class VariableStorageServiceImpl implements VariableStorageService {
if
(
searchVariableStorageVo
!=
null
){
predicateBuilder
.
eq
(
searchVariableStorageVo
.
getId
()!=
null
,
"id"
,
searchVariableStorageVo
.
getId
());
predicateBuilder
.
eq
(
searchVariableStorageVo
.
getFlowKey
()!=
null
,
"flowKey"
,
searchVariableStorageVo
.
getFlowKey
());
predicateBuilder
.
eq
(
searchVariableStorageVo
.
getActivityId
()!=
null
,
"activityId"
,
searchVariableStorageVo
.
getActivityId
());
}
return
variableStorageMapper
.
findAll
(
predicateBuilder
.
build
());
}
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/WorkFlowServiceImpl.java
浏览文件 @
c42911a4
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论