兼容已经重复提交过下架的资源
This commit is contained in:
parent
e6093fb62a
commit
59d13aadc8
|
@ -158,13 +158,13 @@ public class ResourceMountController {
|
||||||
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
if (resourceDTO.isPresent()) {
|
if (resourceDTO.isPresent()) {
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
Task task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).singleResult();
|
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count();
|
||||||
return task != null;
|
return task > 0;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}).filter(index -> index).findAny();
|
}).filter(index -> index).findAny();
|
||||||
if (undercarriage.isPresent()){
|
if (undercarriage.isPresent()) {
|
||||||
return new Result<List<ProcessInstanceDTO>>().error("该资源已发起下架");
|
return new Result<List<ProcessInstanceDTO>>().error("该资源已发起下架");
|
||||||
}
|
}
|
||||||
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
|
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
|
||||||
|
@ -174,8 +174,8 @@ public class ResourceMountController {
|
||||||
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
resourceDTO.ifPresent(dto -> {
|
resourceDTO.ifPresent(dto -> {
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
Task task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).singleResult();
|
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count();
|
||||||
if (task != null) {
|
if (task > 0) {
|
||||||
logger.error("该资源已发起下架");
|
logger.error("该资源已发起下架");
|
||||||
throw new RuntimeException("该资源已发起下架");
|
throw new RuntimeException("该资源已发起下架");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue