任务审核流程.bpmn 37 KB

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