更新
1.添加判断当前委托是否在申请修改中
This commit is contained in:
@@ -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,12 +83,8 @@ 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)) {
|
||||
throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
|
||||
}
|
||||
if (isApplying(dto.getEntrustId())) {
|
||||
throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
|
||||
}
|
||||
|
||||
EntrustAlterApply entrustAlterApply = new EntrustAlterApply();
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user