Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cd830380
authored
Sep 23, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]流程树查询
1 parent
b68032e5
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
0 deletions
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstLinkMapper.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstNodeMapper.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstLinkService.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstNodeService.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopTplLinkService.java
platform-process/src/main/resources/mapper/SopInstLinkMapper.xml
platform-process/src/main/resources/mapper/SopInstNodeMapper.xml
platform-process/src/test/java/cn/com/glsx/test/TestApplication.java
platform-process-api/src/main/java/cn/com/glsx/process/modules/entity/SopInstNode.java
View file @
cd83038
...
...
@@ -3,6 +3,8 @@ package cn.com.glsx.process.modules.entity;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.Transient
;
import
java.util.List
;
@Table
(
name
=
"sop_inst_node"
)
public
class
SopInstNode
{
...
...
@@ -104,6 +106,17 @@ public class SopInstNode {
@Column
(
name
=
"node_status"
)
private
Integer
nodeStatus
;
@Transient
private
List
<
SopInstNode
>
sopInstNodeList
;
public
List
<
SopInstNode
>
getSopInstNodeList
()
{
return
sopInstNodeList
;
}
public
void
setSopInstNodeList
(
List
<
SopInstNode
>
sopInstNodeList
)
{
this
.
sopInstNodeList
=
sopInstNodeList
;
}
/**
* 获取实例节点id
*
...
...
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstLinkMapper.java
View file @
cd83038
...
...
@@ -3,7 +3,11 @@ package cn.com.glsx.process.modules.mapper;
import
cn.com.glsx.process.modules.entity.SopInstLink
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
SopInstLinkMapper
extends
CommonBaseMapper
<
SopInstLink
>
{
List
<
SopInstLink
>
findByInstId
(
@Param
(
"instId"
)
String
instId
);
}
\ No newline at end of file
platform-process-api/src/main/java/cn/com/glsx/process/modules/mapper/SopInstNodeMapper.java
View file @
cd83038
...
...
@@ -3,7 +3,11 @@ package cn.com.glsx.process.modules.mapper;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
SopInstNodeMapper
extends
CommonBaseMapper
<
SopInstNode
>
{
List
<
SopInstNode
>
findByInstId
(
@Param
(
"instId"
)
String
instId
);
}
\ No newline at end of file
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstLinkService.java
View file @
cd83038
package
cn
.
com
.
glsx
.
process
.
modules
.
service
;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
cn.com.glsx.process.modules.entity.SopInstLink
;
import
cn.com.glsx.process.modules.mapper.SopInstLinkMapper
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
SopInstLinkService
{
@Autowired
private
SopInstLinkMapper
sopInstMapper
;
@Autowired
private
SopInstNodeService
sopInstNodeService
;
/**
* 根据id查询
*
...
...
@@ -59,4 +67,31 @@ public class SopInstLinkService {
}
return
false
;
}
/**
* 根据id查询
*
* @param instId
* @return
*/
public
List
<
SopInstNode
>
findByInstId
(
String
instId
)
{
List
<
SopInstLink
>
byInstId
=
sopInstMapper
.
findByInstId
(
instId
);
List
<
SopInstNode
>
sopInstNodes
=
sopInstNodeService
.
findByInstId
(
instId
);
List
<
SopInstNode
>
collected
=
sopInstNodes
.
stream
().
filter
(
index
->
index
.
getNodeId
().
intValue
()
==
1
).
collect
(
Collectors
.
toList
());
setchildren
(
collected
,
byInstId
,
sopInstNodes
);
return
collected
;
}
private
void
setchildren
(
List
<
SopInstNode
>
sopInstNode
,
List
<
SopInstLink
>
byInstId
,
List
<
SopInstNode
>
sopInstNodes
)
{
for
(
SopInstNode
instNode
:
sopInstNode
)
{
Integer
nodeId
=
instNode
.
getNodeId
();
List
<
Integer
>
collect
=
byInstId
.
stream
().
filter
(
index
->
index
.
getSourceId
().
intValue
()
==
nodeId
).
map
(
SopInstLink:
:
getTargetId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
instNode
.
setSopInstNodeList
(
sopInstNodes
.
stream
().
filter
(
index
->
collect
.
contains
(
index
.
getNodeId
())).
collect
(
Collectors
.
toList
()));
setchildren
(
instNode
.
getSopInstNodeList
(),
byInstId
,
sopInstNodes
);
}
continue
;
}
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstNodeService.java
View file @
cd83038
...
...
@@ -6,6 +6,8 @@ import org.springframework.stereotype.Service;
import
cn.com.glsx.process.modules.entity.SopInstNode
;
import
cn.com.glsx.process.modules.mapper.SopInstNodeMapper
;
import
java.util.List
;
@Service
public
class
SopInstNodeService
{
...
...
@@ -59,4 +61,8 @@ public class SopInstNodeService {
}
return
false
;
}
public
List
<
SopInstNode
>
findByInstId
(
String
instId
)
{
return
sopInstNodeMapper
.
findByInstId
(
instId
);
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopTplLinkService.java
View file @
cd83038
...
...
@@ -60,4 +60,5 @@ public class SopTplLinkService {
return
false
;
}
}
platform-process/src/main/resources/mapper/SopInstLinkMapper.xml
View file @
cd83038
...
...
@@ -16,4 +16,9 @@
-->
link_id, inst_id, source_id, target_id
</sql>
<select
id=
"findByInstId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
SELECT * FROM sop_inst_link WHERE inst_id=#{instId}
</select>
</mapper>
\ No newline at end of file
platform-process/src/main/resources/mapper/SopInstNodeMapper.xml
View file @
cd83038
...
...
@@ -28,4 +28,11 @@
inst_node_id, inst_id, node_id, node_name, node_type, node_label, node_key, node_show,
node_param, node_content, node_visible, node_skip, node_cron, node_expire_cron, node_status
</sql>
<select
id=
"findByInstId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
SELECT
node_id, node_name,node_type
FROM sop_inst_node WHERE inst_id=#{instId}
</select>
</mapper>
\ No newline at end of file
platform-process/src/test/java/cn/com/glsx/test/TestApplication.java
View file @
cd83038
...
...
@@ -7,6 +7,9 @@ import java.util.concurrent.CyclicBarrier;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
cn.com.glsx.process.modules.service.SopInstLinkService
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,6 +48,9 @@ public class TestApplication {
@Autowired
private
SopInstNodeExecuteJobHandler
sopInstNodeExecuteJobHandler
;
@Autowired
private
SopInstLinkService
sopInstLinkService
;
@Test
public
void
test
()
throws
SQLException
{
SopDataSource
byId
=
sopDataSourceService
.
findByDataSourceId
(
"SOP_CDP"
);
...
...
@@ -137,5 +143,11 @@ public class TestApplication {
JSON
execute
=
ControllerHttpDemo
.
execute
(
jsonObject
);
System
.
out
.
println
(
execute
);
}
@Test
public
void
findByInstId
()
{
List
<
SopInstNode
>
xblc7
=
sopInstLinkService
.
findByInstId
(
"xblc7"
);
String
listString
=
JSON
.
toJSONString
(
xblc7
,
SerializerFeature
.
DisableCircularReferenceDetect
);
System
.
out
.
println
(
listString
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment