Commit f205ab5b by tangzhaoqian Committed by chenzg

审批优化

parent 2bdeb469
package cn.timer.api.controller.spmk;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
......@@ -35,6 +37,7 @@ import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkCustomApproval;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.bean.spmk.SpmkIcon;
import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.spmk.SpmkJqgz;
......@@ -787,8 +790,6 @@ public class SpmkServiceImpl {
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
// System.out.println(jSONObject);
// System.out.println(listRouter);
// System.out.println(listFlowChildren);
......@@ -882,6 +883,14 @@ public class SpmkServiceImpl {
.lambda()
.eq(SpmkApproveDetail::getApproveSummaryId, approvingDto.getAsId()));
Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getSts, "1"));
if (count == 0) {
return ResultUtil.error("您已审批过!");
}
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectById(approvingDto.getAsId());
if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = (List<FlowChildren>)ObjectUtil.unserialize(ad.getFlowChildren());
......@@ -895,7 +904,12 @@ public class SpmkServiceImpl {
System.out.println(listFlowChildren);
// 更新 flowChildren
SpmkApproveDetail.builder().id(ad.getId()).froms(ObjectUtil.serialize(listFlowChildren)).build().updateById();
SpmkApproveDetail.builder().id(ad.getId()).flowChildren(ObjectUtil.serialize(listFlowChildren)).build().updateById();
if (CollUtil.getLast(listFlowChildren).getExecute() == "2") {
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
}
}else {
return ResultUtil.error("该审批已结束!");
......
......@@ -38,7 +38,7 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "申请数据 ", example = "申请数据")
private JSONObject requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
@ApiModelProperty(value = "审批表单 ", example = "数组")
private List<JSONObject> froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
......
package cn.timer.api.utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -105,14 +106,22 @@ public class RouterUtils {
// 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType())) {
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue()), Integer.valueOf(listRelations.get(i).getDepartmentId()));
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
System.out.println(listYgglMainEmp);
if (listYgglMainEmp != null && listYgglMainEmp.size() > 0) {
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
}
listRelations.get(i).setUsers(listUsers);
}else {
listRelations.get(i).setUsers(null);
}
listRelations.get(i).setUsers(listUsers);
}else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) {
......@@ -293,8 +302,11 @@ public class RouterUtils {
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) {
for (int i = 0,m = listFlowChildren.size() ; i < m; i++) {
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute()))
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
i++;
continue;
}
switch (listFlowChildren.get(i).getClassName()) {
case CREATOR:
......@@ -402,14 +414,14 @@ public class RouterUtils {
// 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
if (EXECUTED.equals(listFlowChildren.get(i).getExecute())) {
continue;
}else if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
// 新增 执行人
// listUser = flowChildren.getRelation().get(0).getUsers();
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
continue;
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
SpmkExecutor.builder()
.id(executorId)
......@@ -420,15 +432,15 @@ public class RouterUtils {
.build()
.updateById();
listUser.get(i_user).setExecute(EXECUTED);
// 历史审批人
SpmkApproveSummary.builder().id(asId).historyApprover(listUser.get(i_user).getName()).build().updateById();
// 0未执行 1执行中 2同意 3拒绝
if (sts == 3) {
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).sts(sts).build().updateById();
SpmkApproveSummary.builder().id(asId).endTime(new Date()).sts(sts).build().updateById();
return;
}
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
SpmkExecutor.builder()
.approveExecuteRecordId(executeRecordId)
......@@ -439,6 +451,9 @@ public class RouterUtils {
.insert();
hasNextApprover = true;
listUser.get(i_user).setExecute(EXECUTING);
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
}
}
......
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