Commit 182d832f by 龙于生

审批人去重

parent 880c8c5c
package cn.timer.api.controller.spmk; package cn.timer.api.controller.spmk;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
...@@ -10,6 +11,7 @@ import java.util.Set; ...@@ -10,6 +11,7 @@ import java.util.Set;
import cn.timer.api.bean.spmk.*; import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*; import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.*; import cn.timer.api.dto.spmk.*;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -555,8 +557,56 @@ public class SpmkController { ...@@ -555,8 +557,56 @@ public class SpmkController {
if(listFlowChildren.isEmpty()){ if(listFlowChildren.isEmpty()){
return ResultUtil.error("无法发起,请完善审批流程"); return ResultUtil.error("无法发起,请完善审批流程");
} }
List<FlowChildren> listFlowChildren1 = (ArrayList<FlowChildren>) SerializationUtils.clone((Serializable) listFlowChildren);
List<String> uidlist = new ArrayList<>();
int i=0;
int fsize = listFlowChildren.size();
int f=0;//listFlowChildren删除次数
for (FlowChildren flowChildrenItem: listFlowChildren) { 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 (relation.getUsers().size() > 1){
int j=0;
int usize=relation.getUsers().size();//
int r=0;//user list删除次数
for (User user:relation.getUsers()
) {
if (!uidlist.contains(user.getId())) {
uidlist.add(user.getId());
}else {
listFlowChildren1.get(i).getRelation().get(0).getUsers().remove(j-r);
r++;
}
j++;
}
if (usize==r){
listFlowChildren1.remove(i-f);
f++;
}
}else {
if (!uidlist.contains(relation.getUsers().get(0).getId())) {
uidlist.add(relation.getUsers().get(0).getId());
}else {
listFlowChildren1.remove(i-f);
f++;
}
}
}
}
if (!hasAudit) {
return ResultUtil.error("审批流程设置审批人为空无法发起!");
}
}
i++;
}
listFlowChildren = (ArrayList<FlowChildren>) SerializationUtils.clone((Serializable) listFlowChildren1);
/*for (FlowChildren flowChildrenItem: listFlowChildren) {
if("audit".equals(flowChildrenItem.getClassName())){ if("audit".equals(flowChildrenItem.getClassName())){
boolean hasAudit=false; boolean hasAudit=false;
for (Relation relation:flowChildrenItem.getRelation()) { for (Relation relation:flowChildrenItem.getRelation()) {
...@@ -568,7 +618,7 @@ public class SpmkController { ...@@ -568,7 +618,7 @@ public class SpmkController {
return ResultUtil.error("审批流程设置审批人为空无法发起!"); return ResultUtil.error("审批流程设置审批人为空无法发起!");
} }
} }
} }*/
Logoutput("listFlowChildren"); Logoutput("listFlowChildren");
...@@ -660,6 +710,7 @@ public class SpmkController { ...@@ -660,6 +710,7 @@ public class SpmkController {
public Result<Object> selectAd(@PathVariable(required = true) Integer id) { public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id); SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD); return ResultUtil.data(adD);
} }
......
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