Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow2
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow2
Commits
fa5e030f
提交
fa5e030f
authored
9月 02, 2021
作者:
黄承天
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[模型模块]新增检查是否已在运行中的机制
上级
304442fd
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
42 行增加
和
3 行删除
+42
-3
TableInfoExService.java
...m/tykj/workflowcore/model/service/TableInfoExService.java
+10
-2
TableInfoService.java
...com/tykj/workflowcore/model/service/TableInfoService.java
+11
-1
FormPageService.java
...workflowcore/workflow_editer/service/FormPageService.java
+5
-0
FormPageServiceImpl.java
...ore/workflow_editer/service/impl/FormPageServiceImpl.java
+16
-0
没有找到文件。
src/main/java/com/tykj/workflowcore/model/service/TableInfoExService.java
浏览文件 @
fa5e030f
...
@@ -10,6 +10,7 @@ import com.tykj.workflowcore.model.entity.TableInfoEx;
...
@@ -10,6 +10,7 @@ import com.tykj.workflowcore.model.entity.TableInfoEx;
import
com.tykj.workflowcore.model.repository.BindRepository
;
import
com.tykj.workflowcore.model.repository.BindRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoExRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoExRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoRepository
;
import
com.tykj.workflowcore.workflow_editer.service.FormPageService
;
import
org.apache.logging.log4j.util.Strings
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -31,7 +32,8 @@ public class TableInfoExService {
...
@@ -31,7 +32,8 @@ public class TableInfoExService {
BindRepository
bindRepository
;
BindRepository
bindRepository
;
@Autowired
@Autowired
TableInfoService
tableInfoService
;
TableInfoService
tableInfoService
;
@Autowired
FormPageService
formPageService
;
public
void
save
(
TableInfoEx
tableInfoEx
)
{
public
void
save
(
TableInfoEx
tableInfoEx
)
{
//数据检查
//数据检查
boolean
exists
=
tableInfoExRepository
.
existsByName
(
tableInfoEx
.
getName
());
boolean
exists
=
tableInfoExRepository
.
existsByName
(
tableInfoEx
.
getName
());
...
@@ -63,11 +65,14 @@ public class TableInfoExService {
...
@@ -63,11 +65,14 @@ public class TableInfoExService {
if
(
nonNull
(
tableInfoEx
.
getId
()))
{
if
(
nonNull
(
tableInfoEx
.
getId
()))
{
throw
new
RuntimeException
(
"修改操作不可附带id"
);
throw
new
RuntimeException
(
"修改操作不可附带id"
);
}
}
Integer
count
=
tableInfoExRepository
.
countByName
(
tableInfoEx
.
getName
());
//检查是否已在运行中
formPageService
.
checkIfWorking
(
tableInfoEx
.
getProcessKey
());
//设置时间
//设置时间
Date
date
=
new
Date
();
Date
date
=
new
Date
();
tableInfoEx
.
setCreatedTime
(
date
);
tableInfoEx
.
setCreatedTime
(
date
);
tableInfoEx
.
setUpdatedTime
(
date
);
tableInfoEx
.
setUpdatedTime
(
date
);
//设置版本号
Integer
count
=
tableInfoExRepository
.
countByName
(
tableInfoEx
.
getName
());
tableInfoEx
.
setVersion
(
count
+
1
);
tableInfoEx
.
setVersion
(
count
+
1
);
//保存数据
//保存数据
Integer
id
=
tableInfoExRepository
.
save
(
tableInfoEx
).
getId
();
Integer
id
=
tableInfoExRepository
.
save
(
tableInfoEx
).
getId
();
...
@@ -96,6 +101,9 @@ public class TableInfoExService {
...
@@ -96,6 +101,9 @@ public class TableInfoExService {
public
List
<
TableInfoEx
>
findByProcessKey
(
String
processKey
)
{
public
List
<
TableInfoEx
>
findByProcessKey
(
String
processKey
)
{
return
tableInfoExRepository
.
findByProcessKey
(
processKey
).
stream
()
return
tableInfoExRepository
.
findByProcessKey
(
processKey
).
stream
()
.
map
(
TableInfoEx:
:
getName
)
.
distinct
()
.
map
(
this
::
findLastVersion
)
.
map
(
this
::
getBinds
)
.
map
(
this
::
getBinds
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
...
...
src/main/java/com/tykj/workflowcore/model/service/TableInfoService.java
浏览文件 @
fa5e030f
package
com
.
tykj
.
workflowcore
.
model
.
service
;
package
com
.
tykj
.
workflowcore
.
model
.
service
;
import
com.tykj.workflowcore.base.result.ApiException
;
import
com.tykj.workflowcore.model.entity.ColumnInfo
;
import
com.tykj.workflowcore.model.entity.ColumnInfo
;
import
com.tykj.workflowcore.model.entity.Quote
;
import
com.tykj.workflowcore.model.entity.Quote
;
import
com.tykj.workflowcore.model.entity.TableInfo
;
import
com.tykj.workflowcore.model.entity.TableInfo
;
import
com.tykj.workflowcore.model.repository.ColumnInfoRepository
;
import
com.tykj.workflowcore.model.repository.ColumnInfoRepository
;
import
com.tykj.workflowcore.model.repository.QuoteRepository
;
import
com.tykj.workflowcore.model.repository.QuoteRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoRepository
;
import
com.tykj.workflowcore.model.repository.TableInfoRepository
;
import
com.tykj.workflowcore.workflow_editer.entity.FlowsInfo
;
import
com.tykj.workflowcore.workflow_editer.service.FormPageService
;
import
com.tykj.workflowcore.workflow_editer.service.WorkFlowService
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -30,6 +35,8 @@ public class TableInfoService {
...
@@ -30,6 +35,8 @@ public class TableInfoService {
private
ColumnInfoRepository
columnInfoRepository
;
private
ColumnInfoRepository
columnInfoRepository
;
@Autowired
@Autowired
private
QuoteRepository
quoteRepository
;
private
QuoteRepository
quoteRepository
;
@Autowired
private
FormPageService
formPageService
;
public
void
save
(
TableInfo
tableInfo
)
{
public
void
save
(
TableInfo
tableInfo
)
{
//数据检查
//数据检查
...
@@ -62,11 +69,14 @@ public class TableInfoService {
...
@@ -62,11 +69,14 @@ public class TableInfoService {
if
(
nonNull
(
tableInfo
.
getId
()))
{
if
(
nonNull
(
tableInfo
.
getId
()))
{
throw
new
RuntimeException
(
"修改操作不可附带id"
);
throw
new
RuntimeException
(
"修改操作不可附带id"
);
}
}
Integer
count
=
tableInfoRepository
.
countByName
(
tableInfo
.
getName
());
//检查是否已经在运行中
formPageService
.
checkIfWorking
(
tableInfo
.
getProcessKey
());
//设置时间
//设置时间
Date
date
=
new
Date
();
Date
date
=
new
Date
();
tableInfo
.
setCreatedTime
(
date
);
tableInfo
.
setCreatedTime
(
date
);
tableInfo
.
setUpdatedTime
(
date
);
tableInfo
.
setUpdatedTime
(
date
);
//设置版本号
Integer
count
=
tableInfoRepository
.
countByName
(
tableInfo
.
getName
());
tableInfo
.
setVersion
(
count
+
1
);
tableInfo
.
setVersion
(
count
+
1
);
//保存数据
//保存数据
Integer
tableInfoId
=
tableInfoRepository
.
save
(
tableInfo
).
getId
();
Integer
tableInfoId
=
tableInfoRepository
.
save
(
tableInfo
).
getId
();
...
...
src/main/java/com/tykj/workflowcore/workflow_editer/service/FormPageService.java
浏览文件 @
fa5e030f
...
@@ -57,5 +57,10 @@ public interface FormPageService {
...
@@ -57,5 +57,10 @@ public interface FormPageService {
Specification
<
FormPage
>
specificationBuild
(
PageFormPageVo
pageFormPageVo
);
Specification
<
FormPage
>
specificationBuild
(
PageFormPageVo
pageFormPageVo
);
/**
* 根据processKey检查是否已在运行中
* @param processKey
*/
void
checkIfWorking
(
String
processKey
);
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/FormPageServiceImpl.java
浏览文件 @
fa5e030f
...
@@ -117,5 +117,21 @@ public class FormPageServiceImpl implements FormPageService {
...
@@ -117,5 +117,21 @@ public class FormPageServiceImpl implements FormPageService {
return
and
.
build
();
return
and
.
build
();
}
}
@Override
public
void
checkIfWorking
(
String
processKey
)
{
//查询对应的processKey
FlowsInfo
byFlowKey
=
flowInfoService
.
findByFlowKey
(
processKey
);
//判断 byFlowKey 是否正在运行
Integer
state
=
byFlowKey
.
getState
();
// 0代表这个流程正在运行过程中
if
(
state
==
0
)
{
throw
new
ApiException
(
"该页面正在流程中运行,无法被修改"
);
}
//判断该流程是否存在正在运行的流程实例如果存在将不允许修改页面
List
<
ProcessInstance
>
processInstances
=
workFlowService
.
queryUnfinishedProcessInstance
(
processKey
);
if
(
processInstances
.
size
()
>
0
)
{
throw
new
ApiException
(
"该页面正在流程中运行,无法被修改.请先停止所有正在运行的流程实例"
);
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论