Skip to content

Commit 71bcd19

Browse files
authored
Merge pull request #98 from zhangbin1010/dev
[Upgrade] 升级核心库至 6.2.1
2 parents fa53484 + aa38dd0 commit 71bcd19

File tree

14 files changed

+130
-21
lines changed

14 files changed

+130
-21
lines changed

cloud/log-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
cluster-name: ${spring.cloud.nacos.discovery.cluster-name}
2626
group: ${spring.profiles.active}
2727
info:
28-
version: 4.0.0
28+
version: 4.0.1
2929
app-name: ${spring.application.name}
3030
tags:
3131
environment: ${spring.profiles.active}

cloud/oauth-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
cluster-name: ${spring.cloud.nacos.discovery.cluster-name}
2626
group: ${spring.profiles.active}
2727
info:
28-
version: 4.0.0
28+
version: 4.0.1
2929
app-name: ${spring.application.name}
3030
tags:
3131
environment: ${spring.profiles.active}

cloud/route-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
cluster-name: ${spring.cloud.nacos.discovery.cluster-name}
2626
group: ${spring.profiles.active}
2727
info:
28-
version: 4.0.0
28+
version: 4.0.1
2929
app-name: ${spring.application.name}
3030
tags:
3131
environment: ${spring.profiles.active}

cloud/workflow-server/src/main/kotlin/pers/acp/admin/workflow/domain/WorkFlowDomain.kt

+113-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package pers.acp.admin.workflow.domain
22

3+
import org.flowable.bpmn.model.BpmnModel
34
import org.flowable.bpmn.model.FlowElement
45
import org.flowable.bpmn.model.FlowNode
6+
import org.flowable.bpmn.model.SequenceFlow
57
import org.flowable.engine.*
6-
import org.flowable.engine.history.*
8+
import org.flowable.engine.history.HistoricActivityInstance
9+
import org.flowable.engine.history.HistoricVariableUpdate
710
import org.flowable.task.api.TaskInfo
811
import org.springframework.beans.factory.annotation.Autowired
912
import org.springframework.beans.factory.annotation.Qualifier
@@ -16,7 +19,6 @@ import pers.acp.admin.workflow.constant.WorkFlowParamKey
1619
import pers.acp.core.CommonTools
1720
import pers.acp.spring.boot.exceptions.ServerException
1821
import pers.acp.spring.boot.interfaces.LogAdapter
19-
2022
import java.io.InputStream
2123

