Browse Source

修改字段对比 和 当时的审批记录 解决循环依赖

master
PoffyZhang 1 year ago
parent
commit
d4d02e7536
1 changed files with 39 additions and 3 deletions
  1. +39
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java

+ 39
- 3
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java View File

@@ -1,8 +1,12 @@
package com.ningdatech.pmapi.todocenter.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.handle.PassHandle;
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle;
import com.ningdatech.pmapi.todocenter.manage.HandlerManage;
@@ -46,7 +50,9 @@ public class TodoServiceImpl implements ITodoService {

private final PassHandle passHandle;

private final ProjectLibManage projectLibManage;
private final IProjectService projectService;

private final IProjectInstService projectInstService;

/**
* 查询流程表单数据及审批的进度步骤
@@ -80,7 +86,7 @@ public class TodoServiceImpl implements ITodoService {
res.setIsHighLine(isHighLine);
passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res);
//是不是被 驳回|退回
res.setIsChange(projectLibManage.isChangeRecord(projectId));
res.setIsChange(isChangeRecord(projectId));
return res;
}

@@ -125,4 +131,34 @@ public class TodoServiceImpl implements ITodoService {
});
return res[0];
}

/**
* 判断 当前项目是不是被驳回 或者 退回过
* @param projectId
* @return
*/
private Boolean isChangeRecord(Long projectId) {
//1.先判断下 项目存不存在
Project project = projectService.getById(projectId);
if(Objects.isNull(project)){
return Boolean.FALSE;
}

List<Long> projectIds = projectService.getAllVersionProjectId(project);
//2.要判断 项目在当前状态 有没有被驳回和退回过
//当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回
List<ProjectInst> pis = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIds)
.orderByDesc(ProjectInst::getInstType)
.last("limit 2"));
if(CollUtil.isEmpty(pis)){
return Boolean.FALSE;
}
if( pis.size() < 2 ||
!pis.get(0).getInstType().equals(pis.get(1).getInstType())) {
return Boolean.FALSE;
}

return Boolean.TRUE;
}
}

Loading…
Cancel
Save