兼容已经重复提交过下架的资源

This commit is contained in:
wangliwen 2022-05-23 10:47:02 +08:00
parent e6093fb62a
commit 59d13aadc8
1 changed files with 5 additions and 5 deletions

View File

@ -158,13 +158,13 @@ public class ResourceMountController {
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
if (resourceDTO.isPresent()) {
TaskQuery taskQuery = taskService.createTaskQuery();
Task task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).singleResult();
return task != null;
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count();
return task > 0;
} else {
return true;
}
}).filter(index -> index).findAny();
if (undercarriage.isPresent()){
if (undercarriage.isPresent()) {
return new Result<List<ProcessInstanceDTO>>().error("该资源已发起下架");
}
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
@ -174,8 +174,8 @@ public class ResourceMountController {
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
resourceDTO.ifPresent(dto -> {
TaskQuery taskQuery = taskService.createTaskQuery();
Task task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).singleResult();
if (task != null) {
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count();
if (task > 0) {
logger.error("该资源已发起下架");
throw new RuntimeException("该资源已发起下架");
}