测试 流程代码

master
wanghao 3 months ago
parent 07107d9979
commit 1a28cc4ceb

@ -38,6 +38,7 @@ public class ExperimentRequest extends BaseEntity
/** 使用的设备名称 */
@Excel(name = "使用的设备名称")
private String deviceName;
private String device2Name;
/** 实验内容 */
@Excel(name = "实验内容")
@ -46,7 +47,16 @@ public class ExperimentRequest extends BaseEntity
/** 实验申请流程ID */
private Long processId;
public void setObjid(Long objid)
public String getDevice2Name() {
return device2Name;
}
public void setDevice2Name(String device2Name) {
this.device2Name = device2Name;
}
public void setObjid(Long objid)
{
this.objid = objid;
}

@ -54,7 +54,7 @@ public class ExperimentRequestServiceImpl implements IExperimentRequestService
@Override
public int insertExperimentRequest(ExperimentRequest experimentRequest)
{
experimentRequest.setCreateTime(DateUtils.getNowDate());
experimentRequest.setCreationTime(DateUtils.getNowDate());
return experimentRequestMapper.insertExperimentRequest(experimentRequest);
}

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="creationTime" column="creation_time" />
<result property="executionTime" column="execution_time" />
<result property="deviceName" column="device_name" />
<result property="device2Name" column="device2_name" />
<result property="experimentDesc" column="experiment_desc" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectExperimentRequestVo">
select objid, customer_name, project_name, creation_time, execution_time, device_name, experiment_desc, create_by, create_time, update_by, update_time, process_id from experiment_request
select objid, customer_name, project_name, creation_time, execution_time, device_name,device2_name, experiment_desc, create_by, create_time, update_by, update_time, process_id from experiment_request
</sql>
<select id="selectExperimentRequestList" parameterType="ExperimentRequest" resultMap="ExperimentRequestResult">
@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creationTime != null">creation_time,</if>
<if test="executionTime != null">execution_time,</if>
<if test="deviceName != null">device_name,</if>
<if test="device2Name != null">device2_name,</if>
<if test="experimentDesc != null">experiment_desc,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -64,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creationTime != null">#{creationTime},</if>
<if test="executionTime != null">#{executionTime},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="device2Name != null">#{device2Name},</if>
<if test="experimentDesc != null">#{experimentDesc},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -81,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creationTime != null">creation_time = #{creationTime},</if>
<if test="executionTime != null">execution_time = #{executionTime},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="device2Name != null">device2_name = #{device2Name},</if>
<if test="experimentDesc != null">experiment_desc = #{experimentDesc},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:activiti="http://activiti.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.activiti.org/test">
<process id="leave-countersign" name="请假流程-会签" isExecutable="true">
<documentation>请假流程演示-会签</documentation>
<startEvent id="startevent1" name="Start" activiti:initiator="applyUserId">
<extensionElements>
<activiti:formProperty id="startDate" name="请假开始日期" type="date" datePattern="yyyy-MM-dd" required="true"/>
<activiti:formProperty id="endDate" name="请假结束日期" type="date" datePattern="yyyy-MM-dd" required="true"/>
<activiti:formProperty id="reason" name="请假原因" type="string" required="true"/>
<activiti:formProperty id="users" name="审批参与人" type="users" required="true"/>
<activiti:formProperty id="validScript" type="javascript" default="alert('表单已经加载完毕');"/>
</extensionElements>
</startEvent>
<userTask id="countersign" name="[部门/人事]联合会签" activiti:assignee="${user}">
<extensionElements>
<activiti:formProperty id="startDate" name="请假开始日期" type="date" datePattern="yyyy-MM-dd" writable="false"/>
<activiti:formProperty id="endDate" name="请假结束日期" type="date" datePattern="yyyy-MM-dd" writable="false"/>
<activiti:formProperty id="reason" name="请假原因" type="string" writable="false"/>
<activiti:formProperty id="approved" name="审批意见" type="enum" required="true">
<activiti:value id="true" name="同意"/>
<activiti:value id="false" name="拒绝"/>
</activiti:formProperty>
<activiti:taskListener event="complete" delegateExpression="${leaveCounterSignCompleteListener}"/>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="users" activiti:elementVariable="user"/>
</userTask>
<userTask id="reportBack" name="销假" activiti:assignee="${applyUserId}">
<extensionElements>
<activiti:formProperty id="startDate" name="请假开始日期" type="date" datePattern="yyyy-MM-dd" writable="false"/>
<activiti:formProperty id="endDate" name="请假结束日期" type="date" datePattern="yyyy-MM-dd" writable="false"/>
<activiti:formProperty id="reason" name="请假原因" type="string" writable="false"/>
<activiti:formProperty id="reportBackDate" name="销假日期" type="date" default="${endDate}" datePattern="yyyy-MM-dd" required="true"/>
</extensionElements>
</userTask>
<endEvent id="endevent1" name="End"/>
<sequenceFlow id="flow2" sourceRef="startevent1" targetRef="countersign">
<extensionElements>
<activiti:executionListener event="take" expression="${execution.setVariable('approvedCounter', 0)}"/>
</extensionElements>
</sequenceFlow>
<sequenceFlow id="flow8" name="销假" sourceRef="reportBack" targetRef="endevent1">
<extensionElements>
<activiti:executionListener event="take" expression="${execution.setVariable('result', 'ok')}"/>
</extensionElements>
</sequenceFlow>
<sequenceFlow id="flow13" name="全部通过" sourceRef="exclusivegateway1" targetRef="reportBack">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvedCounter == users.size()}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"/>
<sequenceFlow id="flow14" sourceRef="countersign" targetRef="exclusivegateway1"/>
<userTask id="modifyApply" name="调整申请" activiti:assignee="${applyUserId}">
<extensionElements>
<activiti:formProperty id="startDate" name="请假开始日期" type="date" datePattern="yyyy-MM-dd" required="true"/>
<activiti:formProperty id="endDate" name="请假结束日期" type="date" datePattern="yyyy-MM-dd" required="true"/>
<activiti:formProperty id="reason" name="请假原因" type="string" required="true"/>
<activiti:formProperty id="reApply" name="重新申请" type="enum" required="true">
<activiti:value id="true" name="重新申请"/>
<activiti:value id="false" name="取消申请"/>
</activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="flow15" name="部分通过" sourceRef="exclusivegateway1" targetRef="modifyApply">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${approvedCounter < users.size()}]]></conditionExpression>
</sequenceFlow>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"/>
<sequenceFlow id="flow16" sourceRef="modifyApply" targetRef="exclusivegateway2"/>
<sequenceFlow id="flow17" sourceRef="exclusivegateway2" targetRef="endevent1">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'false'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow18" name="重新申请" sourceRef="exclusivegateway2" targetRef="countersign">
<extensionElements>
<activiti:executionListener event="take" expression="${execution.setVariable('approvedCounter', 0)}"/>
</extensionElements>
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'true'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_leave-countersign">
<bpmndi:BPMNPlane bpmnElement="leave-countersign" id="BPMNPlane_leave-countersign">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="10.0" y="30.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="countersign" id="BPMNShape_countersign">
<omgdc:Bounds height="55.0" width="105.0" x="90.0" y="20.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="reportBack" id="BPMNShape_reportBack">
<omgdc:Bounds height="55.0" width="105.0" x="340.0" y="20.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="375.0" y="203.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="220.0" y="27.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="modifyApply" id="BPMNShape_modifyApply">
<omgdc:Bounds height="55.0" width="105.0" x="187.00002" y="110.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="220.0" y="200.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="45.0" y="47.0"/>
<omgdi:waypoint x="90.0" y="47.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="392.0" y="75.0"/>
<omgdi:waypoint x="392.0" y="203.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="11.0" width="22.0" x="400.0" y="131.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
<omgdi:waypoint x="260.0" y="47.0"/>
<omgdi:waypoint x="340.0" y="47.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="11.0" width="44.0" x="270.0" y="30.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
<omgdi:waypoint x="195.0" y="47.0"/>
<omgdi:waypoint x="220.0" y="47.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
<omgdi:waypoint x="240.0" y="67.0"/>
<omgdi:waypoint x="239.00002" y="110.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="11.0" width="44.0" x="250.0" y="67.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow16" id="BPMNEdge_flow16">
<omgdi:waypoint x="239.00002" y="165.0"/>
<omgdi:waypoint x="240.0" y="200.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow17" id="BPMNEdge_flow17">
<omgdi:waypoint x="260.0" y="220.0"/>
<omgdi:waypoint x="375.0" y="220.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow18" id="BPMNEdge_flow18">
<omgdi:waypoint x="220.0" y="220.0"/>
<omgdi:waypoint x="142.0" y="220.0"/>
<omgdi:waypoint x="142.0" y="75.0"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="11.0" width="44.0" x="163.0" y="203.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

