Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
2
议题
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow
Commits
2b84cf00
提交
2b84cf00
authored
4月 28, 2021
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[模型模块] 修改扫描时的一些逻辑
[工作流模块] 修复了回调时填充集合类型时报错
上级
a5d1214f
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
64 行增加
和
56 行删除
+64
-56
ModelController.java
.../workflowcore/model_layer/controller/ModelController.java
+7
-6
TableInfo.java
...a/com/tykj/workflowcore/model_layer/entity/TableInfo.java
+3
-2
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+35
-37
CreateTableUtil.java
.../tykj/workflowcore/model_layer/utils/CreateTableUtil.java
+2
-2
FlowsInfoController.java
...wcore/workflow_editer/controller/FlowsInfoController.java
+10
-2
ProcessEndListener.java
...flowcore/workflow_editer/listener/ProcessEndListener.java
+5
-7
VariableStorageService.java
...wcore/workflow_editer/service/VariableStorageService.java
+2
-0
没有找到文件。
src/main/java/com/tykj/workflowcore/model_layer/controller/ModelController.java
浏览文件 @
2b84cf00
...
...
@@ -78,11 +78,11 @@ public class ModelController {
@ApiOperation
(
"新增数据模型"
)
@PostMapping
(
value
=
"/addModel"
)
public
ResponseEntity
addModel
(
@RequestBody
TableVO
tableVO
)
throws
Exception
{
List
<
TableInfo
>
tableInfos
=
modelService
.
listAllEntities
(
null
);
for
(
TableInfo
tableInfo
:
tableInfos
)
{
if
(
tableVO
.
getModelName
().
equals
(
tableInfo
.
getModelName
()))
{
return
ResultUtil
.
failed
(
"表已经存在!"
);
}
SearchTableInfoVo
searchTableInfoVo
=
new
SearchTableInfoVo
(
);
searchTableInfoVo
.
setModelName
(
tableVO
.
getModelName
());
List
<
TableInfo
>
tableInfos
=
modelService
.
listAllEntities
(
searchTableInfoVo
);
if
(
tableInfos
.
size
()>
0
){
return
ResultUtil
.
failed
(
"表已经存在!"
);
}
long
start
=
System
.
currentTimeMillis
();
...
...
@@ -141,7 +141,8 @@ public class ModelController {
**/
@ApiOperation
(
"复杂查询"
)
@GetMapping
(
"/complexQuery"
)
public
ResponseEntity
complexQuery
(
String
tableName
,
List
<
QueryCondition
>
queryConditions
)
{
public
ResponseEntity
complexQuery
(
@RequestParam
(
value
=
"tableName"
)
String
tableName
,
@RequestParam
(
value
=
"queryConditions"
,
required
=
false
)
List
<
QueryCondition
>
queryConditions
)
{
List
list
=
modelService
.
complexQuery
(
tableName
,
queryConditions
);
if
(
list
!=
null
)
{
return
ResultUtil
.
success
(
list
,
"查询成功!"
);
...
...
src/main/java/com/tykj/workflowcore/model_layer/entity/TableInfo.java
浏览文件 @
2b84cf00
...
...
@@ -22,7 +22,7 @@ import java.io.Serializable;
*/
@WorkFlowCoreNoScan
@Entity
//
@Table(name = "workflow_table_info")
@Table
(
name
=
"workflow_table_info"
)
@EntityListeners
(
AuditingEntityListener
.
class
)
@Data
@SQLDelete
(
sql
=
"update table_info set deleted = 1 where id = ?"
)
...
...
@@ -30,9 +30,10 @@ import java.io.Serializable;
public
class
TableInfo
extends
BaseEntity
{
@ApiModelProperty
(
"
表
名,不能为空"
)
@ApiModelProperty
(
"
数据对象
名,不能为空"
)
@Column
(
nullable
=
false
)
private
String
modelName
;
@ApiModelProperty
(
"表中文名,不能为空"
)
@Column
(
nullable
=
false
)
private
String
modelTitle
;
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
2b84cf00
...
...
@@ -17,6 +17,7 @@ import com.tykj.workflowcore.model_layer.utils.SessionUtil;
import
com.tykj.workflowcore.model_layer.utils.SqlUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
javafx.scene.control.Tab
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.hibernate.Session
;
...
...
@@ -124,7 +125,7 @@ public class ModelImpl implements ModelService {
* @Date 16:15 2021/3/5
**/
@Override
public
List
<
ColumnInfo
>
showModelFields
(
SearchColumnInfoVo
searchColumnInfoVo
)
{
public
List
<
ColumnInfo
>
showModelFields
(
SearchColumnInfoVo
searchColumnInfoVo
)
{
PredicateBuilder
<
ColumnInfo
>
and
=
Specifications
.
and
();
and
.
eq
(
searchColumnInfoVo
.
getDbId
()
!=
null
,
"dbId"
,
searchColumnInfoVo
.
getDbId
());
and
.
eq
(
searchColumnInfoVo
.
getDbName
()
!=
null
&&
StringUtils
.
isNotEmpty
(
searchColumnInfoVo
.
getDbName
()),
"dbName"
,
searchColumnInfoVo
.
getDbName
());
...
...
@@ -151,12 +152,8 @@ public class ModelImpl implements ModelService {
}
else
{
tableVO
.
setModelType
(
ModelType
.
BUSINESS
);
}
sessionUtil
.
addXml
(
xmlMapping
);
Session
session
=
sessionUtil
.
getSession
();
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
TableInfo
tableInfo
=
new
TableInfo
();
tableInfo
.
setModelName
(
tableVO
.
getModelName
());
...
...
@@ -291,19 +288,20 @@ public class ModelImpl implements ModelService {
TableInfo
tableInfo
=
new
TableInfo
();
TableVO
tableVO
=
new
TableVO
();
//入表真实名称
String
realName
=
""
;
String
tableName
=
""
;
String
className
=
""
;
if
(!
aClass
.
isAnnotationPresent
(
WorkFlowCoreNoScan
.
class
))
{
if
(
aClass
.
isAnnotationPresent
(
Entity
.
class
))
{
className
=
getClassName
(
aClass
.
toString
());
if
(
aClass
.
isAnnotationPresent
(
Table
.
class
))
{
Table
table
=
aClass
.
getAnnotation
(
Table
.
class
);
if
(!
""
.
equals
(
table
.
name
())
&&
table
.
name
()
!=
null
)
{
realName
=
table
.
name
();
tableName
=
table
.
name
();
}
else
{
tableName
=
className
;
}
}
else
{
String
className
=
getClassName
(
aClass
.
toString
());
realName
=
className
;
}
tableVO
.
setModelName
(
real
Name
);
tableVO
.
setModelName
(
class
Name
);
//获得类中文描述
if
(
aClass
.
isAnnotationPresent
(
ApiModel
.
class
))
{
ApiModel
annotation
=
aClass
.
getAnnotation
(
ApiModel
.
class
);
...
...
@@ -320,7 +318,6 @@ public class ModelImpl implements ModelService {
}
//获得类所有属性
Field
[]
declaredFields
=
aClass
.
getDeclaredFields
();
java
.
lang
.
reflect
.
Type
genericType
;
List
<
ColumnVO
>
list
=
new
ArrayList
<>();
ColumnVO
primaryColumn
=
new
ColumnVO
();
...
...
@@ -385,29 +382,32 @@ public class ModelImpl implements ModelService {
list
.
addAll
(
otherColumns
);
tableVO
.
setDataList
(
list
);
//扫描的xml
String
xml
=
createTable
(
tableVO
.
getModelName
(),
primaryColumn
,
otherColumns
);
String
xml
=
createTable
(
tableVO
.
getModelName
(),
tableName
,
primaryColumn
,
otherColumns
);
tableInfo
.
setModelName
(
tableVO
.
getModelName
());
tableInfo
.
setModelTitle
(
tableVO
.
getModelTitle
());
tableInfo
.
setXml
(
xml
);
tableInfo
.
setModelType
(
ModelType
.
BASICS
);
//判断是否存在
if
(
checkRepeat
(
realName
))
{
//查出tableInfo是否存在
TableInfo
tableInfoByTableName
=
getTableInfoByTableName
(
className
);
if
(
tableInfoByTableName
==
null
)
{
tableInfo
=
tableInfoDao
.
save
(
tableInfo
);
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
for
(
ColumnVO
columnVO
:
dataList
)
{
ColumnInfo
columnInfo
=
new
ColumnInfo
();
columnInfo
.
setFieldName
(
columnVO
.
getFieldName
());
columnInfo
.
setFieldType
(
columnVO
.
getFieldType
());
columnInfo
.
setFieldLength
(
columnVO
.
getFieldLength
());
columnInfo
.
setFieldTitle
(
columnVO
.
getFieldTitle
());
columnInfo
.
setPrimaryKey
(
columnVO
.
getPrimaryKey
());
columnInfo
.
setDbName
(
realName
);
columnInfo
.
setDbId
(
tableInfo
.
getId
());
columnInfoDao
.
save
(
columnInfo
);
}
}
else
{
log
.
warn
(
"{}已存在"
,
realName
);
tableInfoByTableName
.
setXml
(
xml
);
tableInfo
=
tableInfoDao
.
save
(
tableInfoByTableName
);
log
.
warn
(
"{}已存在更新XML"
,
className
);
}
//保存ColumnInfo
List
<
ColumnVO
>
dataList
=
tableVO
.
getDataList
();
for
(
ColumnVO
columnVO
:
dataList
)
{
ColumnInfo
columnInfo
=
new
ColumnInfo
();
columnInfo
.
setFieldName
(
columnVO
.
getFieldName
());
columnInfo
.
setFieldType
(
columnVO
.
getFieldType
());
columnInfo
.
setFieldLength
(
columnVO
.
getFieldLength
());
columnInfo
.
setFieldTitle
(
columnVO
.
getFieldTitle
());
columnInfo
.
setPrimaryKey
(
columnVO
.
getPrimaryKey
());
columnInfo
.
setDbName
(
className
);
columnInfo
.
setDbId
(
tableInfo
.
getId
());
columnInfoDao
.
save
(
columnInfo
);
}
}
}
...
...
@@ -421,7 +421,7 @@ public class ModelImpl implements ModelService {
* @Description 判重
* @Date 10:50 2021/3/11
**/
public
boolean
checkRepeat
(
String
tableName
)
{
public
TableInfo
getTableInfoByTableName
(
String
tableName
)
{
Specification
spec
=
(
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
Path
name
=
root
.
get
(
"modelName"
);
Predicate
equal
=
criteriaBuilder
.
equal
(
name
,
tableName
);
...
...
@@ -429,13 +429,10 @@ public class ModelImpl implements ModelService {
};
List
<
TableInfo
>
all
=
tableInfoDao
.
findAll
(
spec
);
for
(
TableInfo
tableInfo
:
all
)
{
String
name
=
tableInfo
.
getModelName
();
if
(
tableName
.
equals
(
name
))
{
return
false
;
}
if
(
all
!=
null
&&
all
.
size
()>
0
){
return
all
.
get
(
0
);
}
return
true
;
return
null
;
}
/**
...
...
@@ -663,7 +660,8 @@ public class ModelImpl implements ModelService {
List
<
TableInfo
>
tableInfoList
=
tableInfoDao
.
findAllByModelType
(
ModelType
.
BASICS
);
for
(
TableInfo
tableInfo
:
tableInfoList
)
{
/*删除columnInfo*/
//
columnInfoDao.deleteAllByDbId(tableInfo.getId());
columnInfoDao
.
deleteAllByDbId
(
tableInfo
.
getId
());
}
}
}
src/main/java/com/tykj/workflowcore/model_layer/utils/CreateTableUtil.java
浏览文件 @
2b84cf00
...
...
@@ -75,7 +75,7 @@ public class CreateTableUtil {
}
public
static
String
createTable
(
String
entityName
,
ColumnVO
primaryColumn
,
List
<
ColumnVO
>
dataList
)
{
public
static
String
createTable
(
String
entityName
,
String
tableName
,
ColumnVO
primaryColumn
,
List
<
ColumnVO
>
dataList
)
{
// 1sql-type="text" string 转为text文本,2长度超过会自动转换
// List<ColumnVO> dataList = tableVO.getDataList();
String
xmlMapping
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+
...
...
@@ -83,7 +83,7 @@ public class CreateTableUtil {
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
+
" \"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd\">\n"
+
"<hibernate-mapping>\n"
+
" <class entity-name=\""
+
entityName
+
"\" table=\""
+
entity
Name
+
"\">\n"
;
" <class entity-name=\""
+
entityName
+
"\" table=\""
+
table
Name
+
"\">\n"
;
xmlMapping
+=
" <id name=\""
+
primaryColumn
.
getFieldName
()+
"\" type=\""
+
primaryColumn
.
getFieldType
()+
"\" unsaved-value=\"null\" >\n"
+
" </id>"
;
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/controller/FlowsInfoController.java
浏览文件 @
2b84cf00
package
com
.
tykj
.
workflowcore
.
workflow_editer
.
controller
;
import
com.tykj.workflowcore.base.result.ResultUtil
;
import
com.tykj.workflowcore.workflow_editer.dao.VariableStorageMapper
;
import
com.tykj.workflowcore.workflow_editer.entity.FlowsInfo
;
import
com.tykj.workflowcore.workflow_editer.entity.VariableStorage
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.*
;
...
...
@@ -38,10 +39,10 @@ public class FlowsInfoController {
private
WorkFlowService
workFlowService
;
@Autowired
private
NodeInfoService
nodeInfo
Service
;
private
VariableStorageService
variableStorage
Service
;
@Autowired
private
VariableStorageService
variableStorageService
;
VariableStorageMapper
variableStorageMapper
;
@PostMapping
(
"/searchAllFlowInfo"
)
...
...
@@ -121,4 +122,11 @@ public class FlowsInfoController {
return
ResultUtil
.
success
(
variableStorageService
.
searchVariableById
(
id
),
"查询接口调用配置成功"
);
}
@DeleteMapping
(
"/deleteVariableStorageById"
)
@ApiOperation
(
"根据ID删除函数调用配置"
)
public
ResponseEntity
deleteVariableStorageById
(
Integer
id
){
variableStorageMapper
.
deleteById
(
id
);
return
ResultUtil
.
success
(
null
,
"删除成功"
);
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/listener/ProcessEndListener.java
浏览文件 @
2b84cf00
...
...
@@ -4,7 +4,7 @@ import com.tykj.workflowcore.api.controller.ApiController;
import
com.tykj.workflowcore.api.entity.InvokeRequest
;
import
com.tykj.workflowcore.api.entity.Parameter
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.workflow_editer.entity.
enums.
JavaTypeEnum
;
import
com.tykj.workflowcore.workflow_editer.entity.JavaTypeEnum
;
import
com.tykj.workflowcore.workflow_editer.entity.VariableStorage
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.ParameterVo
;
import
com.tykj.workflowcore.workflow_editer.entity.vo.SearchVariableStorageVo
;
...
...
@@ -170,12 +170,10 @@ public class ProcessEndListener extends AbstractFlowableEngineEventListener {
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
());
if
(
List
.
class
.
isAssignableFrom
(
aClass
)){
instance
.
put
(
parameterVo
.
getName
(),
new
ArrayList
<>());
}
else
{
instance
.
put
(
parameterVo
.
getName
(),
new
HashSet
<>());
}
}
else
{
instance
.
put
(
parameterVo
.
getName
(),
new
HashMap
<>());
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/VariableStorageService.java
浏览文件 @
2b84cf00
...
...
@@ -40,4 +40,6 @@ public interface VariableStorageService {
VariableStorage
searchVariableById
(
Integer
id
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论