Commit 182d832f by 龙于生

审批人去重

parent 880c8c5c
package cn.timer.api.controller.spmk;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
......@@ -10,6 +11,7 @@ import java.util.Set;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.*;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -555,8 +557,56 @@ public class SpmkController {
if(listFlowChildren.isEmpty()){
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) {
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())){
boolean hasAudit=false;
for (Relation relation:flowChildrenItem.getRelation()) {
......@@ -568,7 +618,7 @@ public class SpmkController {
return ResultUtil.error("审批流程设置审批人为空无法发起!");
}
}
}
}*/
Logoutput("listFlowChildren");
......@@ -660,6 +710,7 @@ public class SpmkController {
public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
}
......@@ -943,40 +994,40 @@ public class SpmkController {
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
return ResultUtil.data(qna);
return ResultUtil.data(qna);
}
@Value("${config-8timer.environmental-science}")
......
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