@ -2,42 +2,71 @@
<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:activiti="http://activiti.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.activiti.org/processdef">
<process id="test" name="test" isExecutable="true">
<startEvent id="sid-83d1d272-5385-4734-bc78-3e17f5b9cf34" name="MyExperiment"/>
<userTask id="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b" name="提交实验申请" activiti:assignee="admin">
<userTask id="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b" name="提交实验申请" activiti:assignee="${name}">
<extensionElements>
<activiti:executionListener class="Class 1"/>
</extensionElements>
</userTask>
<userTask id="sid-4b0334a8-5f53-4bfd-ba83-709a2e44ecd5" name="审批实验申请" activiti:assignee="admin"/>
<endEvent id="sid-553cbcbf-f350-4cc2-8655-ae94891202df" name="EndExperiment"/>
<sequenceFlow id="sid-7522a129-7090-4848-9d45-d98c9133d5a3" sourceRef="sid-83d1d272-5385-4734-bc78-3e17f5b9cf34" targetRef="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b"/>
<sequenceFlow id="sid-27ea2a77-d95c-44ff-b270-bd5b2c24d669" sourceRef="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b" targetRef="sid-4b0334a8-5f53-4bfd-ba83-709a2e44ecd5"/>
<sequenceFlow id="sid-8f5a5b31-7182-44b0-b9a1-4fd0862fe439" sourceRef="sid-4b0334a8-5f53-4bfd-ba83-709a2e44ecd5" targetRef="sid-553cbcbf-f350-4cc2-8655-ae94891202df"/>
<userTask id="sid-37067d0c-bb8b-4e0a-9e2b-4ff38208288a" name="完善方案" activiti:assignee="${name2}"/>
<endEvent id="sid-f5e4b7f6-627f-4db5-85b9-821dfb72c49c">
<terminateEventDefinition/>
</endEvent>
<exclusiveGateway id="sid-b4f562a6-d5ff-4bb6-80d7-77e9ef84309c"/>
<sequenceFlow id="sid-e5730a51-5a01-4285-98b5-194f69d36b45" sourceRef="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b" targetRef="sid-b4f562a6-d5ff-4bb6-80d7-77e9ef84309c"/>
<sequenceFlow id="sid-91e8f00e-a53c-4be3-9b7c-b02f956afb79" sourceRef="sid-b4f562a6-d5ff-4bb6-80d7-77e9ef84309c" targetRef="sid-37067d0c-bb8b-4e0a-9e2b-4ff38208288a" name="大于4">
<conditionExpression xsi:type="tFormalExpression">${day&gt;4}</conditionExpression>
</sequenceFlow>
<userTask id="sid-ba70f5f9-ba4e-42dd-b318-87f3dc640b56" name="审批失败" activiti:assignee="admin"/>
<sequenceFlow id="sid-d916366e-042f-4666-b98e-e99915a19db9" sourceRef="sid-b4f562a6-d5ff-4bb6-80d7-77e9ef84309c" targetRef="sid-ba70f5f9-ba4e-42dd-b318-87f3dc640b56" name="shibai">
<conditionExpression xsi:type="tFormalExpression">${day&lt;4}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-b2cfc049-a44d-4762-8f3e-dec6e3c014e7" sourceRef="sid-37067d0c-bb8b-4e0a-9e2b-4ff38208288a" targetRef="sid-f5e4b7f6-627f-4db5-85b9-821dfb72c49c"/>
<sequenceFlow id="sid-29214fe1-e218-44e7-902f-474f0b1914a7" sourceRef="sid-ba70f5f9-ba4e-42dd-b318-87f3dc640b56" targetRef="sid-f5e4b7f6-627f-4db5-85b9-821dfb72c49c"/>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape id="shape-146a17ec-408d-45ab-ab93-b7ba5cb9021e" bpmnElement="sid-83d1d272-5385-4734-bc78-3e17f5b9cf34">
<omgdc:Bounds x="-160.0" y="-50.0" width="30.0" height="30.0"/>
<omgdc:Bounds x="-330.0" y="-295.0" width="30.0" height="30.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape-ba38fde3-952d-4e78-95b8-2e8ab7094203" bpmnElement="sid-57c01ea3-67e2-476c-b8b4-4565d5e6ab1b">
<omgdc:Bounds x="-95.0" y="-75.0" width="100.0" height="80.0"/>
<omgdc:Bounds x="-265.0" y="-320.0" width="100.0" height="80.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape-e7f923f9-bddd-4ff1-8e50-af73df9f6d77" bpmnElement="sid-4b0334a8-5f53-4bfd-ba83-709a2e44ecd5">
<omgdc:Bounds x="35.0" y="-75.0" width="100.0" height="80.0"/>
<bpmndi:BPMNEdge id="edge-e3714df0-85f8-48ee-8a52-765f5386ee6a" bpmnElement="sid-7522a129-7090-4848-9d45-d98c9133d5a3">
<omgdi:waypoint x="-300.0" y="-280.0"/>
<omgdi:waypoint x="-265.0" y="-280.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="shape-4e4e387e-5b2e-4c87-83bf-cf65db5f3a40" bpmnElement="sid-37067d0c-bb8b-4e0a-9e2b-4ff38208288a">
<omgdc:Bounds x="-70.0" y="-490.0" width="100.0" height="80.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="shape-b058a371-22b6-470d-bbc0-35e65ffba201" bpmnElement="sid-553cbcbf-f350-4cc2-8655-ae94891202df">
<omgdc:Bounds x="170.0" y="-50.0" width="30.0" height="30.0"/>
<bpmndi:BPMNShape id="shape-1700733c-8da3-4ad1-b84b-5595a8bf88fd" bpmnElement="sid-f5e4b7f6-627f-4db5-85b9-821dfb72c49c">
<omgdc:Bounds x="180.0" y="-295.0" width="30.0" height="30.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge-e3714df0-85f8-48ee-8a52-765f5386ee6a" bpmnElement="sid-7522a129-7090-4848-9d45-d98c9133d5a3">
<omgdi:waypoint x="-130.0" y="-35.0"/>
<omgdi:waypoint x="-95.0" y="-35.0"/>
<bpmndi:BPMNShape id="shape-666391e3-8917-48a7-a6a3-cea95c58b2da" bpmnElement="sid-b4f562a6-d5ff-4bb6-80d7-77e9ef84309c">
<omgdc:Bounds x="-235.0" y="-465.0" width="40.0" height="40.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge-2f8e271c-56b9-4fe3-9105-414395ef7627" bpmnElement="sid-e5730a51-5a01-4285-98b5-194f69d36b45">
<omgdi:waypoint x="-215.0" y="-320.0"/>
<omgdi:waypoint x="-215.0" y="-425.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge-4b05caec-8a00-48b6-b81a-2a6be4ac1d91" bpmnElement="sid-91e8f00e-a53c-4be3-9b7c-b02f956afb79">
<omgdi:waypoint x="-195.0" y="-445.0"/>
<omgdi:waypoint x="-70.00001" y="-445.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="shape-1f01541b-c437-4acb-8625-9ace63d97ede" bpmnElement="sid-ba70f5f9-ba4e-42dd-b318-87f3dc640b56">
<omgdc:Bounds x="-65.0" y="-319.99997" width="100.0" height="80.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="edge-9fa80f92-bcea-442d-8042-0bcde2280e09" bpmnElement="sid-d916366e-042f-4666-b98e-e99915a19db9">
<omgdi:waypoint x="-215.0" y="-465.0"/>
<omgdi:waypoint x="-65.0" y="-299.99997"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge-d0c5fbf9-e586-47da-8053-815add4c3bd0" bpmnElement="sid-27ea2a77-d95c-44ff-b270-bd5b2c24d669">
<omgdi:waypoint x="5.0" y="-35.0"/>
<omgdi:waypoint x="35.0" y="-35.0"/>
<bpmndi:BPMNEdge id="edge-d5f78863-124f-4f06-95b0-f5773d6977f1" bpmnElement="sid-b2cfc049-a44d-4762-8f3e-dec6e3c014e7">
<omgdi:waypoint x="30.0" y="-430.0"/>
<omgdi:waypoint x="180.0" y="-287.5"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="edge-14815c7d-b125-4e81-8bf2-90a3f72d27bc" bpmnElement="sid-8f5a5b31-7182-44b0-b9a1-4fd0862fe439">
<omgdi:waypoint x="135.0" y="-35.0"/>
<omgdi:waypoint x="170.0" y="-35.0"/>
<bpmndi:BPMNEdge id="edge-b212f3c0-e119-4c30-96c0-429ca9e5944d" bpmnElement="sid-29214fe1-e218-44e7-902f-474f0b1914a7">
<omgdi:waypoint x="35.0" y="-279.99997"/>
<omgdi:waypoint x="180.0" y="-280.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

