任务审核流程.bpmn 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.22.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  3. <bpmn2:process id="ProcessOutcomeApprove" name="任务审核流程" isExecutable="true" camunda:versionTag="1.0">
  4. <bpmn2:startEvent id="event_start">
  5. <bpmn2:extensionElements>
  6. <camunda:properties>
  7. <camunda:property name="test" value="test111" />
  8. </camunda:properties>
  9. </bpmn2:extensionElements>
  10. <bpmn2:outgoing>Flow_15zn1tu</bpmn2:outgoing>
  11. </bpmn2:startEvent>
  12. <bpmn2:userTask id="task_request_task" name="提交审核" camunda:formKey="select_approve_type" camunda:assignee="owner">
  13. <bpmn2:extensionElements>
  14. <camunda:inputOutput>
  15. <camunda:inputParameter name="show_in_my_works">${false}</camunda:inputParameter>
  16. <camunda:inputParameter name="process_type">${1}</camunda:inputParameter>
  17. <camunda:inputParameter name="target_type">project-plan</camunda:inputParameter>
  18. <camunda:inputParameter name="draft">${true}</camunda:inputParameter>
  19. <camunda:inputParameter name="task_id">${environment.variables.task_id}</camunda:inputParameter>
  20. </camunda:inputOutput>
  21. <camunda:executionListener event="end">
  22. <camunda:script scriptFormat="JavaScript">
  23. (async function () {
  24. // 提交审核
  25. try {
  26. let owner = await this.environment.services.owner(); // 获取任务责任人
  27. if (!owner) {
  28. await this.environment.services.gen_warn_task('admin', '提交任务审核时未找到负责人',
  29. `提交任务审核时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
  30. }
  31. // 获取任务审核人列表       
  32. let checkers = await this.environment.services.get_handlers('task_checker');
  33. if (!checkers || checkers.length === 0) return;
  34. let checkers_str = "";
  35. for (var i = 0; i &lt; checkers.length; i++) {
  36. checkers_str += `&lt;b&gt;${checkers[i].name}&lt;/b&gt; 进行${checkers[i].action};&lt;br&gt;`;
  37. }
  38. let check_type = this.environment.variables.check_type;
  39. let check_type_str = check_type === 2 ? "并行审核": "顺序审核";
  40. await this.environment.services.gen_remind_task(owner.id, `任务“${this.environment.variables.task_name}”的审核申请已提交`, `&lt;b&gt;${owner.name}&lt;/b&gt;已于 &lt;b&gt;` +
  41. this.environment.services.get_datetime() + `&lt;/b&gt; 提交了任务&lt;b&gt;“${this.environment.variables.task_name}”&lt;/b&gt;的审核申请,将由: &lt;br&gt; ${checkers_str}审核方式为:${check_type_str}`);
  42. await this.environment.services.logger(owner.id, owner.name, `提交了任务&lt;b&gt;“${this.environment.variables.task_name}”&lt;/b&gt;的审核申请,将由: &lt;br&gt; ${checkers_str}审核方式为:${check_type_str}`);
  43. } catch (e) {
  44. this.environment.Logger('work').error(e);
  45. }
  46. })();
  47. </camunda:script>
  48. </camunda:executionListener>
  49. <camunda:taskListener class="" event="assignment" />
  50. </bpmn2:extensionElements>
  51. <bpmn2:incoming>Flow_1t45qnv</bpmn2:incoming>
  52. <bpmn2:incoming>Flow_0gyvyyo</bpmn2:incoming>
  53. <bpmn2:incoming>Flow_1gc46ur</bpmn2:incoming>
  54. <bpmn2:outgoing>Flow_1rg4oob</bpmn2:outgoing>
  55. <bpmn2:outgoing>Flow_0bhibn0</bpmn2:outgoing>
  56. </bpmn2:userTask>
  57. <bpmn2:sequenceFlow id="Flow_15zn1tu" sourceRef="event_start" targetRef="task_do_task" />
  58. <bpmn2:sequenceFlow id="Flow_1rg4oob" sourceRef="task_request_task" targetRef="Gateway_1whgd2i">
  59. <bpmn2:documentation>状态变为审核中(50)</bpmn2:documentation>
  60. <bpmn2:extensionElements>
  61. <camunda:properties>
  62. <camunda:property name="task_status" value="50" />
  63. <camunda:property name="task_status_name" value="任务审核中" />
  64. </camunda:properties>
  65. </bpmn2:extensionElements>
  66. </bpmn2:sequenceFlow>
  67. <bpmn2:userTask id="task_approve_task_sync" name="审核任务成果" camunda:formKey="task_approve" camunda:assignee="task_checker">
  68. <bpmn2:documentation>状态变为审核中(50)</bpmn2:documentation>
  69. <bpmn2:extensionElements>
  70. <camunda:inputOutput>
  71. <camunda:inputParameter name="show_in_my_works">${true}</camunda:inputParameter>
  72. <camunda:inputParameter name="process_type">${1}</camunda:inputParameter>
  73. <camunda:inputParameter name="target_type"> project-plan</camunda:inputParameter>
  74. <camunda:inputParameter name="prj_id">${environment.variables.prj_id}</camunda:inputParameter>
  75. <camunda:inputParameter name="draft">${false}</camunda:inputParameter>
  76. <camunda:inputParameter name="task_id">${environment.variables.task_id}</camunda:inputParameter>
  77. </camunda:inputOutput>
  78. <camunda:executionListener event="end">
  79. <camunda:script scriptFormat="JavaScript">
  80. (async function () {
  81. try {
  82. // 并行审核任务,多人同时执行
  83. let owner = await this.environment.services.owner(); // 获取任务责任人
  84. if (!owner) {
  85. await this.environment.services.gen_warn_task('admin', '任务审核时未找到负责人',
  86. `任务审核时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
  87. }
  88. this.environment.Logger('work').debug(this.content);
  89. let checker = this.content.handlers[this.content.index]; // 获取当前审核人,这个是并行审核任务,有多个审核人并行审核
  90. let result = this.content.output[this.content.index]; // 来自于审核人表单结果
  91. if (result.pass) { // 如果审核通过
  92. // 生成阅读任务
  93. await this.environment.services.gen_remind_task(owner.id, `${checker.name}:任务“${this.environment.variables.task_name}”的${checker.action}已通过`,
  94. `&lt;b&gt;${checker.name}&lt;/b&gt;已于 &lt;b&gt;${this.environment.services.get_datetime()}&lt;/b&gt; 对任务“${this.environment.variables.task_name}”的交付物进行了${checker.action}并&lt;span style="color: rgb(20, 201, 201);"&gt;通过。&lt;/span&gt;`);
  95. // 生成任务动态
  96. await this.environment.services.logger(checker.id, checker.name, `任务“${this.environment.variables.task_name}”的${checker.action}&lt;span style="color: rgb(20, 201, 201);"&gt;已通过&lt;/span&gt;`);
  97. // 归档审核文件
  98. if (result.opinion) {
  99. await this.environment.services.place_on_files(result.opinion, `${checker.action}意见(通过)`);
  100. }
  101. if (result.annotated_draft) {
  102. await this.environment.services.place_on_files(result.annotated_draft, `${checker.action}批注稿(通过)`);
  103. }
  104. } else {
  105. // 生成阅读任务
  106. await this.environment.services.gen_remind_task(owner.id, `${checker.name}任务“${this.environment.variables.task_name}”的${checker.action}已驳回`,
  107. `&lt;b&gt;${checker.name}&lt;/b&gt;已于 &lt;b&gt;${this.environment.services.get_datetime()}&lt;/b&gt; 对任务“${this.environment.variables.task_name}”的交付物进行了${checker.action}并&lt;span style="color: red;"&gt;驳回。&lt;/span&gt;`);
  108. // 生成任务动态
  109. await this.environment.services.logger(checker.id, checker.name, `任务“${this.environment.variables.task_name}”在${checker.action}时&lt;span style="color: red;"&gt;被驳回&lt;/span&gt;`);
  110. // 归档审核文件
  111. if (result.opinion) {
  112. await this.environment.services.place_on_files(result.opinion, `${checker.action}意见(驳回)`);
  113. }
  114. if (result.annotated_draft) {
  115. await this.environment.services.place_on_files(result.annotated_draft, `${checker.action}批注稿(驳回)`);
  116. }
  117. }
  118. } catch (e) {
  119. this.environment.Logger('work').error(e);
  120. }
  121. })();
  122. </camunda:script>
  123. </camunda:executionListener>
  124. </bpmn2:extensionElements>
  125. <bpmn2:incoming>Flow_0iv9g3p</bpmn2:incoming>
  126. <bpmn2:outgoing>Flow_1su3b3p</bpmn2:outgoing>
  127. <bpmn2:multiInstanceLoopCharacteristics camunda:collection="${content.handlers}" camunda:elementVariable="handler">
  128. <bpmn2:loopCardinality xsi:type="bpmn2:tFormalExpression">${content.handlers.length}</bpmn2:loopCardinality>
  129. </bpmn2:multiInstanceLoopCharacteristics>
  130. </bpmn2:userTask>
  131. <bpmn2:userTask id="task_approve_task_async" name="审核任务成果" camunda:formKey="task_approve" camunda:assignee="task_checker">
  132. <bpmn2:documentation>状态变为审核中(50)</bpmn2:documentation>
  133. <bpmn2:extensionElements>
  134. <camunda:inputOutput>
  135. <camunda:inputParameter name="show_in_my_works">${true}</camunda:inputParameter>
  136. <camunda:inputParameter name="process_type">${1}</camunda:inputParameter>
  137. <camunda:inputParameter name="target_type"> project-plan</camunda:inputParameter>
  138. <camunda:inputParameter name="prj_id">${environment.variables.prj_id}</camunda:inputParameter>
  139. <camunda:inputParameter name="draft">${false}</camunda:inputParameter>
  140. <camunda:inputParameter name="task_id">${environment.variables.task_id}</camunda:inputParameter>
  141. </camunda:inputOutput>
  142. <camunda:executionListener event="end">
  143. <camunda:script scriptFormat="JavaScript">
  144. (async function () {
  145. try {
  146. // 串行审核任务,多人按顺序执行审核
  147. let owner = await this.environment.services.owner(); // 获取任务责任人
  148. if (!owner) {
  149. await this.environment.services.gen_warn_task('admin', '任务审核时未找到负责人',
  150. `任务审核时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
  151. }
  152. this.environment.Logger('work').debug(this.content);
  153. let checker = this.content.handlers[this.content.index]; // 获取当前审核人,这个是并行审核任务,有多个审核人并行审核
  154. let result = this.content.output[this.content.index]; // 来自于审核人表单结果
  155. if (result.pass) { // 如果审核通过
  156. // 生成阅读任务
  157. await this.environment.services.gen_remind_task(owner.id, `${checker.name}:任务“${this.environment.variables.task_name}”的${checker.action}已通过`,
  158. `&lt;b&gt;${checker.name}&lt;/b&gt;已于 &lt;b&gt;${this.environment.services.get_datetime()}&lt;/b&gt; 对任务“${this.environment.variables.task_name}”的交付物进行了${checker.action}并&lt;span style="color: rgb(20, 201, 201);"&gt;通过。&lt;/span&gt;。`);
  159. // 生成任务动态
  160. await this.environment.services.logger(checker.id, checker.name, `任务“${this.environment.variables.task_name}”的${checker.action}&lt;span style="color: rgb(20, 201, 201);"&gt;已通过&lt;/span&gt;`);
  161. // 归档审核文件
  162. if (result.opinion) {
  163. await this.environment.services.place_on_files(result.opinion, `${checker.action}意见(通过)`);
  164. }
  165. if (result.annotated_draft) {
  166. await this.environment.services.place_on_files(result.annotated_draft, `${checker.action}批注稿(通过)`);
  167. }
  168. } else {
  169. // 生成阅读任务
  170. await this.environment.services.gen_remind_task(owner.id, `${checker.name}:任务“${this.environment.variables.task_name}”的${checker.action}已驳回`,
  171. `&lt;b&gt;${checker.name}&lt;/b&gt;已于 &lt;b&gt;${this.environment.services.get_datetime()}&lt;/b&gt; 对任务“${this.environment.variables.task_name}”的交付物进行了${checker.action}并&lt;span style="color: red;"&gt;驳回。&lt;/span&gt;。`);
  172. // 生成任务动态
  173. await this.environment.services.logger(checker.id, checker.name, `任务“${this.environment.variables.task_name}”在${checker.action}时&lt;span style="color: red;"&gt;被驳回&lt;/span&gt;`);
  174. // 归档审核文件
  175. if (result.opinion) {
  176. await this.environment.services.place_on_files(result.opinion, `${checker.action}意见(驳回)`);
  177. }
  178. if (result.annotated_draft) {
  179. await this.environment.services.place_on_files(result.annotated_draft, `${checker.action}批注稿(驳回)`);
  180. }
  181. }
  182. } catch (e) {
  183. this.environment.Logger('work').error(e);
  184. }
  185. })();
  186. </camunda:script>
  187. </camunda:executionListener>
  188. </bpmn2:extensionElements>
  189. <bpmn2:incoming>Flow_02nannf</bpmn2:incoming>
  190. <bpmn2:outgoing>Flow_193tusd</bpmn2:outgoing>
  191. <bpmn2:multiInstanceLoopCharacteristics isSequential="true" camunda:collection="${content.handlers}" camunda:elementVariable="handler">
  192. <bpmn2:loopCardinality xsi:type="bpmn2:tFormalExpression">${content.handlers.length}</bpmn2:loopCardinality>
  193. <bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression">${!content.output.pass}</bpmn2:completionCondition>
  194. </bpmn2:multiInstanceLoopCharacteristics>
  195. </bpmn2:userTask>
  196. <bpmn2:exclusiveGateway id="gateway_approved" default="Flow_0nwaga3">
  197. <bpmn2:incoming>Flow_193tusd</bpmn2:incoming>
  198. <bpmn2:incoming>Flow_1rcwh5r</bpmn2:incoming>
  199. <bpmn2:outgoing>Flow_0zubkyw</bpmn2:outgoing>
  200. <bpmn2:outgoing>Flow_0nwaga3</bpmn2:outgoing>
  201. </bpmn2:exclusiveGateway>
  202. <bpmn2:sequenceFlow id="Flow_193tusd" sourceRef="task_approve_task_async" targetRef="gateway_approved" />
  203. <bpmn2:sequenceFlow id="Flow_0zubkyw" name="通过" sourceRef="gateway_approved" targetRef="event_throw_approved">
  204. <bpmn2:extensionElements>
  205. <camunda:properties>
  206. <camunda:property name="task_status" value="100" />
  207. <camunda:property name="task_status_name" value="任务审核通过" />
  208. </camunda:properties>
  209. </bpmn2:extensionElements>
  210. <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="JavaScript">next(null, this.environment.variables.pass===true);</bpmn2:conditionExpression>
  211. </bpmn2:sequenceFlow>
  212. <bpmn2:sequenceFlow id="Flow_0nwaga3" name="驳回" sourceRef="gateway_approved" targetRef="event_throw_approved_back">
  213. <bpmn2:documentation>审核不通过(30)</bpmn2:documentation>
  214. <bpmn2:extensionElements>
  215. <camunda:properties>
  216. <camunda:property name="task_status" value="30" />
  217. <camunda:property name="task_status_name" value="任务审核未通过" />
  218. </camunda:properties>
  219. </bpmn2:extensionElements>
  220. </bpmn2:sequenceFlow>
  221. <bpmn2:sequenceFlow id="Flow_0bhibn0" sourceRef="task_request_task" targetRef="task_with_draw_task" />
  222. <bpmn2:userTask id="task_with_draw_task" name="撤回申请" camunda:assignee="owner">
  223. <bpmn2:extensionElements>
  224. <camunda:inputOutput>
  225. <camunda:inputParameter name="process_type">${1}</camunda:inputParameter>
  226. </camunda:inputOutput>
  227. <camunda:executionListener event="end">
  228. <camunda:script scriptFormat="JavaScript">
  229. (async function() {
  230. try{
  231. let owner = await this.environment.services.owner(); // 获取任务责任人
  232. if (!owner) {
  233. await this.environment.services.gen_warn_task('admin', '任务审核申请被撤回时未找到负责人',
  234. `任务审核申请被撤回时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
  235. }
  236. await this.environment.services.gen_remind_task(owner.id, `任务“${this.environment.variables.task_name}”的审核申请已被撤回`,
  237. `${owner.name}已于 ${this.environment.services.get_datetime()} &lt;span style="color: rgb(22,93,255);"&gt;撤回&lt;/span&gt;了任务&lt;b&gt;“${this.environment.variables.task_name}”&lt;/b&gt;的审核申请。`);
  238. await this.environment.services.logger(owner.id, owner.name, `撤回了任务&lt;b&gt;“${this.environment.variables.task_name}”&lt;/b&gt;的审核申请。`);
  239. } catch(e){
  240. this.environment.Logger('work').error(e);
  241. }
  242. })();
  243. </camunda:script>
  244. </camunda:executionListener>
  245. </bpmn2:extensionElements>
  246. <bpmn2:incoming>Flow_0bhibn0</bpmn2:incoming>
  247. <bpmn2:outgoing>Flow_0tj9nd6</bpmn2:outgoing>
  248. </bpmn2:userTask>
  249. <bpmn2:sequenceFlow id="Flow_0tj9nd6" sourceRef="task_with_draw_task" targetRef="Event_throw_withdraw">
  250. <bpmn2:extensionElements>
  251. <camunda:properties>
  252. <camunda:property name="task_status" value="10" />
  253. </camunda:properties>
  254. </bpmn2:extensionElements>
  255. </bpmn2:sequenceFlow>
  256. <bpmn2:intermediateThrowEvent id="Event_throw_withdraw" name="撤回事件">
  257. <bpmn2:incoming>Flow_0tj9nd6</bpmn2:incoming>
  258. <bpmn2:signalEventDefinition id="SignalEventDefinition_1tt7p06" signalRef="Signal_0hhmd7l" />
  259. </bpmn2:intermediateThrowEvent>
  260. <bpmn2:sequenceFlow id="Flow_02taytj" sourceRef="event_throw_approved" targetRef="Activity_10ywpg4">
  261. <bpmn2:extensionElements />
  262. </bpmn2:sequenceFlow>
  263. <bpmn2:intermediateThrowEvent id="event_throw_approved" name="已审核事件">
  264. <bpmn2:incoming>Flow_0zubkyw</bpmn2:incoming>
  265. <bpmn2:outgoing>Flow_02taytj</bpmn2:outgoing>
  266. <bpmn2:signalEventDefinition id="SignalEventDefinition_07jfo4t" signalRef="Signal_0828f9d" />
  267. </bpmn2:intermediateThrowEvent>
  268. <bpmn2:sequenceFlow id="Flow_1ucg773" sourceRef="event_catch_approved" targetRef="Event_end" />
  269. <bpmn2:boundaryEvent id="event_catch_approved" name="已审核" attachedToRef="task_with_draw_task">
  270. <bpmn2:outgoing>Flow_1ucg773</bpmn2:outgoing>
  271. <bpmn2:signalEventDefinition id="SignalEventDefinition_02ri5rf" signalRef="Signal_0828f9d" />
  272. </bpmn2:boundaryEvent>
  273. <bpmn2:intermediateThrowEvent id="event_throw_approved_back" name="已审核事件">
  274. <bpmn2:incoming>Flow_0nwaga3</bpmn2:incoming>
  275. <bpmn2:outgoing>Flow_06cxzjx</bpmn2:outgoing>
  276. <bpmn2:signalEventDefinition id="SignalEventDefinition_0y27jk5" signalRef="Signal_0828f9d" />
  277. </bpmn2:intermediateThrowEvent>
  278. <bpmn2:sequenceFlow id="Flow_1t45qnv" sourceRef="task_modify_task1" targetRef="task_request_task" />
  279. <bpmn2:sequenceFlow id="Flow_0nzbvpg" sourceRef="Event_catch_withdraw" targetRef="task_modify_task1">
  280. <bpmn2:extensionElements />
  281. </bpmn2:sequenceFlow>
  282. <bpmn2:sequenceFlow id="Flow_06cxzjx" sourceRef="event_throw_approved_back" targetRef="Activity_0cir5fq" />
  283. <bpmn2:manualTask id="task_do_task" name="实施任务工作">
  284. <bpmn2:incoming>Flow_15zn1tu</bpmn2:incoming>
  285. <bpmn2:outgoing>Flow_0gyvyyo</bpmn2:outgoing>
  286. </bpmn2:manualTask>
  287. <bpmn2:sequenceFlow id="Flow_0gyvyyo" sourceRef="task_do_task" targetRef="task_request_task">
  288. <bpmn2:extensionElements />
  289. </bpmn2:sequenceFlow>
  290. <bpmn2:manualTask id="task_modify_task1" name="修改交付物">
  291. <bpmn2:incoming>Flow_0nzbvpg</bpmn2:incoming>
  292. <bpmn2:incoming>Flow_1eauhgu</bpmn2:incoming>
  293. <bpmn2:outgoing>Flow_1t45qnv</bpmn2:outgoing>
  294. </bpmn2:manualTask>
  295. <bpmn2:endEvent id="Event_end">
  296. <bpmn2:incoming>Flow_1ucg773</bpmn2:incoming>
  297. <bpmn2:incoming>Flow_1xp7bfo</bpmn2:incoming>
  298. </bpmn2:endEvent>
  299. <bpmn2:boundaryEvent id="Event_catch_withdraw" name="撤回" attachedToRef="task_approve_task_async">
  300. <bpmn2:outgoing>Flow_0nzbvpg</bpmn2:outgoing>
  301. <bpmn2:signalEventDefinition id="SignalEventDefinition_111s194" signalRef="Signal_0hhmd7l" />
  302. </bpmn2:boundaryEvent>
  303. <bpmn2:exclusiveGateway id="Gateway_1whgd2i" default="Flow_02nannf">
  304. <bpmn2:incoming>Flow_1rg4oob</bpmn2:incoming>
  305. <bpmn2:outgoing>Flow_02nannf</bpmn2:outgoing>
  306. <bpmn2:outgoing>Flow_0iv9g3p</bpmn2:outgoing>
  307. </bpmn2:exclusiveGateway>
  308. <bpmn2:sequenceFlow id="Flow_02nannf" sourceRef="Gateway_1whgd2i" targetRef="task_approve_task_async" />
  309. <bpmn2:sequenceFlow id="Flow_0iv9g3p" sourceRef="Gateway_1whgd2i" targetRef="task_approve_task_sync">
  310. <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="JavaScript">next(null, this.environment.variables.check_type===2);</bpmn2:conditionExpression>
  311. </bpmn2:sequenceFlow>
  312. <bpmn2:sequenceFlow id="Flow_1su3b3p" sourceRef="task_approve_task_sync" targetRef="Activity_0gfds7w" />
  313. <bpmn2:sequenceFlow id="Flow_0b7s3zy" sourceRef="Event_1gpzq6w" targetRef="task_modify_task2" />
  314. <bpmn2:boundaryEvent id="Event_1gpzq6w" name="撤回" attachedToRef="task_approve_task_sync">
  315. <bpmn2:outgoing>Flow_0b7s3zy</bpmn2:outgoing>
  316. <bpmn2:signalEventDefinition id="SignalEventDefinition_0z0tno6" signalRef="Signal_0hhmd7l" />
  317. </bpmn2:boundaryEvent>
  318. <bpmn2:sequenceFlow id="Flow_1gc46ur" sourceRef="task_modify_task2" targetRef="task_request_task" />
  319. <bpmn2:manualTask id="task_modify_task2" name="修改交付物">
  320. <bpmn2:incoming>Flow_0b7s3zy</bpmn2:incoming>
  321. <bpmn2:outgoing>Flow_1gc46ur</bpmn2:outgoing>
  322. </bpmn2:manualTask>
  323. <bpmn2:sequenceFlow id="Flow_1rcwh5r" sourceRef="Activity_0gfds7w" targetRef="gateway_approved" />
  324. <bpmn2:scriptTask id="Activity_0gfds7w" name="计算审核结果" scriptFormat="JavaScript">
  325. <bpmn2:incoming>Flow_1su3b3p</bpmn2:incoming>
  326. <bpmn2:outgoing>Flow_1rcwh5r</bpmn2:outgoing>
  327. <bpmn2:script>
  328. try {
  329. // 只要有一个未通过,就算未通过审核
  330. var passed = true;
  331. let a = this.environment.services.get_value('a');
  332. for (var i = 0; i &lt; this.environment.output.task_approve_task_sync.length; i++) {
  333. var value = this.environment.output.task_approve_task_sync[i];
  334. if (value &amp;&amp; !value.pass) {
  335. passed = false;
  336. break;
  337. }
  338. }
  339. this.environment.variables.pass = passed;
  340. } catch (e) {
  341. this.environment.variables.pass = false;
  342. } finally {
  343. next();
  344. }
  345. </bpmn2:script>
  346. </bpmn2:scriptTask>
  347. <bpmn2:sequenceFlow id="Flow_09c65ah" sourceRef="Activity_0cir5fq" targetRef="Activity_0c44yrz" />
  348. <bpmn2:scriptTask id="Activity_0cir5fq" name="归档交付物文件" scriptFormat="JavaScript">
  349. <bpmn2:incoming>Flow_06cxzjx</bpmn2:incoming>
  350. <bpmn2:outgoing>Flow_09c65ah</bpmn2:outgoing>
  351. <bpmn2:script>
  352. (async function () {
  353. try {
  354. await this.environment.services.place_on_outcome("内部审核驳回");
  355. } catch (e) {
  356. this.environment.Logger('work').error(e);
  357. } finally {
  358. next();
  359. }
  360. })();
  361. </bpmn2:script>
  362. </bpmn2:scriptTask>
  363. <bpmn2:sequenceFlow id="Flow_1xp7bfo" sourceRef="Activity_10ywpg4" targetRef="Event_end" />
  364. <bpmn2:scriptTask id="Activity_10ywpg4" name="归档交付物文件" scriptFormat="JavaScript">
  365. <bpmn2:incoming>Flow_02taytj</bpmn2:incoming>
  366. <bpmn2:outgoing>Flow_1xp7bfo</bpmn2:outgoing>
  367. <bpmn2:script>
  368. (async function () {
  369. try {
  370. await this.environment.services.place_on_outcome("内部审核通过", "outcome");
  371. } catch (e) {
  372. this.environment.Logger('work').error(e);
  373. } finally {
  374. next();
  375. }
  376. })();
  377. </bpmn2:script>
  378. </bpmn2:scriptTask>
  379. <bpmn2:sequenceFlow id="Flow_1eauhgu" sourceRef="Activity_0c44yrz" targetRef="task_modify_task1" />
  380. <bpmn2:scriptTask id="Activity_0c44yrz" name="提醒审核未通过" scriptFormat="JavaScript">
  381. <bpmn2:incoming>Flow_09c65ah</bpmn2:incoming>
  382. <bpmn2:outgoing>Flow_1eauhgu</bpmn2:outgoing>
  383. <bpmn2:script>
  384. (async function () {
  385. try {
  386. let owner = await this.environment.services.owner(); // 获取任务责任人
  387. if (!owner) {
  388. await this.environment.services.gen_warn_task('admin', '提交任务审核时未找到负责人',
  389. `提交任务审核时未找到负责人,流程出错。case id: ${this.environment.variables.id}`);
  390. }
  391. // 生成阅读任务
  392. await this.environment.services.gen_remind_task(owner.id, `任务“${this.environment.variables.task_name}”的交付物审核未通过。`,
  393. `任务“${this.environment.variables.task_name}”的交付物审核未通过,请修改后重新提交审核。`);
  394. // 生成任务动态
  395. await this.environment.services.logger(checker.id, checker.name, `任务“${this.environment.variables.task_name}”的交付物审核未通过。`);
  396. } catch (e) {
  397. this.environment.Logger('work').error(e);
  398. } finally {
  399. next();
  400. }
  401. })();
  402. </bpmn2:script>
  403. </bpmn2:scriptTask>
  404. <bpmn2:textAnnotation id="TextAnnotation_1vnw6c1">
  405. <bpmn2:text>所有人都审核通过才算通过</bpmn2:text>
  406. </bpmn2:textAnnotation>
  407. <bpmn2:association id="Association_0p6rlsh" associationDirection="None" sourceRef="Activity_0gfds7w" targetRef="TextAnnotation_1vnw6c1" />
  408. </bpmn2:process>
  409. <bpmn2:signal id="Signal_0hhmd7l" name="cancel_sign" />
  410. <bpmn2:message id="Message_0fh9t3e" name="msg_cancel" />
  411. <bpmn2:message id="Message_1qtzp8g" name="Message_0q7qbc4" />
  412. <bpmn2:signal id="Signal_0828f9d" name="Signal_2sf6vik" />
  413. <bpmndi:BPMNDiagram id="BPMNDiagram_1">
  414. <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ProcessOutcomeApprove">
  415. <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="event_start">
  416. <dc:Bounds x="152" y="262" width="36" height="36" />
  417. </bpmndi:BPMNShape>
  418. <bpmndi:BPMNShape id="Activity_09wmdbt_di" bpmnElement="task_request_task">
  419. <dc:Bounds x="380" y="240" width="100" height="80" />
  420. <bpmndi:BPMNLabel />
  421. </bpmndi:BPMNShape>
  422. <bpmndi:BPMNShape id="Activity_1wy7wpe_di" bpmnElement="task_approve_task_sync">
  423. <dc:Bounds x="630" y="170" width="100" height="80" />
  424. <bpmndi:BPMNLabel />
  425. </bpmndi:BPMNShape>
  426. <bpmndi:BPMNShape id="Activity_0ds6ym0_di" bpmnElement="task_approve_task_async">
  427. <dc:Bounds x="630" y="305" width="100" height="80" />
  428. <bpmndi:BPMNLabel />
  429. </bpmndi:BPMNShape>
  430. <bpmndi:BPMNShape id="Gateway_06baw71_di" bpmnElement="gateway_approved" isMarkerVisible="true">
  431. <dc:Bounds x="995" y="255" width="50" height="50" />
  432. </bpmndi:BPMNShape>
  433. <bpmndi:BPMNShape id="Activity_0fonc56_di" bpmnElement="task_with_draw_task">
  434. <dc:Bounds x="450" y="630" width="100" height="80" />
  435. <bpmndi:BPMNLabel />
  436. </bpmndi:BPMNShape>
  437. <bpmndi:BPMNShape id="Event_0mceau4_di" bpmnElement="Event_throw_withdraw">
  438. <dc:Bounds x="662" y="652" width="36" height="36" />
  439. <bpmndi:BPMNLabel>
  440. <dc:Bounds x="658" y="695" width="44" height="14" />
  441. </bpmndi:BPMNLabel>
  442. </bpmndi:BPMNShape>
  443. <bpmndi:BPMNShape id="Event_0tntlum_di" bpmnElement="event_throw_approved">
  444. <dc:Bounds x="1122" y="262" width="36" height="36" />
  445. <bpmndi:BPMNLabel>
  446. <dc:Bounds x="1113" y="305" width="55" height="14" />
  447. </bpmndi:BPMNLabel>
  448. </bpmndi:BPMNShape>
  449. <bpmndi:BPMNShape id="Event_1gjhb1n_di" bpmnElement="event_throw_approved_back">
  450. <dc:Bounds x="1002" y="382" width="36" height="36" />
  451. <bpmndi:BPMNLabel>
  452. <dc:Bounds x="1042" y="393" width="55" height="14" />
  453. </bpmndi:BPMNLabel>
  454. </bpmndi:BPMNShape>
  455. <bpmndi:BPMNShape id="Activity_0isolrc_di" bpmnElement="task_do_task">
  456. <dc:Bounds x="230" y="240" width="100" height="80" />
  457. <bpmndi:BPMNLabel />
  458. </bpmndi:BPMNShape>
  459. <bpmndi:BPMNShape id="Activity_1k7kq2t_di" bpmnElement="task_modify_task1">
  460. <dc:Bounds x="460" y="460" width="100" height="80" />
  461. <bpmndi:BPMNLabel />
  462. </bpmndi:BPMNShape>
  463. <bpmndi:BPMNShape id="Event_1jljt88_di" bpmnElement="Event_end">
  464. <dc:Bounds x="1352" y="262" width="36" height="36" />
  465. </bpmndi:BPMNShape>
  466. <bpmndi:BPMNShape id="Gateway_1whgd2i_di" bpmnElement="Gateway_1whgd2i" isMarkerVisible="true">
  467. <dc:Bounds x="525" y="255" width="50" height="50" />
  468. </bpmndi:BPMNShape>
  469. <bpmndi:BPMNShape id="Activity_09ebfre_di" bpmnElement="task_modify_task2">
  470. <dc:Bounds x="480" y="80" width="100" height="80" />
  471. </bpmndi:BPMNShape>
  472. <bpmndi:BPMNShape id="Activity_0ehtgyf_di" bpmnElement="Activity_0gfds7w">
  473. <dc:Bounds x="760" y="170" width="100" height="80" />
  474. <bpmndi:BPMNLabel />
  475. </bpmndi:BPMNShape>
  476. <bpmndi:BPMNShape id="Activity_1s88kbx_di" bpmnElement="Activity_0cir5fq">
  477. <dc:Bounds x="960" y="480" width="100" height="80" />
  478. <bpmndi:BPMNLabel />
  479. </bpmndi:BPMNShape>
  480. <bpmndi:BPMNShape id="Activity_0n7x8km_di" bpmnElement="Activity_10ywpg4">
  481. <dc:Bounds x="1190" y="240" width="100" height="80" />
  482. <bpmndi:BPMNLabel />
  483. </bpmndi:BPMNShape>
  484. <bpmndi:BPMNShape id="Activity_0apwby6_di" bpmnElement="Activity_0c44yrz">
  485. <dc:Bounds x="760" y="480" width="100" height="80" />
  486. <bpmndi:BPMNLabel />
  487. </bpmndi:BPMNShape>
  488. <bpmndi:BPMNShape id="TextAnnotation_1vnw6c1_di" bpmnElement="TextAnnotation_1vnw6c1">
  489. <dc:Bounds x="860" y="90" width="100" height="41" />
  490. <bpmndi:BPMNLabel />
  491. </bpmndi:BPMNShape>
  492. <bpmndi:BPMNShape id="Event_0x0on6p_di" bpmnElement="Event_1gpzq6w">
  493. <dc:Bounds x="682" y="152" width="36" height="36" />
  494. <bpmndi:BPMNLabel>
  495. <dc:Bounds x="719" y="153" width="22" height="14" />
  496. </bpmndi:BPMNLabel>
  497. </bpmndi:BPMNShape>
  498. <bpmndi:BPMNShape id="Event_0s1xb2l_di" bpmnElement="Event_catch_withdraw">
  499. <dc:Bounds x="692" y="367" width="36" height="36" />
  500. <bpmndi:BPMNLabel>
  501. <dc:Bounds x="719" y="403" width="22" height="14" />
  502. </bpmndi:BPMNLabel>
  503. </bpmndi:BPMNShape>
  504. <bpmndi:BPMNShape id="Event_06bs6js_di" bpmnElement="event_catch_approved">
  505. <dc:Bounds x="482" y="612" width="36" height="36" />
  506. <bpmndi:BPMNLabel>
  507. <dc:Bounds x="513" y="606" width="33" height="14" />
  508. </bpmndi:BPMNLabel>
  509. </bpmndi:BPMNShape>
  510. <bpmndi:BPMNEdge id="Flow_15zn1tu_di" bpmnElement="Flow_15zn1tu">
  511. <di:waypoint x="188" y="280" />
  512. <di:waypoint x="230" y="280" />
  513. </bpmndi:BPMNEdge>
  514. <bpmndi:BPMNEdge id="Flow_1rg4oob_di" bpmnElement="Flow_1rg4oob">
  515. <di:waypoint x="480" y="280" />
  516. <di:waypoint x="525" y="280" />
  517. </bpmndi:BPMNEdge>
  518. <bpmndi:BPMNEdge id="Flow_193tusd_di" bpmnElement="Flow_193tusd">
  519. <di:waypoint x="730" y="345" />
  520. <di:waypoint x="880" y="345" />
  521. <di:waypoint x="880" y="280" />
  522. <di:waypoint x="995" y="280" />
  523. </bpmndi:BPMNEdge>
  524. <bpmndi:BPMNEdge id="Flow_0zubkyw_di" bpmnElement="Flow_0zubkyw">
  525. <di:waypoint x="1045" y="280" />
  526. <di:waypoint x="1122" y="280" />
  527. <bpmndi:BPMNLabel>
  528. <dc:Bounds x="1073" y="262" width="22" height="14" />
  529. </bpmndi:BPMNLabel>
  530. </bpmndi:BPMNEdge>
  531. <bpmndi:BPMNEdge id="Flow_0nwaga3_di" bpmnElement="Flow_0nwaga3">
  532. <di:waypoint x="1020" y="305" />
  533. <di:waypoint x="1020" y="382" />
  534. <bpmndi:BPMNLabel>
  535. <dc:Bounds x="1024" y="323" width="22" height="14" />
  536. </bpmndi:BPMNLabel>
  537. </bpmndi:BPMNEdge>
  538. <bpmndi:BPMNEdge id="Flow_0bhibn0_di" bpmnElement="Flow_0bhibn0">
  539. <di:waypoint x="430" y="320" />
  540. <di:waypoint x="430" y="670" />
  541. <di:waypoint x="450" y="670" />
  542. </bpmndi:BPMNEdge>
  543. <bpmndi:BPMNEdge id="Flow_0tj9nd6_di" bpmnElement="Flow_0tj9nd6">
  544. <di:waypoint x="550" y="670" />
  545. <di:waypoint x="662" y="670" />
  546. </bpmndi:BPMNEdge>
  547. <bpmndi:BPMNEdge id="Flow_02taytj_di" bpmnElement="Flow_02taytj">
  548. <di:waypoint x="1158" y="280" />
  549. <di:waypoint x="1190" y="280" />
  550. </bpmndi:BPMNEdge>
  551. <bpmndi:BPMNEdge id="Flow_1ucg773_di" bpmnElement="Flow_1ucg773">
  552. <di:waypoint x="500" y="612" />
  553. <di:waypoint x="500" y="590" />
  554. <di:waypoint x="1370" y="590" />
  555. <di:waypoint x="1370" y="298" />
  556. </bpmndi:BPMNEdge>
  557. <bpmndi:BPMNEdge id="Flow_1t45qnv_di" bpmnElement="Flow_1t45qnv">
  558. <di:waypoint x="510" y="460" />
  559. <di:waypoint x="510" y="345" />
  560. <di:waypoint x="450" y="345" />
  561. <di:waypoint x="450" y="320" />
  562. </bpmndi:BPMNEdge>
  563. <bpmndi:BPMNEdge id="Flow_0nzbvpg_di" bpmnElement="Flow_0nzbvpg">
  564. <di:waypoint x="710" y="403" />
  565. <di:waypoint x="710" y="500" />
  566. <di:waypoint x="560" y="500" />
  567. </bpmndi:BPMNEdge>
  568. <bpmndi:BPMNEdge id="Flow_06cxzjx_di" bpmnElement="Flow_06cxzjx">
  569. <di:waypoint x="1020" y="418" />
  570. <di:waypoint x="1020" y="480" />
  571. </bpmndi:BPMNEdge>
  572. <bpmndi:BPMNEdge id="Flow_0gyvyyo_di" bpmnElement="Flow_0gyvyyo">
  573. <di:waypoint x="330" y="280" />
  574. <di:waypoint x="380" y="280" />
  575. </bpmndi:BPMNEdge>
  576. <bpmndi:BPMNEdge id="Flow_02nannf_di" bpmnElement="Flow_02nannf">
  577. <di:waypoint x="550" y="305" />
  578. <di:waypoint x="550" y="345" />
  579. <di:waypoint x="630" y="345" />
  580. </bpmndi:BPMNEdge>
  581. <bpmndi:BPMNEdge id="Flow_0iv9g3p_di" bpmnElement="Flow_0iv9g3p">
  582. <di:waypoint x="550" y="255" />
  583. <di:waypoint x="550" y="210" />
  584. <di:waypoint x="630" y="210" />
  585. </bpmndi:BPMNEdge>
  586. <bpmndi:BPMNEdge id="Flow_1su3b3p_di" bpmnElement="Flow_1su3b3p">
  587. <di:waypoint x="730" y="210" />
  588. <di:waypoint x="760" y="210" />
  589. </bpmndi:BPMNEdge>
  590. <bpmndi:BPMNEdge id="Flow_0b7s3zy_di" bpmnElement="Flow_0b7s3zy">
  591. <di:waypoint x="700" y="152" />
  592. <di:waypoint x="700" y="120" />
  593. <di:waypoint x="580" y="120" />
  594. </bpmndi:BPMNEdge>
  595. <bpmndi:BPMNEdge id="Flow_1gc46ur_di" bpmnElement="Flow_1gc46ur">
  596. <di:waypoint x="480" y="120" />
  597. <di:waypoint x="430" y="120" />
  598. <di:waypoint x="430" y="240" />
  599. </bpmndi:BPMNEdge>
  600. <bpmndi:BPMNEdge id="Flow_1rcwh5r_di" bpmnElement="Flow_1rcwh5r">
  601. <di:waypoint x="860" y="210" />
  602. <di:waypoint x="880" y="210" />
  603. <di:waypoint x="880" y="280" />
  604. <di:waypoint x="995" y="280" />
  605. </bpmndi:BPMNEdge>
  606. <bpmndi:BPMNEdge id="Flow_09c65ah_di" bpmnElement="Flow_09c65ah">
  607. <di:waypoint x="960" y="520" />
  608. <di:waypoint x="860" y="520" />
  609. </bpmndi:BPMNEdge>
  610. <bpmndi:BPMNEdge id="Flow_1xp7bfo_di" bpmnElement="Flow_1xp7bfo">
  611. <di:waypoint x="1290" y="280" />
  612. <di:waypoint x="1352" y="280" />
  613. </bpmndi:BPMNEdge>
  614. <bpmndi:BPMNEdge id="Flow_1eauhgu_di" bpmnElement="Flow_1eauhgu">
  615. <di:waypoint x="760" y="520" />
  616. <di:waypoint x="560" y="520" />
  617. </bpmndi:BPMNEdge>
  618. <bpmndi:BPMNEdge id="Association_0p6rlsh_di" bpmnElement="Association_0p6rlsh">
  619. <di:waypoint x="848" y="170" />
  620. <di:waypoint x="885" y="131" />
  621. </bpmndi:BPMNEdge>
  622. </bpmndi:BPMNPlane>
  623. </bpmndi:BPMNDiagram>
  624. </bpmn2:definitions>