2224
/**
@@ -247,21 +249,24 @@ constructor(private val logAdapter: LogAdapter,
247249
fun generateDiagram(processInstanceId: String): InputStream =
248250
try {
249251
val processDefinitionId = if (isFinished(processInstanceId)) {
250-
val pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult()
251-
pi.processDefinitionId
252+
historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().processDefinitionId
252253
} else {
253-
val pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult()
254-
pi.processDefinitionId
254+
runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().processDefinitionId
255255
}
256-
val activityIdList: MutableList<String> = mutableListOf()
257-
val historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list()
258-
historicActivityInstanceList.forEach { activityIdList.add(it.activityId) }
259-
val flows: MutableList<String> = mutableListOf()
256+
257+
// 将已经执行的节点ID放入高亮显示节点集合
258+
val historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId)
259+
.orderByHistoricActivityInstanceStartTime().asc().list()
260+
val highLightedActivityIdList: MutableList<String> = mutableListOf()
261+
historicActivityInstanceList.forEach { highLightedActivityIdList.add(it.activityId) }
262+
260263
//获取流程图
261264
val model = repositoryService.getBpmnModel(processDefinitionId)
265+
// 获取已流经的流程线,需要高亮显示高亮流程已发生流转的线id集合
266+
val flows: MutableList<String> = getHighLightedFlows(model, historicActivityInstanceList)
262267
val engineConfiguration = processEngine.processEngineConfiguration
263268
val diagramGenerator = engineConfiguration.processDiagramGenerator
264-
diagramGenerator.generateDiagram(model, "bmp", activityIdList, flows,
269+
diagramGenerator.generateDiagram(model, "bmp", highLightedActivityIdList, flows,
265270
engineConfiguration.activityFontName, engineConfiguration.labelFontName, engineConfiguration.annotationFontName,
266271
engineConfiguration.classLoader, 1.0, true)
267272
} catch (e: Exception) {
@@ -279,4 +284,101 @@ constructor(private val logAdapter: LogAdapter,
279284
return historyService.createHistoricProcessInstanceQuery().finished().processInstanceId(processInstanceId).count() > 0
280285
}
281286

287+
/**
288+
* 获取已流经的流程线,需要高亮显示高亮流程已发生流转的线id集合
289+
* @param model
290+
* @param historicActivityInstanceList
291+
*/
292+
private fun getHighLightedFlows(model: BpmnModel, historicActivityInstanceList: List<HistoricActivityInstance>): MutableList<String> {
293+
// 已流经的流程线,需要高亮显示
294+
val highLightedFlowIdList: MutableList<String> = mutableListOf()
295+
// 全部活动节点
296+
val allHistoricActivityNodeList: MutableList<FlowNode> = mutableListOf()
297+
// 已完成的历史活动节点
298+
val finishedActivityInstanceList: MutableList<HistoricActivityInstance> = mutableListOf()
299+
historicActivityInstanceList.forEach {
300+
// 获取流程节点
301+
val flowNode = model.mainProcess.getFlowElement(it.activityId, true) as FlowNode
302+
allHistoricActivityNodeList.add(flowNode)
303+
// 结束时间不为空,当前节点则已经完成
304+
it.endTime?.apply { finishedActivityInstanceList.add(it) }
305+
}
306+
// 当前流程节点
307+
var currentFlowNode: FlowNode?
308+
// 目标流程节点
309+
var targetFlowNode: FlowNode?
310+
// 当前活动实例
311+
var currentActivityInstance: HistoricActivityInstance
312+
// 遍历已完成的活动实例,从每个实例的outgoingFlows中找到已执行的
313+
for (k in finishedActivityInstanceList.indices) {
314+
currentActivityInstance = finishedActivityInstanceList[k]
315+
currentFlowNode = model.mainProcess.getFlowElement(currentActivityInstance
316+
.activityId, true) as FlowNode
317+
// 当前节点的所有流出线
318+
val outgoingFlowList: List<SequenceFlow> = currentFlowNode.outgoingFlows
319+
/**
320+
* 遍历outgoingFlows并找到已流转的 满足如下条件认为已流转:
321+
* 1.当前节点是并行网关或兼容网关,则通过outgoingFlows能够在历史活动中找到的全部节点均为已流转
322+
* 2.当前节点是以上两种类型之外的,通过outgoingFlows查找到的时间最早的流转节点视为有效流转
323+
* (第2点有问题,有过驳回的,会只绘制驳回的流程线,通过走向下一级的流程线没有高亮显示)
324+
*/
325+
if ("parallelGateway" == currentActivityInstance.activityType || "inclusiveGateway" == currentActivityInstance.activityType) {
326+
// 遍历历史活动节点,找到匹配流程目标节点的
327+
outgoingFlowList.forEach {
328+
// 获取当前节点流程线对应的下级节点
329+
targetFlowNode = model.mainProcess.getFlowElement(it.targetRef,
330+
true) as FlowNode
331+
// 如果下级节点包含在所有历史节点中,则将当前节点的流出线高亮显示
332+
targetFlowNode?.apply {
333+
if (allHistoricActivityNodeList.contains(this)) {
334+
highLightedFlowIdList.add(it.id)
335+
}
336+
}
337+
}
338+
} else {
339+
/**
340+
* 2、当前节点不是并行网关或兼容网关
341+
* 【已解决-问题】如果当前节点有驳回功能,驳回到申请节点,
342+
* 则因为申请节点在历史节点中,导致当前节点驳回到申请节点的流程线被高亮显示,但实际并没有进行驳回操作
343+
*/
344+
// 当前节点ID
345+
val currentActivityId: String = currentActivityInstance.activityId
346+
var ifStartFind = false
347+
var ifFinded = false
348+
var historicActivityInstance: HistoricActivityInstance
349+
// 循环当前节点的所有流出线
350+
// 循环所有历史节点
351+
for (i in historicActivityInstanceList.indices) {
352+
// 如果当前节点流程线对应的下级节点在历史节点中,则该条流程线进行高亮显示(【问题】有驳回流程线时,即使没有进行驳回操作,因为申请节点在历史节点中,也会将驳回流程线高亮显示-_-||)
353+
// 历史节点
354+
historicActivityInstance = historicActivityInstanceList[i]
355+
// 如果循环历史节点中的id等于当前节点id,从当前历史节点继续先后查找是否有当前节点流程线等于的节点
356+
// 历史节点的序号需要大于等于已完成历史节点的序号,防止驳回重审一个节点经过两次是只取第一次的流出线高亮显示,第二次的不显示
357+
if (i >= k && historicActivityInstance.activityId == currentActivityId) {
358+
ifStartFind = true
359+
// 跳过当前节点继续查找下一个节点
360+
continue
361+
}
362+
if (ifStartFind) {
363+
ifFinded = false
364+
for (sequenceFlow in outgoingFlowList) {
365+
// 如果当前节点流程线对应的下级节点在其后面的历史节点中,则该条流程线进行高亮显示
366+
if (historicActivityInstance.activityId == sequenceFlow.targetRef) {
367+
highLightedFlowIdList.add(sequenceFlow.id)
368+
// 暂时默认找到离当前节点最近的下一级节点即退出循环,否则有多条流出线时将全部被高亮显示
369+
ifFinded = true
370+
break
371+
}
372+
}
373+
}
374+
if (ifFinded) {
375+
// 暂时默认找到离当前节点最近的下一级节点即退出历史节点循环,否则有多条流出线时将全部被高亮显示
376+
break
377+
}
378+
}
379+
}
380+
}
381+
return highLightedFlowIdList
382+
}
383+
282384
}

