更多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 >= nrOfInstances}");
}
else {
loopCharacteristics.setSequential(false);
loopCharacteristics.setInputDataItem("${multiInstanceHandler.getUserNames(execution)}");
loopCharacteristics.setElementVariable("assignee");
loopCharacteristics.setCompletionCondition("${nrOfCompletedInstances > 0}");
}
userTask.setLoopCharacteristics(loopCharacteristics);
}
2、部门主管效果图
3、多实例效果图