Browse Source
1) 修复 orm BetweenInclusive 日期bug 2)工作流增加流程实例属性扩展表 前端核心发布: 8.2.121 1) 修改默认导出功能,导出文件名默认为列表的标题.xlsxmain
93 changed files with 2889 additions and 886 deletions
@ -0,0 +1,142 @@ |
|||
<template> |
|||
<div ref="containerRef"></div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
/* |
|||
import { ref, onMounted } from 'vue'; |
|||
import BpmnViewer from 'bpmn-js'; |
|||
|
|||
const containerRef = ref(); |
|||
let viewer; |
|||
const xml = |
|||
"<?xml version='1.0' encoding='UTF-8'?>\n" + |
|||
' <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.8.0">\n' + |
|||
' <process id="SAMPLE" name="示例流程" isExecutable="true">\n' + |
|||
' <dataObject id="assignment-strategy" name="分配策略" itemSubjectRef="xsd:string">\n' + |
|||
' <extensionElements>\n' + |
|||
' <flowable:value>{"A2":"platformAssigneeQueryService"}</flowable:value>\n' + |
|||
' </extensionElements>\n' + |
|||
' </dataObject>\n' + |
|||
' <startEvent id="start" name="开始" flowable:formFieldValidation="true"/>\n' + |
|||
' <userTask id="A1" name="提交申请" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true" flowable:skipExpression="${execution.getVariable(\'skipFirst\') == true}">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <userTask id="A2" name="复核" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <flowable:taskListener event="assignment" delegateExpression="${flowableSendMailListener}">\n' + |
|||
' <flowable:field name="title">\n' + |
|||
' <flowable:string><![CDATA[您有一个 [示例] 流程的 [复核] 任务等待处理]]></flowable:string>\n' + |
|||
' </flowable:field>\n' + |
|||
' <flowable:field name="content">\n' + |
|||
' <flowable:string><![CDATA[${assignee},您好! 您有一个 [示例] 流程的 [复核] 任务等待处理,详情参见: http://localhost:8080]]></flowable:string>\n' + |
|||
' </flowable:field>\n' + |
|||
' </flowable:taskListener>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <endEvent id="end" name="结束"/>\n' + |
|||
' <sequenceFlow id="sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" sourceRef="start" targetRef="A1"/>\n' + |
|||
' <sequenceFlow id="sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" sourceRef="A1" targetRef="A2"/>\n' + |
|||
' <userTask id="A3" name="认定" default="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <sequenceFlow id="sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" sourceRef="A2" targetRef="A3"/>\n' + |
|||
' <userTask id="A4" name="最终认定" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <sequenceFlow id="sid-87E440E2-0998-4C95-B4A4-444397ADB79C" sourceRef="A4" targetRef="end"/>\n' + |
|||
' <sequenceFlow id="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" sourceRef="A3" targetRef="A4"/>\n' + |
|||
' <sequenceFlow id="sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" name="退回给复核岗" sourceRef="A3" targetRef="A2">\n' + |
|||
' <conditionExpression xsi:type="tFormalExpression"><![CDATA[${goback == -1}]]></conditionExpression>\n' + |
|||
' </sequenceFlow>\n' + |
|||
' <sequenceFlow id="sid-8C796912-0699-4ADA-9F3F-91154970C7E2" name="退回给申请人" sourceRef="A3" targetRef="A1">\n' + |
|||
' <conditionExpression xsi:type="tFormalExpression"><![CDATA[${goback == -2}]]></conditionExpression>\n' + |
|||
' </sequenceFlow>\n' + |
|||
' </process>\n' + |
|||
' <bpmndi:BPMNDiagram id="BPMNDiagram_SAMPLE">\n' + |
|||
' <bpmndi:BPMNPlane bpmnElement="SAMPLE" id="BPMNPlane_SAMPLE">\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">\n' + |
|||
' <omgdc:Bounds height="30.0" width="30.0" x="60.0" y="168.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A1" id="BPMNShape_A1">\n' + |
|||
' <omgdc:Bounds height="40.0" width="96.0" x="120.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A2" id="BPMNShape_A2">\n' + |
|||
' <omgdc:Bounds height="40.0" width="81.0" x="255.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">\n' + |
|||
' <omgdc:Bounds height="28.0" width="28.0" x="615.0" y="166.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A3" id="BPMNShape_A3">\n' + |
|||
' <omgdc:Bounds height="42.0" width="82.0" x="375.0" y="159.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A4" id="BPMNShape_A4">\n' + |
|||
' <omgdc:Bounds height="40.0" width="92.0" x="495.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" id="BPMNEdge_sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="40.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="416.0" y="159.0"/>\n' + |
|||
' <omgdi:waypoint x="416.0" y="77.0"/>\n' + |
|||
' <omgdi:waypoint x="295.0" y="77.0"/>\n' + |
|||
' <omgdi:waypoint x="295.0" y="160.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" id="BPMNEdge_sid-95DCA487-E110-49BB-86F9-C623692DD8BA" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="46.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="456.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="494.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" id="BPMNEdge_sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" flowable:sourceDockerX="40.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="41.0" flowable:targetDockerY="21.0">\n' + |
|||
' <omgdi:waypoint x="335.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="375.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-8C796912-0699-4ADA-9F3F-91154970C7E2" id="BPMNEdge_sid-8C796912-0699-4ADA-9F3F-91154970C7E2" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="48.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="416.0" y="201.0"/>\n' + |
|||
' <omgdi:waypoint x="416.0" y="284.0"/>\n' + |
|||
' <omgdi:waypoint x="168.0" y="284.0"/>\n' + |
|||
' <omgdi:waypoint x="168.0" y="200.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-87E440E2-0998-4C95-B4A4-444397ADB79C" id="BPMNEdge_sid-87E440E2-0998-4C95-B4A4-444397ADB79C" flowable:sourceDockerX="46.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">\n' + |
|||
' <omgdi:waypoint x="586.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="615.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" id="BPMNEdge_sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" flowable:sourceDockerX="48.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="40.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="215.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="254.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" id="BPMNEdge_sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="48.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="89.0" y="183.0"/>\n' + |
|||
' <omgdi:waypoint x="120.0" y="182.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' </bpmndi:BPMNPlane>\n' + |
|||
' </bpmndi:BPMNDiagram>\n' + |
|||
' </definitions>'; |
|||
onMounted(() => { |
|||
viewer = new BpmnViewer({ |
|||
container: containerRef.value, |
|||
}); |
|||
viewer |
|||
.importXML(xml) |
|||
.then((result) => { |
|||
const { warnings } = result; |
|||
console.log('success !', warnings); |
|||
viewer.get('canvas').zoom('fit-viewport'); |
|||
}) |
|||
.catch(function (err) { |
|||
const { warnings, message } = err; |
|||
console.log('something went wrong:', warnings, message); |
|||
}); |
|||
}); |
|||
*/ |
|||
</script> |
@ -0,0 +1,142 @@ |
|||
<template> |
|||
<div ref="containerRef"></div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
/* |
|||
import { ref, onMounted } from 'vue'; |
|||
import BpmnViewer from 'bpmn-js'; |
|||
|
|||
const containerRef = ref(); |
|||
let viewer; |
|||
const xml = |
|||
"<?xml version='1.0' encoding='UTF-8'?>\n" + |
|||
' <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef" exporter="Flowable Open Source Modeler" exporterVersion="6.8.0">\n' + |
|||
' <process id="SAMPLE" name="示例流程" isExecutable="true">\n' + |
|||
' <dataObject id="assignment-strategy" name="分配策略" itemSubjectRef="xsd:string">\n' + |
|||
' <extensionElements>\n' + |
|||
' <flowable:value>{"A2":"platformAssigneeQueryService"}</flowable:value>\n' + |
|||
' </extensionElements>\n' + |
|||
' </dataObject>\n' + |
|||
' <startEvent id="start" name="开始" flowable:formFieldValidation="true"/>\n' + |
|||
' <userTask id="A1" name="提交申请" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true" flowable:skipExpression="${execution.getVariable(\'skipFirst\') == true}">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <userTask id="A2" name="复核" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <flowable:taskListener event="assignment" delegateExpression="${flowableSendMailListener}">\n' + |
|||
' <flowable:field name="title">\n' + |
|||
' <flowable:string><![CDATA[您有一个 [示例] 流程的 [复核] 任务等待处理]]></flowable:string>\n' + |
|||
' </flowable:field>\n' + |
|||
' <flowable:field name="content">\n' + |
|||
' <flowable:string><![CDATA[${assignee},您好! 您有一个 [示例] 流程的 [复核] 任务等待处理,详情参见: http://localhost:8080]]></flowable:string>\n' + |
|||
' </flowable:field>\n' + |
|||
' </flowable:taskListener>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <endEvent id="end" name="结束"/>\n' + |
|||
' <sequenceFlow id="sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" sourceRef="start" targetRef="A1"/>\n' + |
|||
' <sequenceFlow id="sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" sourceRef="A1" targetRef="A2"/>\n' + |
|||
' <userTask id="A3" name="认定" default="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <sequenceFlow id="sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" sourceRef="A2" targetRef="A3"/>\n' + |
|||
' <userTask id="A4" name="最终认定" flowable:assignee="${assignee}" flowable:candidateGroups="admin" flowable:formFieldValidation="true">\n' + |
|||
' <extensionElements>\n' + |
|||
' <modeler:group-info-name-admin xmlns:modeler="http://flowable.org/modeler"><![CDATA[系统管理员]]></modeler:group-info-name-admin>\n' + |
|||
' <modeler:activiti-idm-candidate-group xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-candidate-group>\n' + |
|||
' <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>\n' + |
|||
' </extensionElements>\n' + |
|||
' </userTask>\n' + |
|||
' <sequenceFlow id="sid-87E440E2-0998-4C95-B4A4-444397ADB79C" sourceRef="A4" targetRef="end"/>\n' + |
|||
' <sequenceFlow id="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" sourceRef="A3" targetRef="A4"/>\n' + |
|||
' <sequenceFlow id="sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" name="退回给复核岗" sourceRef="A3" targetRef="A2">\n' + |
|||
' <conditionExpression xsi:type="tFormalExpression"><![CDATA[${goback == -1}]]></conditionExpression>\n' + |
|||
' </sequenceFlow>\n' + |
|||
' <sequenceFlow id="sid-8C796912-0699-4ADA-9F3F-91154970C7E2" name="退回给申请人" sourceRef="A3" targetRef="A1">\n' + |
|||
' <conditionExpression xsi:type="tFormalExpression"><![CDATA[${goback == -2}]]></conditionExpression>\n' + |
|||
' </sequenceFlow>\n' + |
|||
' </process>\n' + |
|||
' <bpmndi:BPMNDiagram id="BPMNDiagram_SAMPLE">\n' + |
|||
' <bpmndi:BPMNPlane bpmnElement="SAMPLE" id="BPMNPlane_SAMPLE">\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="start" id="BPMNShape_start">\n' + |
|||
' <omgdc:Bounds height="30.0" width="30.0" x="60.0" y="168.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A1" id="BPMNShape_A1">\n' + |
|||
' <omgdc:Bounds height="40.0" width="96.0" x="120.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A2" id="BPMNShape_A2">\n' + |
|||
' <omgdc:Bounds height="40.0" width="81.0" x="255.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="end" id="BPMNShape_end">\n' + |
|||
' <omgdc:Bounds height="28.0" width="28.0" x="615.0" y="166.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A3" id="BPMNShape_A3">\n' + |
|||
' <omgdc:Bounds height="42.0" width="82.0" x="375.0" y="159.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNShape bpmnElement="A4" id="BPMNShape_A4">\n' + |
|||
' <omgdc:Bounds height="40.0" width="92.0" x="495.0" y="160.5"/>\n' + |
|||
' </bpmndi:BPMNShape>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" id="BPMNEdge_sid-74A758E1-9AB1-4E1C-9D03-EF323869EB4E" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="40.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="416.0" y="159.0"/>\n' + |
|||
' <omgdi:waypoint x="416.0" y="77.0"/>\n' + |
|||
' <omgdi:waypoint x="295.0" y="77.0"/>\n' + |
|||
' <omgdi:waypoint x="295.0" y="160.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-95DCA487-E110-49BB-86F9-C623692DD8BA" id="BPMNEdge_sid-95DCA487-E110-49BB-86F9-C623692DD8BA" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="46.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="456.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="494.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" id="BPMNEdge_sid-60D2D382-C039-4E2F-BC47-348DB6E9A02A" flowable:sourceDockerX="40.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="41.0" flowable:targetDockerY="21.0">\n' + |
|||
' <omgdi:waypoint x="335.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="375.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-8C796912-0699-4ADA-9F3F-91154970C7E2" id="BPMNEdge_sid-8C796912-0699-4ADA-9F3F-91154970C7E2" flowable:sourceDockerX="41.0" flowable:sourceDockerY="21.0" flowable:targetDockerX="48.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="416.0" y="201.0"/>\n' + |
|||
' <omgdi:waypoint x="416.0" y="284.0"/>\n' + |
|||
' <omgdi:waypoint x="168.0" y="284.0"/>\n' + |
|||
' <omgdi:waypoint x="168.0" y="200.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-87E440E2-0998-4C95-B4A4-444397ADB79C" id="BPMNEdge_sid-87E440E2-0998-4C95-B4A4-444397ADB79C" flowable:sourceDockerX="46.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="14.0" flowable:targetDockerY="14.0">\n' + |
|||
' <omgdi:waypoint x="586.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="615.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" id="BPMNEdge_sid-EC4C37D8-A419-4DD1-9569-DD93AE964688" flowable:sourceDockerX="48.0" flowable:sourceDockerY="20.0" flowable:targetDockerX="40.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="215.0" y="180.0"/>\n' + |
|||
' <omgdi:waypoint x="254.0" y="180.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' <bpmndi:BPMNEdge bpmnElement="sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" id="BPMNEdge_sid-452257DA-C9ED-41BB-A95A-899D5F7FD363" flowable:sourceDockerX="15.0" flowable:sourceDockerY="15.0" flowable:targetDockerX="48.0" flowable:targetDockerY="20.0">\n' + |
|||
' <omgdi:waypoint x="89.0" y="183.0"/>\n' + |
|||
' <omgdi:waypoint x="120.0" y="182.0"/>\n' + |
|||
' </bpmndi:BPMNEdge>\n' + |
|||
' </bpmndi:BPMNPlane>\n' + |
|||
' </bpmndi:BPMNDiagram>\n' + |
|||
' </definitions>'; |
|||
onMounted(() => { |
|||
viewer = new BpmnViewer({ |
|||
container: containerRef.value, |
|||
}); |
|||
viewer |
|||
.importXML(xml) |
|||
.then((result) => { |
|||
const { warnings } = result; |
|||
console.log('success !', warnings); |
|||
viewer.get('canvas').zoom('fit-viewport'); |
|||
}) |
|||
.catch(function (err) { |
|||
const { warnings, message } = err; |
|||
console.log('something went wrong:', warnings, message); |
|||
}); |
|||
}); |
|||
*/ |
|||
</script> |
@ -0,0 +1,968 @@ |
|||
package io.sc.platform.flowable.service.impl; |
|||
|
|||
import io.sc.platform.flowable.jpa.entity.ProcessEntity; |
|||
import io.sc.platform.flowable.service.AssigneeQueryService; |
|||
import io.sc.platform.flowable.service.ProcessEntityService; |
|||
import io.sc.platform.flowable.service.ProcessQueryService; |
|||
import io.sc.platform.flowable.support.*; |
|||
import io.sc.platform.jdbc.sql.dialect.Dialect; |
|||
import io.sc.platform.lcdp.form.service.JdbcTemplateService; |
|||
import io.sc.platform.orm.service.support.QueryParameter; |
|||
import io.sc.platform.orm.service.support.QueryResult; |
|||
import io.sc.platform.orm.service.support.criteria.Criteria; |
|||
import io.sc.platform.orm.service.support.criteria.impl.Contains; |
|||
import io.sc.platform.orm.service.support.criteria.impl.Equals; |
|||
import io.sc.platform.security.util.SecurityUtil; |
|||
import io.sc.platform.util.CollectionUtil; |
|||
import io.sc.platform.util.FileUtil; |
|||
import io.sc.platform.util.StringUtil; |
|||
import org.flowable.bpmn.model.BpmnModel; |
|||
import org.flowable.bpmn.model.EndEvent; |
|||
import org.flowable.bpmn.model.FlowElement; |
|||
import org.flowable.bpmn.model.UserTask; |
|||
import org.flowable.engine.HistoryService; |
|||
import org.flowable.engine.RepositoryService; |
|||
import org.flowable.engine.RuntimeService; |
|||
import org.flowable.engine.TaskService; |
|||
import org.flowable.engine.history.HistoricProcessInstance; |
|||
import org.flowable.engine.repository.ProcessDefinition; |
|||
import org.flowable.engine.runtime.ProcessInstance; |
|||
import org.flowable.engine.runtime.ProcessInstanceQuery; |
|||
import org.flowable.image.impl.DefaultProcessDiagramGenerator; |
|||
import org.flowable.task.api.Task; |
|||
import org.flowable.task.api.TaskQuery; |
|||
import org.flowable.task.api.history.HistoricTaskInstance; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.PageImpl; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.domain.Sort.Order; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.*; |
|||
|
|||
//@Service("io.sc.platform.flowable.service.impl.ProcessQueryServiceImpl")
|
|||
public class ProcessQueryServiceImpl2 implements ProcessQueryService { |
|||
@Autowired private RepositoryService repositoryService; |
|||
@Autowired private TaskService taskService; |
|||
@Autowired private ProcessEntityService processEntityService; |
|||
@Autowired private HistoryService historyService; |
|||
@Autowired private RuntimeService runtimeService; |
|||
@Autowired private JdbcTemplateService jdbcTemplateService; |
|||
|
|||
@Autowired |
|||
@Qualifier("io.sc.platform.flowable.service.impl.AssigneeQueryServiceImpl") |
|||
private AssigneeQueryService assigneeQueryService; |
|||
|
|||
@Autowired private Dialect dialect; |
|||
@Autowired private JdbcTemplate jdbcTemplate; |
|||
|
|||
private static final String PROCESS_TASK_SQL; |
|||
private static final String PROCESS_PREFIX_ASSIGNEE_SQL; |
|||
private static final String DONE_TASK_SQL; |
|||
private static final String FINISHED_TASK_SQL; |
|||
|
|||
static { |
|||
try { |
|||
PROCESS_TASK_SQL = FileUtil.readString("classpath:/io/sc/platform/flowable/service/impl/sql/MyTasks.sql"); |
|||
PROCESS_PREFIX_ASSIGNEE_SQL = FileUtil.readString("classpath:/io/sc/platform/flowable/service/impl/sql/ProcessPrefixAssignee.sql"); |
|||
DONE_TASK_SQL = FileUtil.readString("classpath:/io/sc/platform/flowable/service/impl/sql/MyDoneTasks.sql"); |
|||
FINISHED_TASK_SQL = FileUtil.readString("classpath:/io/sc/platform/flowable/service/impl/sql/MyFinishedTasks.sql"); |
|||
} catch (IOException e) { |
|||
throw new RuntimeException(e); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public ProcessDefinition queryProcessDefinition(String processDefinitionId) { |
|||
return repositoryService.getProcessDefinition(processDefinitionId); |
|||
} |
|||
|
|||
@Override |
|||
public InputStream showProcessDiagramByInstanceId(String processInstanceId) throws Exception { |
|||
List<Task> tasks =taskService.createTaskQuery().processInstanceId(processInstanceId).list(); |
|||
return showProcessDiagram(tasks); |
|||
} |
|||
|
|||
@Override |
|||
public InputStream showProcessDiagramByTaskId(String taskId) throws Exception { |
|||
List<Task> tasks =taskService.createTaskQuery().taskId(taskId).list(); |
|||
return showProcessDiagram(tasks); |
|||
} |
|||
|
|||
private InputStream showProcessDiagram(List<Task> tasks) { |
|||
if(tasks!=null && tasks.size()>0){ |
|||
String procDefinitionId =tasks.get(0).getProcessDefinitionId(); |
|||
BpmnModel model = repositoryService.getBpmnModel(procDefinitionId); |
|||
|
|||
List<String> taskDefinitionKeys =new ArrayList<String>(); |
|||
for(Task task : tasks) { |
|||
taskDefinitionKeys.add(task.getTaskDefinitionKey()); |
|||
} |
|||
List<String> highLightedActivities =getHighLightedActivities(model,taskDefinitionKeys); |
|||
DefaultProcessDiagramGenerator defaultProcessDiagramGenerator = new DefaultProcessDiagramGenerator(); |
|||
return defaultProcessDiagramGenerator.generateDiagram(model,"PNG",highLightedActivities,Collections.<String>emptyList(),"宋体","宋体","宋体",null,1.0,true); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
private List<String> getHighLightedActivities(BpmnModel model,List<String> taskDefinitionKeys){ |
|||
if(model!=null && taskDefinitionKeys!=null) { |
|||
List<String> result =new ArrayList<String>(); |
|||
Collection<FlowElement> elements =model.getMainProcess().getFlowElements(); |
|||
if(elements!=null && elements.size()>0){ |
|||
for(FlowElement element : elements){ |
|||
for(String taskDefinitionKey : taskDefinitionKeys) { |
|||
if(taskDefinitionKey.equals(element.getId())){ |
|||
result.add(element.getId()); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
return Collections.<String>emptyList(); |
|||
} |
|||
|
|||
@Override |
|||
public Page<ProcessInstanceWrapper> queryProcessInstances(QueryParameter queryParameter) throws Exception { |
|||
ProcessInstanceQuery query =runtimeService.createProcessInstanceQuery(); |
|||
if(queryParameter!=null && queryParameter.existsCriteria()){ |
|||
// 流程定义ID
|
|||
Criteria processDefinitionIdCriteria =queryParameter.getCriteriaByFieldName("processDefinitionId"); |
|||
if(processDefinitionIdCriteria!=null && processDefinitionIdCriteria instanceof Equals){ |
|||
Equals _processDefinitionIdCriteria =(Equals)processDefinitionIdCriteria; |
|||
query.processDefinitionId(_processDefinitionIdCriteria.getValue()); |
|||
} |
|||
// 流程实例ID
|
|||
Criteria processInstanceIdCriteria =queryParameter.getCriteriaByFieldName("processInstanceId"); |
|||
if(processInstanceIdCriteria!=null && processInstanceIdCriteria instanceof Equals){ |
|||
Equals _processInstanceIdCriteria =(Equals)processInstanceIdCriteria; |
|||
query.processInstanceId(_processInstanceIdCriteria.getValue()); |
|||
} |
|||
// 业务ID
|
|||
Criteria businessKeyCriteria =queryParameter.getCriteriaByFieldName("businessKey"); |
|||
if(businessKeyCriteria!=null && businessKeyCriteria instanceof Equals){ |
|||
Equals _businessKeyCriteria =(Equals)businessKeyCriteria; |
|||
query.processInstanceBusinessKeyLike("%" + _businessKeyCriteria.getValue() + "%"); |
|||
} |
|||
// 创建人
|
|||
Criteria startUserIdCriteria =queryParameter.getCriteriaByFieldName("startUserId"); |
|||
if(startUserIdCriteria!=null && startUserIdCriteria instanceof Equals){ |
|||
Equals _startUserIdCriteria =(Equals)startUserIdCriteria; |
|||
query.startedBy(_startUserIdCriteria.getValue()); |
|||
} |
|||
// 是否挂起
|
|||
Criteria suspendedCriteria =queryParameter.getCriteriaByFieldName("suspended"); |
|||
if(suspendedCriteria!=null && suspendedCriteria instanceof Equals){ |
|||
Equals _suspendedCriteria =(Equals)suspendedCriteria; |
|||
if("true".equals(_suspendedCriteria.getValue())) { |
|||
query.suspended(); |
|||
} |
|||
} |
|||
} |
|||
if(queryParameter!=null && queryParameter.existsSortBy()){ |
|||
Order order =queryParameter.getFirstSort(); |
|||
String propertyName =order.getProperty(); |
|||
if("id".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByProcessInstanceId().desc(); |
|||
}else { |
|||
query.orderByProcessInstanceId().asc(); |
|||
} |
|||
}else if("processDefinitionId".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByProcessDefinitionId().desc(); |
|||
}else { |
|||
query.orderByProcessDefinitionId().asc(); |
|||
} |
|||
}else if("processDefinitionKey".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByProcessDefinitionKey().desc(); |
|||
}else { |
|||
query.orderByProcessDefinitionKey().asc(); |
|||
} |
|||
}else if("startTime".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByStartTime().desc(); |
|||
}else { |
|||
query.orderByStartTime().asc(); |
|||
} |
|||
} |
|||
} |
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =query.count(); |
|||
List<ProcessInstance> items =query.listPage((int)pageable.getOffset(),pageable.getPageSize()); |
|||
if(!CollectionUtil.hasElements(items)){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
List<ProcessInstanceWrapper> wrappers =new ArrayList<>(); |
|||
for(ProcessInstance item : items){ |
|||
ProcessInstanceWrapper wrapper =new ProcessInstanceWrapper(); |
|||
wrapper.setId(item.getId()); |
|||
wrapper.setName(item.getName()); |
|||
wrapper.setLocalizedName(item.getLocalizedName()); |
|||
wrapper.setDescription(item.getDescription()); |
|||
wrapper.setLocalizedDescription(item.getLocalizedDescription()); |
|||
wrapper.setBusinessKey(item.getBusinessKey()); |
|||
wrapper.setStartTime(item.getStartTime()); |
|||
wrapper.setStartUserId(item.getStartUserId()); |
|||
wrapper.setSuspended(item.isSuspended()); |
|||
wrapper.setCallbackId(item.getCallbackId()); |
|||
wrapper.setCallbackType(item.getCallbackType()); |
|||
wrapper.setProcessVariables(item.getProcessVariables()); |
|||
wrapper.setProcessDefinitionId(item.getProcessDefinitionId()); |
|||
wrapper.setProcessDefinitionName(item.getProcessDefinitionName()); |
|||
wrapper.setProcessDefinitionKey(item.getProcessDefinitionKey()); |
|||
wrapper.setProcessDefinitionVersion(item.getProcessDefinitionVersion()); |
|||
wrappers.add(wrapper); |
|||
} |
|||
return new PageImpl<ProcessInstanceWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
public Page<ProcessTaskWrapper> queryProcessTasks(QueryParameter queryParameter) throws Exception { |
|||
runtimeService.createProcessInstanceQuery().processInstanceId("").list(); |
|||
Map<String,Class<?>> fieldTypeMap =new HashMap<>(); |
|||
fieldTypeMap.put("processDefinitionId",String.class); |
|||
fieldTypeMap.put("processInstanceId",String.class); |
|||
fieldTypeMap.put("businessKey",String.class); |
|||
fieldTypeMap.put("assignee",String.class); |
|||
fieldTypeMap.put("taskDefinitionKey",String.class); |
|||
fieldTypeMap.put("businessDescription",String.class); |
|||
String sql =PROCESS_TASK_SQL.replace("\r"," ").replace("\n"," "); |
|||
Map<String, Object> page =jdbcTemplateService.listBySql(queryParameter,sql,fieldTypeMap,new ProcessTaskWrapperMapper()); |
|||
if(page==null || page.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
List<ProcessTaskWrapper> wrappers =(List<ProcessTaskWrapper>)page.get("content"); |
|||
if(wrappers==null || wrappers.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
//以下用于设置前一个处理人
|
|||
List<String> processInstanceIds =new ArrayList<>(); |
|||
for(ProcessTaskWrapper wrapper : wrappers) { |
|||
processInstanceIds.add("'" + wrapper.getProcessInstanceId() + "'"); |
|||
} |
|||
String ins =StringUtil.combine(",",processInstanceIds); |
|||
sql =StringUtil.format(PROCESS_PREFIX_ASSIGNEE_SQL,ins).replace("\r"," ").replace("\n"," "); |
|||
List<ProcessTaskAssigneeWrapper> list =jdbcTemplate.query(sql,new ProcessTaskAssigneeWrapperMapper()); |
|||
if(list!=null && !list.isEmpty()){ |
|||
Map<String,ProcessTaskAssigneeWrapper> prefixAssigneeNames =new HashMap<>(); |
|||
for(ProcessTaskAssigneeWrapper item : list){ |
|||
prefixAssigneeNames.put(item.getProcessInstanceId(),item); |
|||
} |
|||
for(ProcessTaskWrapper wrapper : wrappers) { |
|||
if(!StringUtils.hasText(wrapper.getPreviousAssignee())){ |
|||
wrapper.setPreviousAssignee(SecurityUtil.getLoginName()); |
|||
wrapper.setPreviousAssigneeName(SecurityUtil.getUserName()); |
|||
}else { |
|||
ProcessTaskAssigneeWrapper item = prefixAssigneeNames.get(wrapper.getProcessInstanceId()); |
|||
if (item != null) { |
|||
wrapper.setPreviousAssignee(item.getAssignee()); |
|||
wrapper.setPreviousAssigneeName(item.getAssigneeName()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//构建结果返回
|
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =Long.parseLong(page.get("totalElements").toString()); |
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
public Page<ProcessTaskWrapper> queryProcessTasks2(QueryParameter queryParameter) throws Exception { |
|||
TaskQuery query =taskService.createTaskQuery(); |
|||
if(queryParameter!=null && queryParameter.existsCriteria()){ |
|||
// 流程定义ID
|
|||
Criteria processDefinitionIdCriteria =queryParameter.getCriteriaByFieldName("processDefinitionId"); |
|||
if(processDefinitionIdCriteria!=null && processDefinitionIdCriteria instanceof Equals){ |
|||
Equals _processDefinitionIdCriteria =(Equals)processDefinitionIdCriteria; |
|||
query.processDefinitionId(_processDefinitionIdCriteria.getValue()); |
|||
} |
|||
// 流程实例ID
|
|||
Criteria processInstanceIdCriteria =queryParameter.getCriteriaByFieldName("processInstanceId"); |
|||
if(processInstanceIdCriteria!=null && processInstanceIdCriteria instanceof Equals){ |
|||
Equals _processInstanceIdCriteria =(Equals)processInstanceIdCriteria; |
|||
query.processInstanceId(_processInstanceIdCriteria.getValue()); |
|||
} |
|||
// 业务ID
|
|||
Criteria businessKeyCriteria =queryParameter.getCriteriaByFieldName("businessKey"); |
|||
if(businessKeyCriteria!=null && businessKeyCriteria instanceof Equals){ |
|||
Equals _businessKeyCriteria =(Equals)businessKeyCriteria; |
|||
query.processInstanceBusinessKeyLike("%" + _businessKeyCriteria.getValue() + "%"); |
|||
} |
|||
// 处理人
|
|||
Criteria assigneeCriteria =queryParameter.getCriteriaByFieldName("assignee"); |
|||
if(assigneeCriteria!=null && assigneeCriteria instanceof Equals){ |
|||
Equals _assigneeCriteria =(Equals)assigneeCriteria; |
|||
query.taskAssignee(_assigneeCriteria.getValue()); |
|||
} |
|||
|
|||
// 任务节点 KEY
|
|||
Criteria taskDefinitionKeyCriteria =queryParameter.getCriteriaByFieldName("taskDefinitionKey"); |
|||
if(taskDefinitionKeyCriteria!=null && taskDefinitionKeyCriteria instanceof Equals){ |
|||
Equals _taskDefinitionKeyCriteria =(Equals)taskDefinitionKeyCriteria; |
|||
query.taskDefinitionKey(_taskDefinitionKeyCriteria.getValue()); |
|||
} |
|||
|
|||
// 任务描述
|
|||
Criteria taskDescriptionCriteria =queryParameter.getCriteriaByFieldName("description"); |
|||
if(taskDescriptionCriteria!=null && taskDescriptionCriteria instanceof Contains){ |
|||
Contains _taskDescriptionCriteria =(Contains)taskDescriptionCriteria; |
|||
query.taskDescriptionLike("%" + StringUtil.escapeSqlSpecialChar(_taskDescriptionCriteria.getValue()) + "%"); |
|||
} |
|||
} |
|||
if(queryParameter!=null && queryParameter.existsSortBy()){ |
|||
Order order =queryParameter.getFirstSort(); |
|||
String propertyName =order.getProperty(); |
|||
if("id".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByTaskId().desc(); |
|||
}else { |
|||
query.orderByTaskId().asc(); |
|||
} |
|||
}else if("assignee".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByTaskAssignee().desc(); |
|||
}else { |
|||
query.orderByTaskAssignee().asc(); |
|||
} |
|||
}else if("createTime".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByTaskCreateTime().desc(); |
|||
}else { |
|||
query.orderByTaskCreateTime().asc(); |
|||
} |
|||
}else if("owner".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByTaskOwner().desc(); |
|||
}else { |
|||
query.orderByTaskOwner().asc(); |
|||
} |
|||
}else if("name".equals(propertyName)){ |
|||
if(order.isDescending()){ |
|||
query.orderByTaskName().desc(); |
|||
}else { |
|||
query.orderByTaskName().asc(); |
|||
} |
|||
} |
|||
}else{ |
|||
query.orderByTaskCreateTime().desc(); |
|||
} |
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =query.count(); |
|||
List<Task> items =query.listPage((int)pageable.getOffset(),pageable.getPageSize()); |
|||
if(!CollectionUtil.hasElements(items)){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
|
|||
List<ProcessTaskWrapper> wrappers =new ArrayList<>(); |
|||
Set<String> processIntanceIds =new HashSet<>(); |
|||
Map<String,Map<String, BusinessKeyAndDescription>> processDefineAndInstanceAndBusinessMap =new HashMap<>(); |
|||
for(Task item : items){ |
|||
ProcessTaskWrapper wrapper =new ProcessTaskWrapper(); |
|||
wrapper.setId(item.getId()); |
|||
wrapper.setName(item.getName()); |
|||
wrapper.setDescription(item.getDescription()); |
|||
wrapper.setPriority(item.getPriority()); |
|||
wrapper.setOwner(item.getOwner()); |
|||
wrapper.setAssignee(item.getAssignee()); |
|||
wrapper.setProcessInstanceId(item.getProcessInstanceId()); |
|||
wrapper.setExecutionId(item.getExecutionId()); |
|||
wrapper.setProcessDefinitionId(item.getProcessDefinitionId()); |
|||
wrapper.setScopeId(item.getScopeId()); |
|||
wrapper.setSubScopeId(item.getSubScopeId()); |
|||
wrapper.setScopeType(item.getScopeType()); |
|||
wrapper.setScopeDefinitionId(item.getScopeDefinitionId()); |
|||
wrapper.setStartTime(item.getCreateTime()); |
|||
wrapper.setTaskDefinitionKey(item.getTaskDefinitionKey()); |
|||
wrapper.setDueDate(item.getDueDate()); |
|||
wrapper.setCategory(item.getCategory()); |
|||
wrapper.setParentTaskId(item.getParentTaskId()); |
|||
wrapper.setTenantId(item.getTenantId()); |
|||
wrapper.setFormKey(item.getFormKey()); |
|||
wrapper.setClaimTime(item.getClaimTime()); |
|||
wrappers.add(wrapper); |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(item.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap==null){ |
|||
processInstanceAndBusinessMap =new HashMap<>(); |
|||
processDefineAndInstanceAndBusinessMap.put(item.getProcessDefinitionId(),processInstanceAndBusinessMap); |
|||
} |
|||
processInstanceAndBusinessMap.put(item.getProcessInstanceId(),new BusinessKeyAndDescription()); |
|||
processIntanceIds.add(item.getProcessInstanceId()); |
|||
} |
|||
|
|||
// 建立流程实例和业务Key的关系
|
|||
List<ProcessInstance> processInstances =runtimeService.createProcessInstanceQuery().processInstanceIds(processIntanceIds).list(); |
|||
if(CollectionUtil.hasElements(processInstances)) { |
|||
for (ProcessInstance processInstance : processInstances) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processInstance.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap!=null){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstance.getId()); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setProcessDefinitionName(processInstance.getProcessDefinitionName()); |
|||
businessKeyAndDescription.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion()); |
|||
businessKeyAndDescription.setBusinessKey(processInstance.getBusinessKey()); |
|||
businessKeyAndDescription.setBusinessDescription(processInstance.getProcessDefinitionName()); |
|||
|
|||
List<HistoricTaskInstance> historicTaskInstances =historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).finished().orderByHistoricTaskInstanceEndTime().desc().list(); |
|||
if(CollectionUtil.hasElements(historicTaskInstances)){ |
|||
businessKeyAndDescription.setPreviousAssignee(historicTaskInstances.get(0).getAssignee()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
for(String processDefineId : processDefineAndInstanceAndBusinessMap.keySet()) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processDefineId); |
|||
if(processInstanceAndBusinessMap==null || processInstanceAndBusinessMap.size()<=0){ |
|||
continue; |
|||
} |
|||
ProcessEntity processEntity =processEntityService.getRepository().findByDeployedId(processDefineId); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setTaskHandFrontendRouteName(processEntity.getTaskHandFrontendRouteName()); |
|||
businessKeyAndDescription.setTaskHandFrontendModelName(processEntity.getTaskHandFrontendModelName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentName(processEntity.getTaskHandFrontendComponentName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentProperties(processEntity.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
} |
|||
if(processEntity==null){ |
|||
continue; |
|||
} |
|||
String sql =processEntity.getBusinessDescriptionSql(); |
|||
if(!StringUtils.hasText(sql)){ |
|||
continue; |
|||
} |
|||
|
|||
Set<String> businessKeys =new HashSet<>(); |
|||
for(Map.Entry<String,BusinessKeyAndDescription> entry: processInstanceAndBusinessMap.entrySet()){ |
|||
businessKeys.add(entry.getValue().getBusinessKey()); |
|||
} |
|||
if(!CollectionUtil.hasElements(businessKeys)){ |
|||
continue; |
|||
} |
|||
Map<String,Object> variables =new HashMap<>(); |
|||
variables.put("bussinessKeys","'" + StringUtil.combine("','",businessKeys) + "'"); |
|||
sql =StringUtil.format(sql,variables); |
|||
List<Map<String,Object>> result =jdbcTemplate.queryForList(sql); |
|||
if(!CollectionUtil.hasElements(result)){ |
|||
continue; |
|||
} |
|||
for(Map<String,Object> row : result){ |
|||
String bussinessKey =row.get("BUSSINESS_KEY").toString(); |
|||
String bussinessDescription =row.get("BUSSINESS_DESCRIPTION").toString(); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription.getBusinessKey().equals(bussinessKey)){ |
|||
businessKeyAndDescription.setBusinessDescription(bussinessDescription); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//合并
|
|||
for(ProcessTaskWrapper wrapper : wrappers){ |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(wrapper.getProcessDefinitionId()); |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(wrapper.getProcessInstanceId()); |
|||
wrapper.setPreviousAssignee(businessKeyAndDescription.getPreviousAssignee()); |
|||
wrapper.setBusinessKey(businessKeyAndDescription.getBusinessKey()); |
|||
wrapper.setBusinessDescription(businessKeyAndDescription.getBusinessDescription()); |
|||
wrapper.setProcessDefinitionName(businessKeyAndDescription.getProcessDefinitionName()); |
|||
wrapper.setProcessDefinitionVersion(businessKeyAndDescription.getProcessDefinitionVersion()); |
|||
wrapper.setTaskHandFrontendRouteName(businessKeyAndDescription.getTaskHandFrontendRouteName()); |
|||
wrapper.setTaskHandFrontendModelName(businessKeyAndDescription.getTaskHandFrontendModelName()); |
|||
wrapper.setTaskHandFrontendComponentName(businessKeyAndDescription.getTaskHandFrontendComponentName()); |
|||
wrapper.setTaskHandFrontendComponentProperties(businessKeyAndDescription.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
|
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
public Page<ProcessTaskWrapper> queryDoneProcessTasks(QueryParameter queryParameter) throws Exception { |
|||
Map<String,Class<?>> fieldTypeMap =new HashMap<>(); |
|||
fieldTypeMap.put("processDefinitionId",String.class); |
|||
fieldTypeMap.put("processInstanceId",String.class); |
|||
fieldTypeMap.put("businessKey",String.class); |
|||
fieldTypeMap.put("assignee",String.class); |
|||
fieldTypeMap.put("taskDefinitionKey",String.class); |
|||
fieldTypeMap.put("businessDescription",String.class); |
|||
String sql =StringUtil.format(DONE_TASK_SQL,SecurityUtil.getLoginName()).replace("\r"," ").replace("\n"," "); |
|||
Map<String, Object> page =jdbcTemplateService.listBySql(queryParameter,sql,fieldTypeMap,new ProcessTaskWrapperMapper()); |
|||
if(page==null || page.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
List<ProcessTaskWrapper> wrappers =(List<ProcessTaskWrapper>)page.get("content"); |
|||
if(wrappers==null || wrappers.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
//构建结果返回
|
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =Long.parseLong(page.get("totalElements").toString()); |
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
//@Override
|
|||
public Page<ProcessTaskWrapper> queryDoneProcessTasks2(QueryParameter queryParameter) throws Exception { |
|||
String loginName =SecurityUtil.getLoginName(); |
|||
String taskSql ="" + |
|||
"select * from (\n" + |
|||
" select * from (\n" + |
|||
" select\n" + |
|||
" T.ID_ as id,\n" + |
|||
" T.NAME_ as name,\n" + |
|||
" T.DESCRIPTION_ as description,\n" + |
|||
" T.PRIORITY_ as priority,\n" + |
|||
" T.OWNER_ as owner,\n" + |
|||
" T.ASSIGNEE_ as assignee,\n" + |
|||
" T.PROC_INST_ID_ as processInstanceId,\n" + |
|||
" T.EXECUTION_ID_ as executionId,\n" + |
|||
" T.PROC_DEF_ID_ as processDefinitionId,\n" + |
|||
" T.SCOPE_ID_ as scopeId,\n" + |
|||
" T.SUB_SCOPE_ID_ as subScopeId,\n" + |
|||
" T.SCOPE_TYPE_ as scopeType,\n" + |
|||
" T.SCOPE_DEFINITION_ID_ as scopeDefinitionId,\n" + |
|||
" T.CREATE_TIME_ as createTime,\n" + |
|||
" T.TASK_DEF_KEY_ as taskDefinitionKey,\n" + |
|||
" T.DUE_DATE_ as dueDate,\n" + |
|||
" T.CATEGORY_ as category,\n" + |
|||
" T.PARENT_TASK_ID_ as parentTaskId,\n" + |
|||
" T.TENANT_ID_ as tenantId,\n" + |
|||
" T.FORM_KEY_ as formKey,\n" + |
|||
" T.CLAIM_TIME_ as claimTime,\n" + |
|||
" \n" + |
|||
" RP.NAME_ as processDefinitionName,\n" + |
|||
" RP.VERSION_ as processDefinitionVersion,\n" + |
|||
" \n" + |
|||
" E.BUSINESS_KEY_ \t as businessKey,\n" + |
|||
" \n" + |
|||
" HT.START_TIME_ as START_TIME,\n" + |
|||
" HT.END_TIME_ as END_TIME,\n" + |
|||
" \n" + |
|||
" row_number() over(partition by HT.PROC_INST_ID_ order by HT.END_TIME_ desc) as RK\n" + |
|||
" from ACT_HI_TASKINST HT\n" + |
|||
" join ACT_RU_TASK T on T.PROC_INST_ID_ = HT.PROC_INST_ID_\n" + |
|||
" join ACT_RU_EXECUTION E on T.PROC_INST_ID_ = E.ID_\n" + |
|||
" left join ACT_RE_PROCDEF RP on HT.PROC_DEF_ID_ = RP.ID_\n" + |
|||
" left join SYS_USER U on T.ASSIGNEE_ = U.LOGINNAME_\n" + |
|||
" where \n" + |
|||
" HT.ASSIGNEE_ ='" + loginName + "' \n" + |
|||
" and T.ASSIGNEE_ <> '" + loginName + "' \n" + |
|||
" and HT.END_TIME_ is not null\n" + |
|||
" ) TMP where TMP.RK = 1\n" + |
|||
") t"; |
|||
Map<String,Class<?>> fieldTypeMap =new HashMap<>(); |
|||
fieldTypeMap.put("processDefinitionId",String.class); |
|||
fieldTypeMap.put("processInstanceId",String.class); |
|||
fieldTypeMap.put("businessKey",String.class); |
|||
fieldTypeMap.put("assignee",String.class); |
|||
fieldTypeMap.put("taskDefinitionKey",String.class); |
|||
fieldTypeMap.put("description",String.class); |
|||
Map<String, Object> page =jdbcTemplateService.listBySql(queryParameter,taskSql,fieldTypeMap,new ProcessTaskWrapperMapper()); |
|||
|
|||
List<ProcessTaskWrapper> wrappers =new ArrayList<>(); |
|||
Set<String> processIntanceIds =new HashSet<>(); |
|||
Map<String,Map<String, BusinessKeyAndDescription>> processDefineAndInstanceAndBusinessMap =new HashMap<>(); |
|||
|
|||
if(page==null || page.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
List<ProcessTaskWrapper> items =(List<ProcessTaskWrapper>)page.get("content"); |
|||
if(items==null || items.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
for(ProcessTaskWrapper item : items){ |
|||
ProcessTaskWrapper wrapper =item; |
|||
wrappers.add(wrapper); |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(wrapper.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap==null){ |
|||
processInstanceAndBusinessMap =new HashMap<>(); |
|||
processDefineAndInstanceAndBusinessMap.put(wrapper.getProcessDefinitionId(),processInstanceAndBusinessMap); |
|||
} |
|||
processInstanceAndBusinessMap.put(wrapper.getProcessInstanceId(),new BusinessKeyAndDescription()); |
|||
processIntanceIds.add(wrapper.getProcessInstanceId()); |
|||
} |
|||
|
|||
// 建立流程实例和业务Key的关系
|
|||
List<ProcessInstance> processInstances =runtimeService.createProcessInstanceQuery().processInstanceIds(processIntanceIds).list(); |
|||
if(CollectionUtil.hasElements(processInstances)) { |
|||
for (ProcessInstance processInstance : processInstances) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processInstance.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap!=null){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstance.getId()); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setProcessDefinitionName(processInstance.getProcessDefinitionName()); |
|||
businessKeyAndDescription.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion()); |
|||
businessKeyAndDescription.setBusinessKey(processInstance.getBusinessKey()); |
|||
businessKeyAndDescription.setBusinessDescription(processInstance.getProcessDefinitionName()); |
|||
|
|||
List<HistoricTaskInstance> historicTaskInstances =historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).finished().orderByHistoricTaskInstanceEndTime().desc().list(); |
|||
if(CollectionUtil.hasElements(historicTaskInstances)){ |
|||
businessKeyAndDescription.setPreviousAssignee(historicTaskInstances.get(0).getAssignee()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
for(String processDefineId : processDefineAndInstanceAndBusinessMap.keySet()) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processDefineId); |
|||
if(processInstanceAndBusinessMap==null || processInstanceAndBusinessMap.size()<=0){ |
|||
continue; |
|||
} |
|||
ProcessEntity processEntity =processEntityService.getRepository().findByDeployedId(processDefineId); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setTaskHandFrontendRouteName(processEntity.getTaskHandFrontendRouteName()); |
|||
businessKeyAndDescription.setTaskHandFrontendModelName(processEntity.getTaskHandFrontendModelName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentName(processEntity.getTaskHandFrontendComponentName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentProperties(processEntity.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
} |
|||
if(processEntity==null){ |
|||
continue; |
|||
} |
|||
String sql =processEntity.getBusinessDescriptionSql(); |
|||
if(!StringUtils.hasText(sql)){ |
|||
continue; |
|||
} |
|||
|
|||
Set<String> businessKeys =new HashSet<>(); |
|||
for(Map.Entry<String,BusinessKeyAndDescription> entry: processInstanceAndBusinessMap.entrySet()){ |
|||
businessKeys.add(entry.getValue().getBusinessKey()); |
|||
} |
|||
if(!CollectionUtil.hasElements(businessKeys)){ |
|||
continue; |
|||
} |
|||
Map<String,Object> variables =new HashMap<>(); |
|||
variables.put("bussinessKeys","'" + StringUtil.combine("','",businessKeys) + "'"); |
|||
sql =StringUtil.format(sql,variables); |
|||
List<Map<String,Object>> result =jdbcTemplate.queryForList(sql); |
|||
if(!CollectionUtil.hasElements(result)){ |
|||
continue; |
|||
} |
|||
for(Map<String,Object> row : result){ |
|||
String bussinessKey =row.get("BUSSINESS_KEY").toString(); |
|||
String bussinessDescription =row.get("BUSSINESS_DESCRIPTION").toString(); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription.getBusinessKey().equals(bussinessKey)){ |
|||
businessKeyAndDescription.setBusinessDescription(bussinessDescription); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//合并
|
|||
for(ProcessTaskWrapper wrapper : wrappers){ |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(wrapper.getProcessDefinitionId()); |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(wrapper.getProcessInstanceId()); |
|||
wrapper.setPreviousAssignee(businessKeyAndDescription.getPreviousAssignee()); |
|||
wrapper.setBusinessKey(businessKeyAndDescription.getBusinessKey()); |
|||
wrapper.setBusinessDescription(businessKeyAndDescription.getBusinessDescription()); |
|||
wrapper.setProcessDefinitionName(businessKeyAndDescription.getProcessDefinitionName()); |
|||
wrapper.setProcessDefinitionVersion(businessKeyAndDescription.getProcessDefinitionVersion()); |
|||
wrapper.setTaskHandFrontendRouteName(businessKeyAndDescription.getTaskHandFrontendRouteName()); |
|||
wrapper.setTaskHandFrontendModelName(businessKeyAndDescription.getTaskHandFrontendModelName()); |
|||
wrapper.setTaskHandFrontendComponentName(businessKeyAndDescription.getTaskHandFrontendComponentName()); |
|||
wrapper.setTaskHandFrontendComponentProperties(businessKeyAndDescription.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
|
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =Long.parseLong(page.get("totalElements").toString()); |
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
@Override |
|||
public Page<ProcessTaskWrapper> queryFinishedProcessTasks(QueryParameter queryParameter) throws Exception { |
|||
Map<String,Class<?>> fieldTypeMap =new HashMap<>(); |
|||
fieldTypeMap.put("processDefinitionId",String.class); |
|||
fieldTypeMap.put("processInstanceId",String.class); |
|||
fieldTypeMap.put("businessKey",String.class); |
|||
fieldTypeMap.put("assignee",String.class); |
|||
fieldTypeMap.put("taskDefinitionKey",String.class); |
|||
fieldTypeMap.put("businessDescription",String.class); |
|||
String sql =StringUtil.format(FINISHED_TASK_SQL,SecurityUtil.getLoginName()).replace("\r"," ").replace("\n"," "); |
|||
Map<String, Object> page =jdbcTemplateService.listBySql(queryParameter,sql,fieldTypeMap,new ProcessTaskWrapperMapper()); |
|||
if(page==null || page.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
List<ProcessTaskWrapper> wrappers =(List<ProcessTaskWrapper>)page.get("content"); |
|||
if(wrappers==null || wrappers.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
//构建结果返回
|
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =Long.parseLong(page.get("totalElements").toString()); |
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
//@Override
|
|||
public Page<ProcessTaskWrapper> queryFinishedProcessTasks2(QueryParameter queryParameter) throws Exception { |
|||
String loginName =SecurityUtil.getLoginName(); |
|||
String taskSql ="" + |
|||
"select * from (\n" + |
|||
" select * from (\n" + |
|||
" select \n" + |
|||
" ht.ID_ as id,\n" + |
|||
" ht.NAME_ as name,\n" + |
|||
" ht.DESCRIPTION_ as description,\n" + |
|||
" ht.PRIORITY_ as priority,\n" + |
|||
" ht.OWNER_ as owner,\n" + |
|||
" ht.ASSIGNEE_ as assignee,\n" + |
|||
" ht.PROC_INST_ID_ as processInstanceId,\n" + |
|||
" ht.EXECUTION_ID_ as executionId,\n" + |
|||
" ht.PROC_DEF_ID_ as processDefinitionId,\n" + |
|||
" ht.SCOPE_ID_ as scopeId,\n" + |
|||
" ht.SUB_SCOPE_ID_ as subScopeId,\n" + |
|||
" ht.SCOPE_TYPE_ as scopeType,\n" + |
|||
" ht.SCOPE_DEFINITION_ID_ as scopeDefinitionId,\n" + |
|||
" -- ht.CREATE_TIME_ as createTime,\n" + |
|||
" ht.TASK_DEF_KEY_ as taskDefinitionKey,\n" + |
|||
" ht.DUE_DATE_ as dueDate,\n" + |
|||
" ht.CATEGORY_ as category,\n" + |
|||
" ht.PARENT_TASK_ID_ as parentTaskId,\n" + |
|||
" ht.TENANT_ID_ as tenantId,\n" + |
|||
" ht.FORM_KEY_ as formKey,\n" + |
|||
" ht.CLAIM_TIME_ as claimTime,\n" + |
|||
" \n" + |
|||
" ht.START_TIME_ as createTime,\n" + |
|||
" ht.END_TIME_ as END_TIME,\n" + |
|||
" \n" + |
|||
" rp.NAME_ as processDefinitionName,\n" + |
|||
" rp.VERSION_ as processDefinitionVersion,\n" + |
|||
" \n" + |
|||
" e.BUSINESS_KEY_ \t as businessKey,\n" + |
|||
" \n" + |
|||
" row_number() over(partition by ht.proc_inst_id_ order by ht.end_time_ desc) as rk\n" + |
|||
" from ACT_HI_TASKINST ht\n" + |
|||
" left join ACT_RE_PROCDEF rp on ht.proc_def_id_ = rp.id_\n" + |
|||
" join ACT_HI_PROCINST e on ht.proc_inst_id_ = e.PROC_INST_ID_\n" + |
|||
" left join sys_user u on ht.assignee_ = u.loginname_\n" + |
|||
" where \n" + |
|||
" exists (\n" + |
|||
" select 1 from ACT_HI_TASKINST aht \n" + |
|||
" where \n" + |
|||
" aht.ASSIGNEE_ = '" + loginName + "' \n" + |
|||
" and aht.end_time_ is not null\n" + |
|||
" and exists (\n" + |
|||
" select 1 from ACT_HI_PROCINST hp \n" + |
|||
" where \n" + |
|||
" hp.end_time_ is not null \n" + |
|||
" and hp.end_act_id_ is not null \n" + |
|||
" and hp.proc_inst_id_ = ht.proc_inst_id_\n" + |
|||
" ) \n" + |
|||
" and aht.proc_inst_id_ = ht.proc_inst_id_\n" + |
|||
" )\n" + |
|||
" ) tmp where tmp.rk = 1\n" + |
|||
") t"; |
|||
Map<String,Class<?>> fieldTypeMap =new HashMap<>(); |
|||
fieldTypeMap.put("processDefinitionId",String.class); |
|||
fieldTypeMap.put("processInstanceId",String.class); |
|||
fieldTypeMap.put("businessKey",String.class); |
|||
fieldTypeMap.put("assignee",String.class); |
|||
fieldTypeMap.put("taskDefinitionKey",String.class); |
|||
fieldTypeMap.put("description",String.class); |
|||
Map<String, Object> page =jdbcTemplateService.listBySql(queryParameter,taskSql,fieldTypeMap,new ProcessTaskWrapperMapper()); |
|||
|
|||
List<ProcessTaskWrapper> wrappers =new ArrayList<>(); |
|||
Set<String> processIntanceIds =new HashSet<>(); |
|||
Map<String,Map<String, BusinessKeyAndDescription>> processDefineAndInstanceAndBusinessMap =new HashMap<>(); |
|||
|
|||
if(page==null || page.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
List<ProcessTaskWrapper> items =(List<ProcessTaskWrapper>)page.get("content"); |
|||
if(items==null || items.isEmpty()){ |
|||
return QueryResult.emptyPage(); |
|||
} |
|||
for(ProcessTaskWrapper item : items){ |
|||
ProcessTaskWrapper wrapper =item; |
|||
wrappers.add(wrapper); |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(wrapper.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap==null){ |
|||
processInstanceAndBusinessMap =new HashMap<>(); |
|||
processDefineAndInstanceAndBusinessMap.put(wrapper.getProcessDefinitionId(),processInstanceAndBusinessMap); |
|||
} |
|||
processInstanceAndBusinessMap.put(wrapper.getProcessInstanceId(),new BusinessKeyAndDescription()); |
|||
processIntanceIds.add(wrapper.getProcessInstanceId()); |
|||
} |
|||
|
|||
// 建立流程实例和业务Key的关系
|
|||
List<HistoricProcessInstance> processInstances =historyService.createHistoricProcessInstanceQuery().processInstanceIds(processIntanceIds).list(); |
|||
if(CollectionUtil.hasElements(processInstances)) { |
|||
for (HistoricProcessInstance processInstance : processInstances) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processInstance.getProcessDefinitionId()); |
|||
if(processInstanceAndBusinessMap!=null){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstance.getId()); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setProcessDefinitionName(processInstance.getProcessDefinitionName()); |
|||
businessKeyAndDescription.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion()); |
|||
businessKeyAndDescription.setBusinessKey(processInstance.getBusinessKey()); |
|||
businessKeyAndDescription.setBusinessDescription(processInstance.getProcessDefinitionName()); |
|||
|
|||
List<HistoricTaskInstance> historicTaskInstances =historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).finished().orderByHistoricTaskInstanceEndTime().desc().list(); |
|||
if(CollectionUtil.hasElements(historicTaskInstances)){ |
|||
businessKeyAndDescription.setPreviousAssignee(historicTaskInstances.get(0).getAssignee()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
for(String processDefineId : processDefineAndInstanceAndBusinessMap.keySet()) { |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(processDefineId); |
|||
if(processInstanceAndBusinessMap==null || processInstanceAndBusinessMap.size()<=0){ |
|||
continue; |
|||
} |
|||
ProcessEntity processEntity =processEntityService.getRepository().findByDeployedId(processDefineId); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription!=null){ |
|||
businessKeyAndDescription.setTaskHandFrontendRouteName(processEntity.getTaskHandFrontendRouteName()); |
|||
businessKeyAndDescription.setTaskHandFrontendModelName(processEntity.getTaskHandFrontendModelName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentName(processEntity.getTaskHandFrontendComponentName()); |
|||
businessKeyAndDescription.setTaskHandFrontendComponentProperties(processEntity.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
} |
|||
if(processEntity==null){ |
|||
continue; |
|||
} |
|||
String sql =processEntity.getBusinessDescriptionSql(); |
|||
if(!StringUtils.hasText(sql)){ |
|||
continue; |
|||
} |
|||
|
|||
Set<String> businessKeys =new HashSet<>(); |
|||
for(Map.Entry<String,BusinessKeyAndDescription> entry: processInstanceAndBusinessMap.entrySet()){ |
|||
businessKeys.add(entry.getValue().getBusinessKey()); |
|||
} |
|||
if(!CollectionUtil.hasElements(businessKeys)){ |
|||
continue; |
|||
} |
|||
Map<String,Object> variables =new HashMap<>(); |
|||
variables.put("bussinessKeys","'" + StringUtil.combine("','",businessKeys) + "'"); |
|||
sql =StringUtil.format(sql,variables); |
|||
List<Map<String,Object>> result =jdbcTemplate.queryForList(sql); |
|||
if(!CollectionUtil.hasElements(result)){ |
|||
continue; |
|||
} |
|||
for(Map<String,Object> row : result){ |
|||
String bussinessKey =row.get("BUSSINESS_KEY").toString(); |
|||
String bussinessDescription =row.get("BUSSINESS_DESCRIPTION").toString(); |
|||
for(String processInstanceId : processInstanceAndBusinessMap.keySet()){ |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(processInstanceId); |
|||
if(businessKeyAndDescription.getBusinessKey().equals(bussinessKey)){ |
|||
businessKeyAndDescription.setBusinessDescription(bussinessDescription); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//合并
|
|||
for(ProcessTaskWrapper wrapper : wrappers){ |
|||
Map<String,BusinessKeyAndDescription> processInstanceAndBusinessMap =processDefineAndInstanceAndBusinessMap.get(wrapper.getProcessDefinitionId()); |
|||
BusinessKeyAndDescription businessKeyAndDescription =processInstanceAndBusinessMap.get(wrapper.getProcessInstanceId()); |
|||
wrapper.setPreviousAssignee(businessKeyAndDescription.getPreviousAssignee()); |
|||
wrapper.setBusinessKey(businessKeyAndDescription.getBusinessKey()); |
|||
wrapper.setBusinessDescription(businessKeyAndDescription.getBusinessDescription()); |
|||
wrapper.setProcessDefinitionName(businessKeyAndDescription.getProcessDefinitionName()); |
|||
wrapper.setProcessDefinitionVersion(businessKeyAndDescription.getProcessDefinitionVersion()); |
|||
wrapper.setTaskHandFrontendRouteName(businessKeyAndDescription.getTaskHandFrontendRouteName()); |
|||
wrapper.setTaskHandFrontendModelName(businessKeyAndDescription.getTaskHandFrontendModelName()); |
|||
wrapper.setTaskHandFrontendComponentName(businessKeyAndDescription.getTaskHandFrontendComponentName()); |
|||
wrapper.setTaskHandFrontendComponentProperties(businessKeyAndDescription.getTaskHandFrontendComponentProperties()); |
|||
} |
|||
|
|||
Pageable pageable =queryParameter.getJpaPageable(); |
|||
long total =Long.parseLong(page.get("totalElements").toString()); |
|||
return new PageImpl<ProcessTaskWrapper>(wrappers,pageable,total); |
|||
} |
|||
|
|||
@Override |
|||
public List<VariableWrapper> queryVariables(String processInstId) throws Exception { |
|||
if(StringUtils.hasText(processInstId)){ |
|||
String sql ="select * from ACT_RU_VARIABLE where PROC_INST_ID_=? order by NAME_"; |
|||
return jdbcTemplate.query(sql,new VariableWrapperRowMapper(),processInstId); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public List<UserTaskDefinitionWrapper> queryUserTaskDefinition(String taskId) throws Exception { |
|||
if(StringUtils.hasText(taskId)) { |
|||
List<Task> tasks =taskService.createTaskQuery().taskId(taskId).list(); |
|||
if(tasks!=null && tasks.size()>0){ |
|||
String procDefinitionId =tasks.get(0).getProcessDefinitionId(); |
|||
BpmnModel model = repositoryService.getBpmnModel(procDefinitionId); |
|||
Collection<FlowElement> elements =model.getMainProcess().getFlowElements(); |
|||
if(elements!=null && elements.size()>0){ |
|||
List<UserTaskDefinitionWrapper> result =new ArrayList<UserTaskDefinitionWrapper>(); |
|||
//添加用户任务
|
|||
for(FlowElement element : elements){ |
|||
if((element instanceof UserTask)) { |
|||
result.add(new UserTaskDefinitionWrapper(element.getId(),element.getName())); |
|||
} |
|||
} |
|||
//添加结束节点
|
|||
for(FlowElement element : elements){ |
|||
if((element instanceof EndEvent)) { |
|||
result.add(new UserTaskDefinitionWrapper(element.getId(),element.getName())); |
|||
} |
|||
} |
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public List<Assignee> queryCandidate(String taskId,String activityId) throws Exception { |
|||
if(StringUtils.hasText(taskId) && StringUtils.hasText(activityId)) { |
|||
List<Task> tasks =taskService.createTaskQuery().taskId(taskId).list(); |
|||
if(tasks!=null && tasks.size()>0){ |
|||
String procDefinitionId =tasks.get(0).getProcessDefinitionId(); |
|||
BpmnModel model = repositoryService.getBpmnModel(procDefinitionId); |
|||
Collection<FlowElement> elements =model.getMainProcess().getFlowElements(); |
|||
if(elements!=null && elements.size()>0){ |
|||
for(FlowElement element : elements){ |
|||
if((element instanceof UserTask) && element.getId().equals(activityId)) { |
|||
return assigneeQueryService.query((UserTask)element); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ProcessTaskWrapper queryProcessTaskById(String taskId) throws Exception { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ProcessTaskWrapper queryDoneProcessTaskById(String taskId) throws Exception { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ProcessTaskWrapper queryFinishedProcessTaskById(String taskId) throws Exception { |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,46 @@ |
|||
package io.sc.platform.flowable.support; |
|||
|
|||
import io.sc.platform.util.DateUtil; |
|||
import io.sc.platform.util.support.DateDiff; |
|||
|
|||
import java.time.temporal.ChronoUnit; |
|||
import java.util.Date; |
|||
|
|||
public class BusinessKeyAndDescriptionWrapper { |
|||
private String businessKey; |
|||
private String custNo; |
|||
private String custName; |
|||
private String processStatus; |
|||
|
|||
public String getBusinessKey() { |
|||
return businessKey; |
|||
} |
|||
|
|||
public void setBusinessKey(String businessKey) { |
|||
this.businessKey = businessKey; |
|||
} |
|||
|
|||
public String getCustNo() { |
|||
return custNo; |
|||
} |
|||
|
|||
public void setCustNo(String custNo) { |
|||
this.custNo = custNo; |
|||
} |
|||
|
|||
public String getCustName() { |
|||
return custName; |
|||
} |
|||
|
|||
public void setCustName(String custName) { |
|||
this.custName = custName; |
|||
} |
|||
|
|||
public String getProcessStatus() { |
|||
return processStatus; |
|||
} |
|||
|
|||
public void setProcessStatus(String processStatus) { |
|||
this.processStatus = processStatus; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package io.sc.platform.flowable.support; |
|||
|
|||
import org.springframework.jdbc.core.RowMapper; |
|||
|
|||
import java.sql.ResultSet; |
|||
import java.sql.SQLException; |
|||
|
|||
public class BusinessKeyAndDescriptionWrapperMapper implements RowMapper<BusinessKeyAndDescriptionWrapper> { |
|||
@Override |
|||
public BusinessKeyAndDescriptionWrapper mapRow(ResultSet rs, int rowNum) throws SQLException { |
|||
BusinessKeyAndDescriptionWrapper wrapper =new BusinessKeyAndDescriptionWrapper(); |
|||
wrapper.setBusinessKey(rs.getString("BUSINESS_KEY")); |
|||
wrapper.setCustNo(rs.getString("CUST_NO")); |
|||
wrapper.setCustName(rs.getString("CUST_NAME")); |
|||
wrapper.setProcessStatus(rs.getString("PROCESS_STATUS")); |
|||
return wrapper; |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
package io.sc.platform.flowable.support; |
|||
|
|||
import java.util.Date; |
|||
|
|||
public class ProcessTaskAssigneeWrapper { |
|||
private String id; |
|||
private String name; |
|||
private String processInstanceId; |
|||
private Date endTime; |
|||
private String assignee; |
|||
private String assigneeName; |
|||
|
|||
public String getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(String id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getProcessInstanceId() { |
|||
return processInstanceId; |
|||
} |
|||
|
|||
public void setProcessInstanceId(String processInstanceId) { |
|||
this.processInstanceId = processInstanceId; |
|||
} |
|||
|
|||
public Date getEndTime() { |
|||
return endTime; |
|||
} |
|||
|
|||
public void setEndTime(Date endTime) { |
|||
this.endTime = endTime; |
|||
} |
|||
|
|||
public String getAssignee() { |
|||
return assignee; |
|||
} |
|||
|
|||
public void setAssignee(String assignee) { |
|||
this.assignee = assignee; |
|||
} |
|||
|
|||
public String getAssigneeName() { |
|||
return assigneeName; |
|||
} |
|||
|
|||
public void setAssigneeName(String assigneeName) { |
|||
this.assigneeName = assigneeName; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package io.sc.platform.flowable.support; |
|||
|
|||
import org.springframework.jdbc.core.RowMapper; |
|||
|
|||
import java.sql.ResultSet; |
|||
import java.sql.SQLException; |
|||
|
|||
public class ProcessTaskAssigneeWrapperMapper implements RowMapper<ProcessTaskAssigneeWrapper> { |
|||
@Override |
|||
public ProcessTaskAssigneeWrapper mapRow(ResultSet rs, int rowNum) throws SQLException { |
|||
ProcessTaskAssigneeWrapper wrapper =new ProcessTaskAssigneeWrapper(); |
|||
wrapper.setId(rs.getString("id")); |
|||
wrapper.setName(rs.getString("name")); |
|||
wrapper.setProcessInstanceId(rs.getString("processInstanceId")); |
|||
wrapper.setEndTime(rs.getTimestamp("endTime")); |
|||
wrapper.setAssignee(rs.getString("assignee")); |
|||
wrapper.setAssigneeName(rs.getString("assigneeName")); |
|||
return wrapper; |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
[ |
|||
/*系统/工作台*/ |
|||
{ "id": "parameter.system.workbench", "parentId": "parameter.system","order": 100 }, |
|||
/*系统/工作台/流程定义*/ |
|||
{ |
|||
"id": "parameter.system.workbench.processDefines", |
|||
"parentId": "parameter.system.workbench", |
|||
"code": "parameter.system.workbench.processDefines", |
|||
"multiLineText": true, |
|||
"defaultValue": "{}", |
|||
"order": 100 |
|||
}, |
|||
/*系统/工作台/流程状态*/ |
|||
{ |
|||
"id": "parameter.system.workbench.processStatus", |
|||
"parentId": "parameter.system.workbench", |
|||
"code": "parameter.system.workbench.processStatus", |
|||
"multiLineText": true, |
|||
"defaultValue": "{}", |
|||
"order": 200 |
|||
} |
|||
] |
@ -0,0 +1,3 @@ |
|||
parameter.system.workbench=Workbench |
|||
parameter.system.workbench.processDefines=Process Defines Mapping |
|||
parameter.system.workbench.processStatus=Process Status Enums |
@ -0,0 +1,3 @@ |
|||
parameter.system.workbench=\u5DE5\u4F5C\u53F0 |
|||
parameter.system.workbench.processDefines=\u6D41\u7A0B\u5B9A\u7FA9\u6620\u5C04 |
|||
parameter.system.workbench.processStatus=\u6D41\u7A0B\u72C0\u614B\u679A\u8209 |
@ -0,0 +1,3 @@ |
|||
parameter.system.workbench=\u5DE5\u4F5C\u53F0 |
|||
parameter.system.workbench.processDefines=\u6D41\u7A0B\u5B9A\u4E49\u6620\u5C04 |
|||
parameter.system.workbench.processStatus=\u6D41\u7A0B\u72B6\u6001\u679A\u4E3E |
@ -0,0 +1,46 @@ |
|||
select * from ( |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
T.START_TIME_ as startTime, |
|||
T.END_TIME_ as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
EXE.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus, |
|||
row_number() over(partition by T.PROC_INST_ID_ order by T.END_TIME_ desc) as RK |
|||
from ACT_HI_TASKINST T |
|||
left join ACT_RE_PROCDEF DEF on DEF.ID_ = T.PROC_DEF_ID_ |
|||
left join ACT_RU_EXECUTION EXE on EXE.ID_ = T.PROC_INST_ID_ |
|||
left join SYS_USER U on U.LOGINNAME_ = T.ASSIGNEE_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
where T.PROC_INST_ID_ ='${0}' |
|||
) TMP where TMP.RK = 1 |
@ -0,0 +1,48 @@ |
|||
select * from ( |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
INST.START_TIME_ as startTime, |
|||
INST.END_TIME_ as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
|
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
|
|||
INST.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus, |
|||
row_number() over(partition by T.PROC_INST_ID_ order by T.END_TIME_ desc) as RK |
|||
from ACT_HI_TASKINST T |
|||
left join ACT_RE_PROCDEF DEF on DEF.ID_ = T.PROC_DEF_ID_ |
|||
left join ACT_HI_PROCINST INST on T.PROC_INST_ID_ = INST.PROC_INST_ID_ |
|||
left join SYS_USER U on U.LOGINNAME_ = T.ASSIGNEE_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
where T.PROC_INST_ID_ ='${0}' |
|||
) tmp where tmp.RK = 1 |
@ -0,0 +1,52 @@ |
|||
select * from ( |
|||
select * from ( |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
T.CREATE_TIME_ as startTime, |
|||
NULL as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
EXE.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus, |
|||
row_number() over(partition by HT.PROC_INST_ID_ order by HT.END_TIME_ desc) as RK |
|||
from ACT_HI_TASKINST HT |
|||
join ACT_RU_TASK T on T.PROC_INST_ID_ = HT.PROC_INST_ID_ |
|||
join ACT_RU_EXECUTION EXE on T.PROC_INST_ID_ = EXE.ID_ |
|||
left join ACT_RE_PROCDEF DEF on HT.PROC_DEF_ID_ = DEF.ID_ |
|||
left join SYS_USER U on T.ASSIGNEE_ = U.LOGINNAME_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
where |
|||
HT.ASSIGNEE_ ='${0}' |
|||
and T.ASSIGNEE_ <> '${0}' |
|||
and HT.END_TIME_ is not null |
|||
) TMP where TMP.RK = 1 |
|||
) R |
@ -0,0 +1,64 @@ |
|||
select * from ( |
|||
select * from ( |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
INST.START_TIME_ as startTime, |
|||
INST.END_TIME_ as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
|
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
|
|||
INST.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus, |
|||
row_number() over(partition by T.PROC_INST_ID_ order by T.END_TIME_ desc) as RK |
|||
from ACT_HI_TASKINST T |
|||
left join ACT_RE_PROCDEF DEF on T.PROC_DEF_ID_ = DEF.ID_ |
|||
join ACT_HI_PROCINST INST on T.PROC_INST_ID_ = INST.PROC_INST_ID_ |
|||
left join SYS_USER U on U.LOGINNAME_ = T.ASSIGNEE_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
where |
|||
exists ( |
|||
select 1 from ACT_HI_TASKINST AHT |
|||
where |
|||
AHT.ASSIGNEE_ = '${0}' |
|||
and AHT.END_TIME_ is not null |
|||
and exists ( |
|||
select 1 from ACT_HI_PROCINST AHP |
|||
where |
|||
AHP.END_TIME_ is not null |
|||
and AHP.END_ACT_ID_ is not null |
|||
and AHP.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
) |
|||
and AHT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
) |
|||
) tmp where tmp.RK = 1 |
|||
) R |
@ -0,0 +1,44 @@ |
|||
select * from ( |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
T.CREATE_TIME_ as startTime, |
|||
NULL as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
EXE.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus |
|||
from ACT_RU_TASK T |
|||
left join ACT_RE_PROCDEF DEF on DEF.ID_ = T.PROC_DEF_ID_ |
|||
left join ACT_RU_EXECUTION EXE on EXE.ID_ = T.PROC_INST_ID_ |
|||
left join SYS_USER U on U.LOGINNAME_ = T.ASSIGNEE_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
) R |
@ -0,0 +1,16 @@ |
|||
select * from ( |
|||
select |
|||
HT.ID_ as id, |
|||
HT.NAME_ as name, |
|||
HT.PROC_INST_ID_ as processInstanceId, |
|||
HT.END_TIME_ as endTime, |
|||
HT.ASSIGNEE_ as assignee, |
|||
USER.USERNAME_ as assigneeName, |
|||
row_number() over(partition by PROC_INST_ID_ order by END_TIME_ desc) as RK |
|||
from ACT_HI_TASKINST HT |
|||
left join SYS_USER USER on USER.LOGINNAME_ = HT.ASSIGNEE_ |
|||
where |
|||
HT.END_TIME_ is not null |
|||
and HT.PROC_INST_ID_ in (${0}) |
|||
) R |
|||
where R.RK = 1 |
@ -0,0 +1,43 @@ |
|||
select |
|||
T.ID_ as id, |
|||
T.NAME_ as name, |
|||
T.DESCRIPTION_ as description, |
|||
T.PRIORITY_ as priority, |
|||
T.OWNER_ as owner, |
|||
T.ASSIGNEE_ as assignee, |
|||
T.PROC_INST_ID_ as processInstanceId, |
|||
T.EXECUTION_ID_ as executionId, |
|||
T.PROC_DEF_ID_ as processDefinitionId, |
|||
T.SCOPE_ID_ as scopeId, |
|||
T.SUB_SCOPE_ID_ as subScopeId, |
|||
T.SCOPE_TYPE_ as scopeType, |
|||
T.SCOPE_DEFINITION_ID_ as scopeDefinitionId, |
|||
T.CREATE_TIME_ as startTime, |
|||
NULL as endTime, |
|||
T.TASK_DEF_KEY_ as taskDefinitionKey, |
|||
T.DUE_DATE_ as dueDate, |
|||
T.CATEGORY_ as category, |
|||
T.PARENT_TASK_ID_ as parentTaskId, |
|||
T.TENANT_ID_ as tenantId, |
|||
T.FORM_KEY_ as formKey, |
|||
T.CLAIM_TIME_ as claimTime, |
|||
U.USERNAME_ as assigneeName, |
|||
DEF.KEY_ as processDefinitionKey, |
|||
DEF.NAME_ as processDefinitionName, |
|||
DEF.VERSION_ as processDefinitionVersion, |
|||
EXE.BUSINESS_KEY_ as businessKey, |
|||
CONCAT(PROCESS_EXT.CUST_NO_,PROCESS_EXT.CUST_NAME_) as businessDescription, |
|||
PROCESS.TASK_HAND_FE_ROUTE_NAME_ as taskHandFrontendRouteName, |
|||
PROCESS.TASK_HAND_FE_MODEL_NAME_ as taskHandFrontendModelName, |
|||
PROCESS.TASK_HAND_FE_COMP_NAME_ as taskHandFrontendComponentName, |
|||
PROCESS.TASK_HAND_FE_COMP_PROPS_ as taskHandFrontendComponentProperties, |
|||
PROCESS_EXT.CUST_NO_ as custNo, |
|||
PROCESS_EXT.CUST_NAME_ as custName, |
|||
PROCESS_EXT.PROCESS_STATUS_ as processStatus |
|||
from ACT_RU_TASK T |
|||
left join ACT_RE_PROCDEF DEF on DEF.ID_ = T.PROC_DEF_ID_ |
|||
left join ACT_RU_EXECUTION EXE on EXE.ID_ = T.PROC_INST_ID_ |
|||
left join SYS_USER U on U.LOGINNAME_ = T.ASSIGNEE_ |
|||
left join SYS_PROCESS PROCESS on PROCESS.DEPLOYED_ID_ = T.PROC_DEF_ID_ |
|||
left join SYS_PROCESS_INST_EXT PROCESS_EXT on PROCESS_EXT.PROC_INST_ID_ = T.PROC_INST_ID_ |
|||
where T.ID_ ='${0}' and T.ASSIGNEE_='${1}' |
Loading…
Reference in new issue