@ -1,81 +1,100 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('新增实验申请信息')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: header('新增实验申请信息')"/>
<th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-experiment_request-add">
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerName" class="form-control" type="text">
</div>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-experiment_request-add">
<div class="form-group">
<label class="col-sm-2 control-label">客户名称:</label>
<div class="col-sm-4">
<select name="customerName" class="form-control"
th:with=" type=${@baseCustomerServiceImpl.selectBaseCustomerList(null)}">
<option th:each="dict : ${type}" th:text="${dict.customerName}"
th:value="${dict.customerName}"></option>
</select>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<input name="projectName" class="form-control" type="text">
</div>
<label class="col-sm-2 control-label">项目名称:</label>
<div class="col-sm-4">
<input name="projectName" class="form-control" type="text">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验创建时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="creationTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="col-sm-3 control-label">申请时间:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <div class="input-group date">-->
<!-- <input name="creationTime" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-2 control-label">实验设备1</label>
<div class="col-sm-4">
<!-- <input name="deviceName" class="form-control" type="text">-->
<select name="deviceName" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验执行时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="executionTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
<label class="col-sm-2 control-label">实验设备2</label>
<div class="col-sm-4">
<select name="device2Name" class="form-control m-b"
th:with="type=${@baseDeviceInfoServiceImpl.selectBaseDeviceInfoList(null)}">
<option th:each="dict : ${type}" th:text="${dict.deviceName}"
th:value="${dict.deviceName}"></option>
</select>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">使用的设备名称:</label>
<div class="col-sm-8">
<input name="deviceName" class="form-control" type="text">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="executionTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验内容:</label>
<div class="col-sm-8">
<input name="experimentDesc" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">实验方案:</label>
<div class="col-sm-8">
<textarea name="experimentDesc" class="form-control" type="text"></textarea>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "activiti/experiment_request"
$("#form-experiment_request-add").validate({
focusCleanup: true
});
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var prefix = ctx + "activiti/experiment_request"
$("#form-experiment_request-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-experiment_request-add').serialize());
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-experiment_request-add').serialize());
}
}
$("input[name='creationTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='creationTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='executionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
$("input[name='executionTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -102,19 +102,24 @@
},
{
field: 'creationTime',
title: '实验创建时间'
title: '申请时间'
},
{
field: 'executionTime',
title: '实验执行时间'
title: '实验时间'
},
{
field: 'deviceName',
title: '使用的设备名称'
title: '实验设备1'
},
{
field: 'device2Name',
title: '实验设备2'
},
{
field: 'experimentDesc',
title: '实验内容'
title: '实验方案'
},
{
title: '操作',

@ -1,390 +1,405 @@
//import org.activiti.engine.*;
//import org.activiti.engine.history.HistoricActivityInstance;
//import org.activiti.engine.repository.Deployment;
//import org.activiti.engine.repository.ProcessDefinition;
//import org.activiti.engine.runtime.ProcessInstance;
//import org.activiti.engine.task.Comment;
//import org.activiti.engine.task.Task;
//import org.junit.Test;
//import org.springframework.util.FileCopyUtils;
//
//import java.io.File;
//import java.io.IOException;
//import java.io.InputStream;
//import java.nio.file.Files;
//import java.nio.file.Paths;
//import java.util.List;
//
//public class test {
//
// /**
// * 初始化数据库表:第一种方式
// */
// @Test
// public void testInitOne() {
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// System.err.println("processEngine = " + processEngine);
// }
//
//
// /**
// * 初始化数据库表:第二种方式
// */
// @Test
// public void testInitTwo() {
// ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
// ProcessEngine processEngine = configuration.buildProcessEngine();
// System.err.println("processEngine = " + processEngine);
// }
//
//
// /**
// * 流程部署
// */
// @Test
// public void testDeploy() {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取 repositoryService 对象
// RepositoryService repositoryService = processEngine.getRepositoryService();
// // 进行部署
// Deployment deployment = repositoryService.createDeployment()
// .addClasspathResource("processes/test.bpmn20.xml")
// .addClasspathResource("processes/test.png")
// .name("实验流程")
// .deploy();
//
// // 输出部署的一些信息
// System.out.println("流程部署ID" + deployment.getId());
// System.out.println("流程部署名称:" + deployment.getName());
// }
//
//
// /**
// * 启动流程实例
// */
// @Test
// public void testStartProcess() {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取 runtimeService 对象
// RuntimeService runtimeService = processEngine.getRuntimeService();
// // 根据流程定义的key启动流程实例这个key是在定义bpmn的时候设置的
// ProcessInstance instance = runtimeService.startProcessInstanceByKey("test");
// // 获取流程实例的相关信息
// System.out.println("流程定义的id = " + instance.getProcessDefinitionId());
// System.out.println("流程实例的id = " + instance.getId());
// }
//
//
// /**
// * 查询待办任务
// */
// @Test
// public void testSelectTodoTaskList() {
// String assignee = "李四";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取指定用户审核任务
// TaskService taskService = processEngine.getTaskService();
// // 使用面对对象方式查询数据库
// List<Task> tasks = taskService.createTaskQuery()
// .processDefinitionKey("test")
// .taskAssignee(assignee)
// // 返回多个结果
// .list();
// // 只返回一个结果
// // .singleResult();
//
// // 自定义 sql 查询
// // taskService.createNativeTaskQuery();
//
// // 获取流程实例的相关信息
// for (Task task : tasks) {
// System.out.println("流程定义的id = " + task.getProcessDefinitionId());
// System.out.println("流程实例的id = " + task.getProcessInstanceId());
// System.out.println("任务id = " + task.getId());
// System.out.println("任务名称 = " + task.getName());
// }
// }
//
//
// /**
// * 指定用户去完成任务待办:多人审批在这操作,改变审核人名称就行了
// */
// @Test
// public void testCompleteTask() {
// String assignee = "李四";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取指定用户审核任务
// TaskService taskService = processEngine.getTaskService();
// List<Task> tasks = taskService.createTaskQuery()
// .processDefinitionKey("test")
// .taskAssignee(assignee)
// .list();
// if (tasks != null && !tasks.isEmpty()){
// // 当前流程图所限制,只能做审核同意的动作
// for (Task task : tasks) {
// taskService.complete(task.getId());
// }
// }
// }
//
//
// /**
// * 审批添加备注
// */
// @Test
// public void testAddComment() {
// String assignee = "张三";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取指定用户审核任务
// TaskService taskService = processEngine.getTaskService();
// List<Task> tasks = taskService.createTaskQuery()
// .processDefinitionKey("test")
// .taskAssignee(assignee)
// .list();
// if (tasks != null && !tasks.isEmpty()) {
// // 当前流程图所限制,只能做审核同意的动作
// for (Task task : tasks) {
// // 添加备注
// taskService.addComment(task.getId(), task.getProcessInstanceId(), assignee + "表示同意");
// taskService.complete(task.getId());
// }
// }
// }
//
//
// /**
// * 查询审批历史
// */
// @Test
// public void testSelectHistoryTask() {
// String processInstanceId = "2501";
// String assignee = "张三";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 查看历史信息
// HistoryService historyService = processEngine.getHistoryService();
// // 获取指定用户审核任务
// TaskService taskService = processEngine.getTaskService();
// // 获取历史审核信息
// List<HistoricActivityInstance> userTask = historyService.createHistoricActivityInstanceQuery()
// .activityType("userTask")
// // 指定实例的id
// .processInstanceId(processInstanceId)
// .taskAssignee(assignee)
// .finished()
// .list();
//
// for (HistoricActivityInstance instance : userTask) {
// System.out.println("任务名称 = " + instance.getActivityName());
// System.out.println("任务开始时间 = " + instance.getStartTime());
// System.out.println("任务结束时间 = " + instance.getEndTime());
// System.out.println("任务耗时 = " + instance.getDurationInMillis());
// // 获取审批批注信息
// List<Comment> taskComments = taskService.getTaskComments(instance.getTaskId());
// if (!taskComments.isEmpty()){
// System.out.println("审批批注 = " + taskComments.get(0).getFullMessage());
// }
// }
// }
//
//
// /**
// * 查询流程相关信息
// */
// @Test
// public void testDefinitionQuery() {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取仓库服务
// RepositoryService repositoryService = processEngine.getRepositoryService();
// // 获取流程定义集合
// List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
// .processDefinitionKey("test")
// // 最新的一个版本
// .latestVersion()
// .list();
// // 遍历集合
// for (ProcessDefinition definition : processDefinitionList) {
// System.out.println("流程定义id = " + definition.getId());
// System.out.println("流程定义名称 = " + definition.getName());
// System.out.println("流程定义key = " + definition.getKey());
// System.out.println("流程定义版本 = " + definition.getVersion());
// System.out.println("流程部署id = " + definition.getDeploymentId());
// System.out.println("===============");
// }
// }
//
//
// /**
// * 资源文件下载
// */
// @Test
// public void testDownloadResource() throws IOException {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取仓库服务
// RepositoryService repositoryService = processEngine.getRepositoryService();
// // 获取流程定义集合
// List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery()
// .processDefinitionKey("test")
// // 按照版本降序
// .orderByProcessDefinitionVersion()
// // 降序
// .desc()
// .list();
//
// // 获取最新那个
// ProcessDefinition definition = list.get(0);
// // 获取部署id
// String deploymentId = definition.getDeploymentId();
//
// // 获取bpmn的输入流
// InputStream bpmnInputStream = repositoryService.getResourceAsStream(deploymentId, definition.getResourceName());
// // 获取png的输入流
//// InputStream pngInputStream = repositoryService.getResourceAsStream(deploymentId, definition.getDiagramResourceName());
//
// String resourcePath = "C:/Users/ASUS/Desktop/" + File.separator + definition.getResourceName();
// File file = new File(resourcePath);
// if (!file.exists()) {
// file.getParentFile().mkdirs();
// }
//
// String diagramResourcePath = "C:/Users/ASUS/Desktop/" + File.separator + definition.getDiagramResourceName();
// file = new File(diagramResourcePath);
// if (!file.exists()) {
// file.getParentFile().mkdirs();
// }
//
// //复制文件
// FileCopyUtils.copy(bpmnInputStream, Files.newOutputStream(Paths.get(resourcePath)));
//// FileCopyUtils.copy(pngInputStream, Files.newOutputStream(Paths.get(diagramResourcePath)));
// }
//
//
// /**
// * 删除已经部署的流程定义
// */
// @Test
// public void testDeleteDeploy() {
// // 删除已经部署的流程定义
// String deploymentId = "45001";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取仓库服务
// RepositoryService repositoryService = processEngine.getRepositoryService();
// // 删除流程定义,如果改流程定义已有流程实例启动,则会报错
//// repositoryService.deleteDeployment(deploymentId);
// // 设置 true级联删除流程定义即使有启动的实例也可以删除
// repositoryService.deleteDeployment(deploymentId, true);
// }
//
//
// /**
// * 启动流程,需要进行 BusinessKey 绑定流程实例
// */
// @Test
// public void testStartBindBusinessKey() {
// String businessKey = "1";
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// RuntimeService runtimeService = processEngine.getRuntimeService();
// // 根据流程定义的key启动流程实例这个key是在定义bpmn的时候设置的
// // 在启动流程的时候将业务key加进去
// ProcessInstance instance = runtimeService.startProcessInstanceByKey("test", businessKey);
// // 获取流程实例的相关信息
// System.out.println("流程定义id = " + instance.getProcessDefinitionId());
// System.out.println("流程实例id = " + instance.getId());
// System.out.println("业务标识 = " + instance.getBusinessKey());
// }
//
//
// /**
// * 跑到下一个节点,需要进行审批了,此时需要获取 BusinessKey 进而获取请假单信息
// */
// @Test
// public void testGetBusinessKey() {
// // 1、获取李四的待办信息
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// TaskService taskService = processEngine.getTaskService();
// List<Task> task = taskService.createTaskQuery()
// .taskAssignee("李四")
// .processDefinitionKey("test")
// .list();
//
// // 2、获取 businessKey
// // 获取流程实例id
// String processInstanceId = task.get(1).getProcessInstanceId();
// RuntimeService runtimeService = processEngine.getRuntimeService();
// ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
// .processInstanceId(processInstanceId)
// .singleResult();
// String businessKey = processInstance.getBusinessKey();
//
// System.out.println("业务标识 = " + businessKey);
// }
//
//
// /**
// * 流程定义挂起与激活
// */
// @Test
// public void testSuspendAllProcessInstance() {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// // 获取仓库服务
// RepositoryService repositoryService = processEngine.getRepositoryService();
// // 获取流程定义对象
// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
// .processDefinitionKey("test")
// .singleResult();
// boolean suspended = processDefinition.isSuspended();
// // 输出流程定义状态
// System.out.println("流程定义状态:" + (suspended ? "已挂起" : "已激活"));
// String processDefinitionId = processDefinition.getId();
//
// if (suspended) {
// repositoryService.activateProcessDefinitionById(processDefinitionId, true, null);
// System.out.println("流程id" + processDefinitionId + "已激活");
// } else {
// repositoryService.suspendProcessDefinitionById(processDefinitionId, true, null);
// System.out.println("流程id" + processDefinitionId + "已挂起");
// }
// }
//
//
// /**
// * 流程实例挂起与激活
// */
// @Test
// public void testProcessInstance() {
// // 创建 ProcessEngine 对象
// ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// RuntimeService runtimeService = processEngine.getRuntimeService();
// // 获取流程定义对象
// List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery()
// .processDefinitionKey("test")
// .list();
//
// // 遍历集合
// for (ProcessInstance processInstance : processInstanceList) {
// boolean suspended = processInstance.isSuspended();
// // 输出流程定义状态
// System.out.println("流程实例状态:" + processInstance + "," + (suspended ? "已挂起" : "已激活"));
// String processDefinitionId = processInstance.getId();
//
// if (suspended) {
// runtimeService.activateProcessInstanceById(processDefinitionId);
// System.out.println("流程实例id" + processDefinitionId + "已激活");
// } else {
// runtimeService.suspendProcessInstanceById(processDefinitionId);
// System.out.println("流程实例id" + processDefinitionId + "已挂起");
// }
// }
// }
//
//}
import org.activiti.engine.*;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Comment;
import org.activiti.engine.task.Task;
import org.junit.Test;
import org.springframework.util.FileCopyUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class test {
/**
*
*/
@Test
public void testInitOne() {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
System.err.println("processEngine = " + processEngine);
}
/**
*
*/
@Test
public void testInitTwo() {
ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
ProcessEngine processEngine = configuration.buildProcessEngine();
System.err.println("processEngine = " + processEngine);
}
/**
*
*/
@Test
public void testDeploy() {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取 repositoryService 对象
RepositoryService repositoryService = processEngine.getRepositoryService();
// 进行部署
Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("processes/test.bpmn20.xml")
.addClasspathResource("processes/test.png")
.name("实验流程1")
.deploy();
// 输出部署的一些信息
System.out.println("流程部署ID" + deployment.getId());
System.out.println("流程部署名称:" + deployment.getName());
}
/**
*
*/
@Test
public void testStartProcess() {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取 runtimeService 对象
RuntimeService runtimeService = processEngine.getRuntimeService();
Map<String, Object> variables = new HashMap<>();
//inputUser就是在bpmn中Assignee配置的参数
variables.put("name", "wwz");
// 根据流程定义的key启动流程实例这个key是在定义bpmn的时候设置的
ProcessInstance instance = runtimeService.startProcessInstanceByKey("test", variables);
// 获取流程实例的相关信息
System.out.println("流程定义的id = " + instance.getProcessDefinitionId());
System.out.println("流程实例的id = " + instance.getId());
}
/**
*
*/
@Test
public void testSelectTodoTaskList() {
String assignee = "李四";
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取指定用户审核任务
TaskService taskService = processEngine.getTaskService();
// 使用面对对象方式查询数据库
List<Task> tasks = taskService.createTaskQuery()
.processDefinitionKey("test")
.taskAssignee(assignee)
// 返回多个结果
.list();
// 只返回一个结果
// .singleResult();
// 自定义 sql 查询
// taskService.createNativeTaskQuery();
// 获取流程实例的相关信息
for (Task task : tasks) {
System.out.println("流程定义的id = " + task.getProcessDefinitionId());
System.out.println("流程实例的id = " + task.getProcessInstanceId());
System.out.println("任务id = " + task.getId());
System.out.println("任务名称 = " + task.getName());
}
}
/**
*
*/
@Test
public void testCompleteTask() {
String assignee = "admin";
Map<String, Object> variables = new HashMap<>();
//inputUser就是在bpmn中Assignee配置的参数
variables.put("name2", "admin");
variables.put("day", 5);
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取指定用户审核任务
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery()
.processDefinitionKey("test")
.taskAssignee(assignee)
.list();
if (tasks != null && !tasks.isEmpty()) {
// 当前流程图所限制,只能做审核同意的动作
for (Task task : tasks) {
String id = task.getId();
System.out.println("taskId = " + id);
taskService.complete(id, variables);
}
}
}
/**
*
*/
@Test
public void testAddComment() {
String assignee = "张三";
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取指定用户审核任务
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery()
.processDefinitionKey("test")
.taskAssignee(assignee)
.list();
if (tasks != null && !tasks.isEmpty()) {
// 当前流程图所限制,只能做审核同意的动作
for (Task task : tasks) {
// 添加备注
taskService.addComment(task.getId(), task.getProcessInstanceId(), assignee + "表示同意");
taskService.complete(task.getId());
}
}
}
/**
*
*/
@Test
public void testSelectHistoryTask() {
String processInstanceId = "2501";
String assignee = "李四";
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 查看历史信息
HistoryService historyService = processEngine.getHistoryService();
// 获取指定用户审核任务
TaskService taskService = processEngine.getTaskService();
// 获取历史审核信息
List<HistoricActivityInstance> userTask = historyService.createHistoricActivityInstanceQuery()
.activityType("userTask")
// 指定实例的id
.processInstanceId(processInstanceId)
.taskAssignee(assignee)
.finished()
.list();
for (HistoricActivityInstance instance : userTask) {
System.out.println("任务名称 = " + instance.getActivityName());
System.out.println("任务开始时间 = " + instance.getStartTime());
System.out.println("任务结束时间 = " + instance.getEndTime());
System.out.println("任务耗时 = " + instance.getDurationInMillis());
// 获取审批批注信息
List<Comment> taskComments = taskService.getTaskComments(instance.getTaskId());
if (!taskComments.isEmpty()) {
System.out.println("审批批注 = " + taskComments.get(0).getFullMessage());
}
}
}
/**
*
*/
@Test
public void testDefinitionQuery() {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取仓库服务
RepositoryService repositoryService = processEngine.getRepositoryService();
// 获取流程定义集合
List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey("test")
// 最新的一个版本
.latestVersion()
.list();
// 遍历集合
for (ProcessDefinition definition : processDefinitionList) {
System.out.println("流程定义id = " + definition.getId());
System.out.println("流程定义名称 = " + definition.getName());
System.out.println("流程定义key = " + definition.getKey());
System.out.println("流程定义版本 = " + definition.getVersion());
System.out.println("流程部署id = " + definition.getDeploymentId());
System.out.println("===============");
}
}
/**
*
*/
@Test
public void testDownloadResource() throws IOException {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取仓库服务
RepositoryService repositoryService = processEngine.getRepositoryService();
// 获取流程定义集合
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey("test")
// 按照版本降序
.orderByProcessDefinitionVersion()
// 降序
.desc()
.list();
// 获取最新那个
ProcessDefinition definition = list.get(0);
// 获取部署id
String deploymentId = definition.getDeploymentId();
// 获取bpmn的输入流
InputStream bpmnInputStream = repositoryService.getResourceAsStream(deploymentId, definition.getResourceName());
// 获取png的输入流
// InputStream pngInputStream = repositoryService.getResourceAsStream(deploymentId, definition.getDiagramResourceName());
String resourcePath = "C:/Users/ASUS/Desktop/" + File.separator + definition.getResourceName();
File file = new File(resourcePath);
if (!file.exists()) {
file.getParentFile().mkdirs();
}
String diagramResourcePath = "C:/Users/ASUS/Desktop/" + File.separator + definition.getDiagramResourceName();
file = new File(diagramResourcePath);
if (!file.exists()) {
file.getParentFile().mkdirs();
}
//复制文件
FileCopyUtils.copy(bpmnInputStream, Files.newOutputStream(Paths.get(resourcePath)));
// FileCopyUtils.copy(pngInputStream, Files.newOutputStream(Paths.get(diagramResourcePath)));
}
/**
*
*/
@Test
public void testDeleteDeploy() {
// 删除已经部署的流程定义
String deploymentId = "45001";
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取仓库服务
RepositoryService repositoryService = processEngine.getRepositoryService();
// 删除流程定义,如果改流程定义已有流程实例启动,则会报错
// repositoryService.deleteDeployment(deploymentId);
// 设置 true级联删除流程定义即使有启动的实例也可以删除
repositoryService.deleteDeployment(deploymentId, true);
}
/**
* BusinessKey
*/
@Test
public void testStartBindBusinessKey() {
String businessKey = "1";
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
// 根据流程定义的key启动流程实例这个key是在定义bpmn的时候设置的
// 在启动流程的时候将业务key加进去
ProcessInstance instance = runtimeService.startProcessInstanceByKey("test", businessKey);
// 获取流程实例的相关信息
System.out.println("流程定义id = " + instance.getProcessDefinitionId());
System.out.println("流程实例id = " + instance.getId());
System.out.println("业务标识 = " + instance.getBusinessKey());
}
/**
* BusinessKey
*/
@Test
public void testGetBusinessKey() {
// 1、获取李四的待办信息
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
TaskService taskService = processEngine.getTaskService();
List<Task> task = taskService.createTaskQuery()
.taskAssignee("李四")
.processDefinitionKey("test")
.list();
// 2、获取 businessKey
// 获取流程实例id
String processInstanceId = task.get(1).getProcessInstanceId();
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
String businessKey = processInstance.getBusinessKey();
System.out.println("业务标识 = " + businessKey);
}
/**
*
*/
@Test
public void testSuspendAllProcessInstance() {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
// 获取仓库服务
RepositoryService repositoryService = processEngine.getRepositoryService();
// 获取流程定义对象
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey("test")
.singleResult();
boolean suspended = processDefinition.isSuspended();
// 输出流程定义状态
System.out.println("流程定义状态:" + (suspended ? "已挂起" : "已激活"));
String processDefinitionId = processDefinition.getId();
if (suspended) {
repositoryService.activateProcessDefinitionById(processDefinitionId, true, null);
System.out.println("流程id" + processDefinitionId + "已激活");
} else {
repositoryService.suspendProcessDefinitionById(processDefinitionId, true, null);
System.out.println("流程id" + processDefinitionId + "已挂起");
}
}
/**
*
*/
@Test
public void testProcessInstance() {
// 创建 ProcessEngine 对象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
// 获取流程定义对象
List<ProcessInstance> processInstanceList = runtimeService.createProcessInstanceQuery()
.processDefinitionKey("test")
.list();
// 遍历集合
for (ProcessInstance processInstance : processInstanceList) {
boolean suspended = processInstance.isSuspended();
// 输出流程定义状态
System.out.println("流程实例状态:" + processInstance + "," + (suspended ? "已挂起" : "已激活"));
String processDefinitionId = processInstance.getId();
if (suspended) {
runtimeService.activateProcessInstanceById(processDefinitionId);
System.out.println("流程实例id" + processDefinitionId + "已激活");
} else {
runtimeService.suspendProcessInstanceById(processDefinitionId);
System.out.println("流程实例id" + processDefinitionId + "已挂起");
}
}
}
}

@ -20,5 +20,10 @@
<groupId>com.haiwei</groupId>
<artifactId>haiwei-framework</artifactId>
</dependency>
<dependency>
<groupId>com.haiwei</groupId>
<artifactId>haiwei-activiti</artifactId>
</dependency>
</dependencies>
</project>

@ -10,13 +10,15 @@ import com.haiwei.manage.domain.BaseCustomer;
import com.haiwei.manage.service.IBaseCustomerService;
import com.haiwei.common.core.text.Convert;
import javax.naming.Name;
/**
* Service
*
* @author wangh
* @date 2023-08-15
*/
@Service
@Service("baseCustomerServiceImpl")
public class BaseCustomerServiceImpl implements IBaseCustomerService
{
@Autowired

Loading…
Cancel
Save