diff --git a/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustAlterApplyController.java b/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustAlterApplyController.java index 405af30..b3bff18 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustAlterApplyController.java +++ b/src/main/java/digital/laboratory/platform/entrustment/controller/EntrustAlterApplyController.java @@ -11,6 +11,7 @@ import digital.laboratory.platform.entrustment.service.EntrustAlterApplyService; import digital.laboratory.platform.entrustment.vo.EntrustAlterApplyVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -101,7 +102,14 @@ public class EntrustAlterApplyController { @PutMapping("/updateEntrust") public R updateEntrust(@Valid @RequestBody ApprovedUpdateEntrustDTO dto) { Boolean success = entrustAlterApplyService.updateEntrust(dto); - return R.ok(); + return R.ok(success).setMsg(success ? "修改成功" : "修改失败"); + } + + @ApiOperation(value = "判断当前委托是否在申请中的状态", notes = "判断当前委托是否在申请中的状态") + @GetMapping("/isApplying") + public R isApplying(@RequestParam("entrustId") String entrustId) { + Boolean success = entrustAlterApplyService.isApplying(entrustId); + return R.ok(success).setMsg(success ? "当前委托在申请修改中!" : "当前委托在未申请修改!"); } } diff --git a/src/main/java/digital/laboratory/platform/entrustment/service/EntrustAlterApplyService.java b/src/main/java/digital/laboratory/platform/entrustment/service/EntrustAlterApplyService.java index 6c97323..53504b3 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/service/EntrustAlterApplyService.java +++ b/src/main/java/digital/laboratory/platform/entrustment/service/EntrustAlterApplyService.java @@ -59,4 +59,12 @@ public interface EntrustAlterApplyService extends IService { * @return */ Boolean updateEntrust(ApprovedUpdateEntrustDTO dto); + + /** + * 判断当前委托是否在申请中的状态 + * @param entrustId + * @return + */ + Boolean isApplying(String entrustId); + } diff --git a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.java b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.java index 49e9c7e..cb11f05 100644 --- a/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.java +++ b/src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.java @@ -83,12 +83,8 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl preApplyInfo = super.list(Wrappers.lambdaQuery().eq(EntrustAlterApply::getEntrustId, dto.getEntrustId())); - if (CollUtil.isNotEmpty(preApplyInfo)) { - List unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(unfinishedList)) { - throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!"); - } + if (isApplying(dto.getEntrustId())) { + throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!"); } EntrustAlterApply entrustAlterApply = new EntrustAlterApply(); @@ -281,6 +277,23 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl preApplyInfo = super.list(Wrappers.lambdaQuery().eq(EntrustAlterApply::getEntrustId, entrustId)); + if (CollUtil.isNotEmpty(preApplyInfo)) { + List unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(unfinishedList)) { + return true; + } + } + return false; + } + /** * 更新鉴定要求 * @param entrustmentId