cloud/workflow-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
cluster-name: ${spring.cloud.nacos.discovery.cluster-name}
2626
group: ${spring.profiles.active}
2727
info:
28-
version: 4.0.0
28+
version: 4.0.1
2929
app-name: ${spring.application.name}
3030
tags:
3131
environment: ${spring.profiles.active}

common/admin-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
namespace: 14604291-6d99-44b1-9b59-13d8faf4fdef
2626
cluster-name: ${spring.profiles.active}
2727
info:
28-
version: 4.0.0
28+
version: 4.0.1
2929
app-name: ${spring.application.name}
3030
tags:
3131
environment: ${spring.profiles.active}

common/gateway-server/src/main/resources/bootstrap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spring:
6464
name: GateWayHystrix
6565
fallbackUri: forward:/hystrixhandle
6666
info:
67-
version: 4.0.0
67+
version: 4.0.1
6868
app-name: ${spring.application.name}
6969
tags:
7070
environment: ${spring.profiles.active}

doc/version_history.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
## 版本更新记录
2+
##### v4.0.1
3+
> - [Upgrade] 升级核心库至 6.2.1
4+
> - [Upgrade] 升级 Spring Boot 至 2.1.9.RELEASE
5+
> - [Upgrade] 升级依赖项
6+
> - joda time to "2.10.4"
7+
> - kotlinx-coroutines-core to "1.3.2"
8+
> - Postgresql to "42.2.8"
29
##### v4.0.0
310
> - [Upgrade] 调整工程结构,无需依赖Acp核心库的模块放入common
411
> - [Upgrade] 去除 file-server 模块

gradle/dependencies.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ versions += [
66
jupiter : "5.3.2",
77
junit_platform : "1.3.2",
88

9-
kotlin_coroutines: "1.3.1",
10-
joda_time : "2.10.3",
9+
kotlin_coroutines: "1.3.2",
10+
joda_time : "2.10.4",
1111
commons_codec : "1.12",
1212
commons_text : "1.6",
1313
commons_lang3 : "3.9",
@@ -23,10 +23,10 @@ versions += [
2323
mysql : "8.0.17",
2424
mssqljdbc : "6.4.0.jre8",
2525
ojdbc : "12.1.0.2",
26-
postgresql : "42.2.6",
26+
postgresql : "42.2.8",
2727

2828
jaxb_runtime : "2.3.2",
29-
spring_boot : "2.1.8.RELEASE",
29+
spring_boot : "2.1.9.RELEASE",
3030
spring_cloud : "Greenwich.SR3",
3131
alibaba_cloud : "2.1.0.RELEASE",
3232
swagger : "2.9.2",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)