|
|
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.util.StrUtils; |
|
|
|
import com.hz.pm.api.projectdeclared.model.entity.XinchuangInst; |
|
|
|
import com.hz.pm.api.projectdeclared.service.IXinchuangInstService; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.ProjectInst; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectInstService; |
|
|
@@ -50,6 +52,8 @@ public class WithDrawHandle { |
|
|
|
private final RepositoryService repositoryService; |
|
|
|
private final IProjectInstService projectInstService; |
|
|
|
|
|
|
|
private final IXinchuangInstService xinchuangInstService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断 当前流程 可否被当前登录人 所撤回 |
|
|
|
* |
|
|
@@ -338,4 +342,33 @@ public class WithDrawHandle { |
|
|
|
//如果有已经被审核过的 节点 返回false |
|
|
|
return count == 0; |
|
|
|
} |
|
|
|
|
|
|
|
public boolean canRootWithDrawXinchuang(HistoricProcessInstance instance, String userId) { |
|
|
|
String startUserId = instance.getStartUserId(); |
|
|
|
// 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false |
|
|
|
LambdaQueryWrapper<XinchuangInst> piQuery = Wrappers.lambdaQuery(XinchuangInst.class) |
|
|
|
.select(XinchuangInst::getInstType) |
|
|
|
.eq(XinchuangInst::getInstCode, instance.getId()); |
|
|
|
XinchuangInst xinchuangInst = xinchuangInstService.getOne(piQuery); |
|
|
|
Integer instType = xinchuangInst.getInstType(); |
|
|
|
|
|
|
|
if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType) || |
|
|
|
InstTypeEnum.XCFHX_APPLY.eq(instType)) { |
|
|
|
return Boolean.FALSE; |
|
|
|
} |
|
|
|
//如果流程发起人 不是 当前登录人 直接返回false |
|
|
|
if (StrUtils.hasBlank(userId, startUserId) || !userId.equals(startUserId)) { |
|
|
|
return Boolean.FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
List<HistoricActivityInstance> finished = historyService.createHistoricActivityInstanceQuery() |
|
|
|
.processInstanceId(instance.getId()).finished() |
|
|
|
.activityType(TodoCenterConst.Handler.ACTIVITY_APPROVAL) |
|
|
|
.orderByHistoricActivityInstanceEndTime().asc().list(); |
|
|
|
long count = finished.stream() |
|
|
|
.filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) |
|
|
|
.count(); |
|
|
|
//如果有已经被审核过的 节点 返回false |
|
|
|
return count == 0; |
|
|
|
} |
|
|
|
} |