基于若依的ruoyi-nbcio流程管理系统里修正仿钉钉流程部门主管与多实例转xml的bug

2024-01-10 14:23:33

更多ruoyi-nbcio功能请看演示系统

gitee源代码地址

前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio

演示地址:RuoYi-Nbcio后台管理系统

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888
?

1、后端代码?createUserTask方法里修正如下:

根据不通类型进行分别判断出来xml生成

String assignType = properties.getString("assigneeType");
        		if(StringUtils.equalsAnyIgnoreCase("user", assignType)) {
	        		JSONArray approvers = properties.getJSONArray("approvers");
	        		JSONObject approver = approvers.getJSONObject(0);
	        		ExtensionAttribute extDataTypeAttribute =  new ExtensionAttribute();
	        		extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extDataTypeAttribute.setName("dataType");
	        		extDataTypeAttribute.setValue("USERS");
	        		userTask.addAttribute(extDataTypeAttribute);
	        		ExtensionAttribute extTextAttribute =  new ExtensionAttribute();
	        		extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extTextAttribute.setName("text");
	        		extTextAttribute.setValue(approver.getString("nickName"));
	        		userTask.addAttribute(extTextAttribute);
	        		userTask.setFormKey(properties.getString("formKey"));
	        		userTask.setAssignee(approver.getString("userName"));
        		}
        		else if (StringUtils.equalsAnyIgnoreCase("director", assignType)) {
	        		ExtensionAttribute extDataTypeAttribute =  new ExtensionAttribute();
	        		extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extDataTypeAttribute.setName("dataType");
	        		extDataTypeAttribute.setValue("MANAGER");
	        		userTask.addAttribute(extDataTypeAttribute);
	        		ExtensionAttribute extTextAttribute =  new ExtensionAttribute();
	        		extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extTextAttribute.setName("text");
	        		extTextAttribute.setValue("部门经理");
	        		userTask.addAttribute(extTextAttribute);
	        		userTask.setFormKey(properties.getString("formKey"));
	        		userTask.setAssignee("${DepManagerHandler.getUser(execution)}");
        		}
        		else if (StringUtils.equalsAnyIgnoreCase("role", assignType)) {
        			JSONArray approvers = properties.getJSONArray("approvers");
	        		JSONObject approver = approvers.getJSONObject(0);
	        		ExtensionAttribute extDataTypeAttribute =  new ExtensionAttribute();
	        		extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extDataTypeAttribute.setName("dataType");
	        		extDataTypeAttribute.setValue("ROLES");
	        		userTask.addAttribute(extDataTypeAttribute);
	        		ExtensionAttribute extTextAttribute =  new ExtensionAttribute();
	        		extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);
	        		extTextAttribute.setName("text");
	        		extTextAttribute.setValue(approver.getString("roleName"));
	        		userTask.addAttribute(extTextAttribute);
	        		userTask.setFormKey(properties.getString("formKey"));
	        		List<SysRole> sysroleslist = approvers.toJavaList(SysRole.class);
	        		List<String> roleslist = sysroleslist.stream().map(e->e.getRoleKey()).collect(Collectors.toList());
	        		userTask.setCandidateGroups(roleslist);
	        		userTask.setAssignee("${assignee}");
	        		MultiInstanceLoopCharacteristics loopCharacteristics = new MultiInstanceLoopCharacteristics();
	        		if(StringUtils.equalsAnyIgnoreCase(properties.getString("counterSign"), "true")) {//并行会签
	        			loopCharacteristics.setSequential(false);
	        			loopCharacteristics.setInputDataItem("${multiInstanceHandler.getUserNames(execution)}");
	        			loopCharacteristics.setElementVariable("assignee");
	        			loopCharacteristics.setCompletionCondition("${nrOfCompletedInstances &gt;= nrOfInstances}");
	        		}
	        		else {
	        			loopCharacteristics.setSequential(false);
	        			loopCharacteristics.setInputDataItem("${multiInstanceHandler.getUserNames(execution)}");
	        			loopCharacteristics.setElementVariable("assignee");
	        			loopCharacteristics.setCompletionCondition("${nrOfCompletedInstances &gt; 0}");
	        		}
	        		userTask.setLoopCharacteristics(loopCharacteristics);
        		}

2、部门主管效果图

3、多实例效果图

文章来源:https://blog.csdn.net/qq_40032778/article/details/135442837
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。