更新
1.同一个委托只能有一个正在申请的状态
This commit is contained in:
+9
-1
@@ -43,7 +43,13 @@ public class EntrustAlterApplyController {
|
|||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@PreAuthorize("@pms.hasPermission('EntrustAlterApplySubmit')") // 委托申请修改消息保存提交权限
|
@PreAuthorize("@pms.hasPermission('EntrustAlterApplySubmit')") // 委托申请修改消息保存提交权限
|
||||||
public R save(@RequestBody @Valid EntrustAlterApplyDTO dto) {
|
public R save(@RequestBody @Valid EntrustAlterApplyDTO dto) {
|
||||||
EntrustAlterApplyVO vo = entrustAlterApplyService.save(dto);
|
EntrustAlterApplyVO vo = null;
|
||||||
|
try {
|
||||||
|
vo = entrustAlterApplyService.save(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return R.failed(e.getMessage());
|
||||||
|
}
|
||||||
return R.ok(vo);
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,4 +76,6 @@ public class EntrustAlterApplyController {
|
|||||||
Boolean success = entrustAlterApplyService.delete(ids);
|
Boolean success = entrustAlterApplyService.delete(ids);
|
||||||
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class EntrustAlterApply extends BaseEntity {
|
|||||||
private String reviewer;
|
private String reviewer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过
|
* 状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过,9 申请已完成
|
||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
+1
@@ -9,6 +9,7 @@ public enum EntrustAlterApplyStatus {
|
|||||||
SUBMITTED_WAIT_APPROVE(1,"提交申请待审核"),
|
SUBMITTED_WAIT_APPROVE(1,"提交申请待审核"),
|
||||||
APPLY_SUCCESS(2, "申请通过"),
|
APPLY_SUCCESS(2, "申请通过"),
|
||||||
APPLY_FAIL(-1, "申请不通过"),
|
APPLY_FAIL(-1, "申请不通过"),
|
||||||
|
FINISHED(9, "已完成"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+11
@@ -1,5 +1,6 @@
|
|||||||
package digital.laboratory.platform.entrustment.service.impl;
|
package digital.laboratory.platform.entrustment.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ChenJiangBao
|
* @author ChenJiangBao
|
||||||
@@ -52,6 +54,15 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public EntrustAlterApplyVO save(EntrustAlterApplyDTO dto) {
|
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 RuntimeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EntrustAlterApply entrustAlterApply = new EntrustAlterApply();
|
EntrustAlterApply entrustAlterApply = new EntrustAlterApply();
|
||||||
if (StrUtil.isBlank(dto.getId())) {
|
if (StrUtil.isBlank(dto.getId())) {
|
||||||
entrustAlterApply.setEntrustId(dto.getEntrustId());
|
entrustAlterApply.setEntrustId(dto.getEntrustId());
|
||||||
|
|||||||
@@ -79,15 +79,15 @@ public class EntrustAlterApplyVO {
|
|||||||
private String reviewerName;
|
private String reviewerName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过
|
* 状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过,9 申请已完成
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过")
|
@ApiModelProperty(value = "状态 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过,9 申请已完成")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态名称 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过
|
* 状态名称 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过,9 申请已完成
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "状态名称 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过")
|
@ApiModelProperty(value = "状态名称 === 0 待提交申请, 1 提交申请待审核,2申请通过,-1 申请不通过,9 申请已完成")
|
||||||
private String statusName;
|
private String statusName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user