Commit bbaf9db5 by yuquan.zhu Committed by chenzg

改审批发起逻辑

parent 9d23d422
......@@ -525,26 +525,30 @@ public class SpmkController {
Router router = spmkApproveSummaryDto.getRouter();
List<Router> routers = router.getChildren();
// routers = RouterUtils.clearRouters(routers);
if(routers==null){
return ResultUtil.error("无法发起,请完善审批流程");
}
if (CollectionUtil.isNotEmpty(routers)) {
boolean hasAudit=false;
if(routers.size()>0){
for (Relation relation:routers.get(0).getRelation()) {
if(relation.getUsers().size()>0){
hasAudit=true;
}
}
}
// List<Relation> relations = routers.get(0).getRelation();
// if (relations == null || relations.size() < 1) {
// return ResultUtil.error("无法发起,请完善审批流程");
// boolean hasAudit=false;
// if(routers.size()>0){
// for (Relation relation:routers.get(0).getRelation()) {
// if(relation.getUsers().size()>0){
// hasAudit=true;
// }
// }
// }
// List<User> users = relations.get(0).getUsers();
// if (CollectionUtil.isEmpty(users)) {
// return ResultUtil.error("无法发起,请完善审批流程");
//// List<Relation> relations = routers.get(0).getRelation();
//// if (relations == null || relations.size() < 1) {
//// return ResultUtil.error("无法发起,请完善审批流程");
//// }
//// List<User> users = relations.get(0).getUsers();
//// if (CollectionUtil.isEmpty(users)) {
//// return ResultUtil.error("无法发起,请完善审批流程");
//// }
// if(!hasAudit){
// return ResultUtil.error("请选择审批人!");
// }
if(!hasAudit){
return ResultUtil.error("请选择审批人!");
}
}else {
return ResultUtil.error("无法发起,请完善审批流程");
}
......@@ -560,6 +564,25 @@ public class SpmkController {
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
if(listFlowChildren.isEmpty()){
return ResultUtil.error("无法发起,请完善审批流程");
}
for (FlowChildren flowChildrenItem: listFlowChildren) {
if("audit".equals(flowChildrenItem.getClassName())){
boolean hasAudit=false;
for (Relation relation:flowChildrenItem.getRelation()) {
if(relation.getUsers().size()>0){
hasAudit=true;
}
}
if(!hasAudit){
return ResultUtil.error("审批流程设置审批人为空无法发起!");
}
}
}
Logoutput("listFlowChildren");
// 当前审批人
......
......@@ -389,12 +389,26 @@ public class RouterUtils {
if(router.getRelation() != null) {
for (Relation relation : router.getRelation()) {
if (relation != null && CollectionUtil.isNotEmpty(relation.getUsers())) {
if (router.getFlow()) {
FlowChildren fc = FlowChildren.builder().build();
BeanUtil.copyProperties(router, fc, "condition","children");
listFlowChildren.add(fc);
getIsFlowChildren(router.getChildren(), listFlowChildren);
if (relation != null) {
if(CollectionUtil.isNotEmpty(relation.getUsers())){
if (router.getFlow()) {
FlowChildren fc = FlowChildren.builder().build();
BeanUtil.copyProperties(router, fc, "condition","children");
listFlowChildren.add(fc);
getIsFlowChildren(router.getChildren(), listFlowChildren);
}
}else{
//无审批人,查询是否跳过或者失败! 0不处理 1指定成员 2自动通过
if("executive".equals(relation.getType()) && relation.getEmpty() == 2){
getIsFlowChildren(router.getChildren(), listFlowChildren);
}else if("executive".equals(relation.getType()) && relation.getEmpty() == 0){
FlowChildren fc = FlowChildren.builder().build();
BeanUtil.copyProperties(router, fc, "condition","children");
listFlowChildren.add(fc);
getIsFlowChildren(router.getChildren(), listFlowChildren);
}else {
//未开发
}
}
}
}
......@@ -714,4 +728,9 @@ public class RouterUtils {
}
public static List<Router> clearRouters(List<Router> routers){
return 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