Commit a4349879 by 龙于生

修改审批转派 转派人生成新节点跟在后面

parent aad80406
...@@ -7,6 +7,7 @@ import java.util.stream.Collectors; ...@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONObject;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
...@@ -21,7 +22,6 @@ import cn.hutool.core.collection.ListUtil; ...@@ -21,7 +22,6 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.ConvertException; import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord; import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary; import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkExecutor; import cn.timer.api.bean.spmk.SpmkExecutor;
...@@ -82,6 +82,9 @@ public class RouterUtils { ...@@ -82,6 +82,9 @@ public class RouterUtils {
*/ */
private final static String RELATION_TYPE_USERS = "users"; private final static String RELATION_TYPE_USERS = "users";
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) throws NumberFormatException, ConvertException, Exception { public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) throws NumberFormatException, ConvertException, Exception {
return NextNode(listRouter, obj, isFirse, false); return NextNode(listRouter, obj, isFirse, false);
} }
...@@ -581,6 +584,14 @@ public class RouterUtils { ...@@ -581,6 +584,14 @@ public class RouterUtils {
int es=0; int es=0;
//操作人是否在审批名单里 //操作人是否在审批名单里
boolean isExist = false; boolean isExist = false;
List<FlowChildren> flowChildrenList = new ArrayList<>();
int redeployIndex = -1;//当前转派人所在节点下标
//初始化转派人数据 用于转派
String flowChildrenJson = "{\"className\":\"audit\",\"execute\":\"0\",\"flow\":true,\"relation\":[{\"approvalOrder\":\"0\",\"departmentId\":\"\",\"down\":0,\"empty\":0,\"name\":\"\",\"signature\":0,\"type\":\"users\",\"upward\":0,\"users\":[{\"execute\":\"0\",\"headUrl\":\"\",\"id\":\"\",\"name\":\"\"}]}]}";
FlowChildren flowChildren = jsonObject.parseObject(flowChildrenJson,FlowChildren.class);
for (int i = 0,n = listFlowChildren.size(); i < n; i++) { for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
// 新增 执行人 // 新增 执行人
List<User> listUser = CollUtil.toList(); List<User> listUser = CollUtil.toList();
...@@ -663,8 +674,12 @@ public class RouterUtils { ...@@ -663,8 +674,12 @@ public class RouterUtils {
//新增转派多个人功能 //新增转派多个人功能
//判断是走派多个人的 否则走旧逻辑 //判断是走派多个人的 否则走旧逻辑
if(!CollectionUtils.isEmpty(redeployUserList)){ if(!CollectionUtils.isEmpty(redeployUserList)){
//List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1); //List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1); 第一次修改
redeployUserList.add(users1.get(users1.size() - 1)); //redeployUserList.add(users1.get(users1.size() - 1)); 第二次修改
flowChildren.getRelation().get(0).setName(users1.get(users1.size() - 1).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(users1.get(users1.size() - 1).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(users1.get(users1.size() - 1).getId());
redeployIndex = i;
for (User ruser:redeployUserList for (User ruser:redeployUserList
) { ) {
ruser.setExecute(UNEXECUTED); ruser.setExecute(UNEXECUTED);
...@@ -682,14 +697,20 @@ public class RouterUtils { ...@@ -682,14 +697,20 @@ public class RouterUtils {
//新加的 把转派人跟在后面说 //新加的 把转派人跟在后面说
User user = users1.get(users1.size() - 2); User user = users1.get(users1.size() - 2);
User us = new User(); // User us = new User();
us.setExecute(UNEXECUTED); // us.setExecute(UNEXECUTED);
us.setName(user.getName()); // us.setName(user.getName());
us.setId(user.getId()); // us.setId(user.getId());
users1.add(us); // users1.add(us);
flowChildren.getRelation().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(user.getId());
redeployIndex = i;
List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size()); List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
redeployUserList = users2; redeployUserList = users2;
//listUser = ListUtils.union(users1, users2); //listUser = ListUtils.union(users1, users2);
n_user = listUser.size(); n_user = listUser.size();
} }
...@@ -877,7 +898,17 @@ public class RouterUtils { ...@@ -877,7 +898,17 @@ public class RouterUtils {
} }
} }
} }
for (int i = 0; i < listFlowChildren.size(); i++) {
flowChildrenList.add(listFlowChildren.get(i));
if(i == redeployIndex){
flowChildrenList.add(flowChildren);
}
}
if (flowChildrenList.size() > 0){
listFlowChildren.clear();
listFlowChildren.addAll(flowChildrenList);
}
} }
public static List<Router> clearRouters(List<Router> routers){ public static List<Router> clearRouters(List<Router> routers){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment