任务审核流程.bpmn 36 KB

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