Commit 3a4fcd80 by 龙于生

优化审批流程

parent dcff51c4
......@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -578,7 +579,8 @@ public class RouterUtils {
boolean hasNextApprover = false;
//统计并序审批 还有几个执行中的
int es=0;
//操作人是否在审批名单里
boolean isExist = false;
for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
// 新增 执行人
List<User> listUser = CollUtil.toList();
......@@ -586,10 +588,15 @@ public class RouterUtils {
List<Relation> listR = listFlowChildren.get(i).getRelation();
if (CollectionUtil.isNotEmpty(listR)) {
listUser = listR.get(0).getUsers();
if("1".equals(listR.get(0).getApprovalOrder())){
aobl = true;
for (User user:listR.get(0).getUsers()
) {
if(Integer.parseInt(user.getId()) == empNum && listFlowChildren.get(i).getClassName().equals(AUDIT)){
isExist = true;
}
//判断是顺序还是并序 0顺序 1并序
if("1".equals(listR.get(0).getApprovalOrder())){
aobl = true;
if ("1".equals(user.getExecute())){
es++;
}
......@@ -602,6 +609,7 @@ public class RouterUtils {
//执行中
if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
String currentApprover = "";//存放当前审批人名称
int num = 0;
//遍历当前节点审批人
outloop: // 标识 (若内层满足条件直接跳到该层循环)
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
......@@ -612,13 +620,14 @@ public class RouterUtils {
//执行中
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
//判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派)
if (Integer.parseInt(listUser.get(i_user).getId()) == empNum){
if ((Integer.parseInt(listUser.get(i_user).getId()) == empNum && num == 0) || (!isExist && num == 0)){
num++;
SpmkExecutor.builder()
.id(executorId)
.opinion(opinion)
//.empNum(Integer.parseInt(listUser.get(i_user).getId()))
//.executorName(listUser.get(i_user).getName())
//.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.empNum(Integer.parseInt(listUser.get(i_user).getId()))
.executorName(listUser.get(i_user).getName())
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(sts)
.signatureImg(signatureImg)
.build()
......@@ -652,7 +661,7 @@ public class RouterUtils {
}else if (sts == ExecutorSts.REDEPLOY.ordinal()) {
//新增转派多个人功能
//判断是走派多个人的 否则走旧逻辑
if(redeployUserList.size() >0 ){
if(!CollectionUtils.isEmpty(redeployUserList)){
List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1);
for (User ruser:redeployUserList
) {
......@@ -678,6 +687,7 @@ public class RouterUtils {
//
// System.out.println(listUser);
}
//break outloop;
}
//未执行
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
......@@ -698,9 +708,10 @@ public class RouterUtils {
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
if(redeployUserList.size() == 0 ){
break;
if(CollectionUtils.isEmpty(redeployUserList)){
break outloop;
}
}
}
......@@ -794,9 +805,7 @@ public class RouterUtils {
.build();
// 新增 审批执行记录
aer2.insert();
String currentApprover = "";
//遍历当前节点审批人
outloop:
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
......@@ -805,24 +814,14 @@ public class RouterUtils {
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
//新增执行人
executor.insert();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
// 当前审批人
currentApprover=currentApprover!=""?currentApprover+","+listUser.get(i_user2).getName():listUser.get(i_user2).getName();
SpmkApproveSummary.builder().id(asId).currentApprover(currentApprover).build().updateById();
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user2).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
for (int j = 0; j < redeployUserList.size(); j++) {
User u = redeployUserList.get(j);
if(u.getId() == listUser.get(i_user2).getId()){
if (j == redeployUserList.size() - 1){
break outloop;
}
}
}
//break;
break;
}
listFlowChildren.get(i).setExecute(EXECUTING);
......
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