1.添加判断当前委托是否在申请修改中
master
陈江保 4 months ago
parent 0814b5edd4
commit ae36e168af
  1. 10
      src/main/java/digital/laboratory/platform/entrustment/controller/EntrustAlterApplyController.java
  2. 8
      src/main/java/digital/laboratory/platform/entrustment/service/EntrustAlterApplyService.java
  3. 23
      src/main/java/digital/laboratory/platform/entrustment/service/impl/EntrustAlterApplyServiceImpl.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 ? "当前委托在申请修改中!" : "当前委托在未申请修改!");
}
}

@ -59,4 +59,12 @@ public interface EntrustAlterApplyService extends IService<EntrustAlterApply> {
* @return
*/
Boolean updateEntrust(ApprovedUpdateEntrustDTO dto);
/**
* 判断当前委托是否在申请中的状态
* @param entrustId
* @return
*/
Boolean isApplying(String entrustId);
}

@ -83,13 +83,9 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
@Override
public EntrustAlterApplyVO save(EntrustAlterApplyDTO dto) {
// 对当前委托进行校验,如果有关联该委托的申请信息,判断状态如果不是已完成则提示先完成当前申请
List<EntrustAlterApply> preApplyInfo = super.list(Wrappers.<EntrustAlterApply>lambdaQuery().eq(EntrustAlterApply::getEntrustId, dto.getEntrustId()));
if (CollUtil.isNotEmpty(preApplyInfo)) {
List<EntrustAlterApply> unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(unfinishedList)) {
if (isApplying(dto.getEntrustId())) {
throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
}
}
EntrustAlterApply entrustAlterApply = new EntrustAlterApply();
if (StrUtil.isBlank(dto.getId())) {
@ -281,6 +277,23 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
.set(dto.getFinished(), EntrustAlterApply::getStatus, EntrustAlterApplyStatus.FINISHED.getStatus()));
}
/**
* 判断当前委托是否在申请中的状态
* @param entrustId
* @return
*/
@Override
public Boolean isApplying(String entrustId) {
List<EntrustAlterApply> preApplyInfo = super.list(Wrappers.<EntrustAlterApply>lambdaQuery().eq(EntrustAlterApply::getEntrustId, entrustId));
if (CollUtil.isNotEmpty(preApplyInfo)) {
List<EntrustAlterApply> unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(unfinishedList)) {
return true;
}
}
return false;
}
/**
* 更新鉴定要求
* @param entrustmentId

Loading…
Cancel
Save