当前位置:   article > 正文

基于jeecgboot的flowable流程增加节点表单的支持(三)_flowable 结合业务表单保存

flowable 结合业务表单保存

在流程流转过程中增加节点表单的后端修改

8、complete的修改

       主要增加下面方法,就是有任务节点表单的时候,complete需要取出这个值来,之后要进行下面的complete,特别是需要true参数,否则会有问题,所以对原先多实例approval处理进行另外处理,不在这里进行处理了

  1. /**
  2. * 任务节点有表单的操作
  3. *
  4. * @param taskVo
  5. */
  6. private void taskFormCompete(FlowTaskVo taskVo) {
  7. if(taskVo.getValues().containsKey("taskformvalues")) {//有任务节点表单
  8. @SuppressWarnings("unchecked")
  9. Map<String , Object> taskformvalues = (Map<String, Object>) taskVo.getValues().get("taskformvalues");
  10. taskService.complete(taskVo.getTaskId(),taskformvalues, true);//保存taskid到变量表里
  11. }
  12. else {
  13. taskService.complete(taskVo.getTaskId());
  14. }
  15. }

9、flowrecord的修改,主要增加下面部分,就是历史表单参数与历史表单数据

  1. // 获取历史任务节点表单数据值
  2. List<HistoricVariableInstance> listHistoricVariableInstance = historyService.createHistoricVariableInstanceQuery()
  3. .processInstanceId(procInsId)
  4. .taskId(histIns.getTaskId())
  5. .list();
  6. Map<String, Object> variables = new HashedMap<String, Object>();
  7. Map<String, Object> formconf = new HashedMap<String, Object>();
  8. for(HistoricVariableInstance historicVariableInstance:listHistoricVariableInstance) {
  9. variables.put(historicVariableInstance.getVariableName(), historicVariableInstance.getValue());
  10. }
  11. formconf.put("formValue", variables);
  12. // 获取历史任务节点表单参数
  13. if(Objects.nonNull(histIns.getTaskId())) {
  14. HistoricTaskInstance taskIns = historyService.createHistoricTaskInstanceQuery()
  15. .taskId(histIns.getTaskId())
  16. .includeIdentityLinks()
  17. .includeProcessVariables()
  18. .includeTaskLocalVariables()
  19. .finished()
  20. .singleResult();
  21. if (Objects.nonNull(taskIns)) {
  22. {
  23. String formId = taskIns.getFormKey();
  24. SysForm sysForm = sysDeployFormService.selectCurSysDeployForm(formId, deployId, taskIns.getTaskDefinitionKey());
  25. if (Objects.nonNull(sysForm)) {
  26. formconf.put("config", JSONObject.parseObject(sysForm.getFormContent()).get("config"));
  27. formconf.put("list", JSONObject.parseObject(sysForm.getFormContent()).get("list"));
  28. }
  29. }
  30. }
  31. }
  32. flowTask.setTaskFormValues(formconf);
  33. hisFlowList.add(flowTask);
  34. }
  35. }
  36. map.put("flowList", hisFlowList);
  37. }
  38. // 获取初始化自定义表单
  39. if(StringUtils.isNotBlank(businessKey)) {
  40. FlowMyBusiness business = flowMyBusinessService.getByDataId(businessKey);
  41. String serviceImplName = business.getServiceImplName();
  42. FlowCallBackServiceI flowCallBackService = (FlowCallBackServiceI) SpringContextUtils.getBean(serviceImplName);
  43. // 流程处理完后,进行回调业务层
  44. if (flowCallBackService!=null){
  45. Object businessDataById = flowCallBackService.getBusinessDataById(businessKey);
  46. map.put("formData",businessDataById);
  47. map.put("routeName", business.getRouteName());
  48. }
  49. }
  50. else {
  51. if (StringUtils.isNotBlank(deployId)) {
  52. //获取当前节点的初始化表单
  53. if(Objects.nonNull(taskId)) {
  54. HistoricTaskInstance taskIns = historyService.createHistoricTaskInstanceQuery()
  55. .taskId(taskId)
  56. .includeIdentityLinks()
  57. .includeProcessVariables()
  58. .includeTaskLocalVariables()
  59. .singleResult();
  60. if (Objects.nonNull(taskIns)) {
  61. String formId = taskIns.getFormKey();
  62. SysForm sysForm = sysDeployFormService.selectCurSysDeployForm(formId, deployId, taskIns.getTaskDefinitionKey());
  63. if (Objects.nonNull(sysForm)) {
  64. map.put("taskFormData", JSONObject.parseObject(sysForm.getFormContent()));
  65. }
  66. }
  67. }
  68. else {
  69. SysForm sysForm = sysDeployFormService.selectSysDeployFormByDeployId(deployId);
  70. if (Objects.isNull(sysForm)) {
  71. return Result.error("请先配置流程表单");
  72. }
  73. map.put("formData", JSONObject.parseObject(sysForm.getFormContent()));
  74. }
  75. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/852428
推荐阅读
相关标签
  

闽ICP备14008679号