diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 5b01f209..b87eb615 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -158,13 +158,13 @@ public class ResourceMountController { Optional 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>().error("该资源已发起下架"); } return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> { @@ -174,8 +174,8 @@ public class ResourceMountController { Optional 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("该资源已发起下架"); }