更新
1.添加自定义校验异常抛出
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package digital.laboratory.platform.entrustment.controller;
|
package digital.laboratory.platform.entrustment.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import digital.laboratory.platform.common.core.exception.ValidateCodeException;
|
||||||
import digital.laboratory.platform.common.core.util.R;
|
import digital.laboratory.platform.common.core.util.R;
|
||||||
|
import digital.laboratory.platform.entrustment.dto.ApprovedUpdateEntrustDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
||||||
import digital.laboratory.platform.entrustment.query.EntrustAlterApplyQuery;
|
import digital.laboratory.platform.entrustment.query.EntrustAlterApplyQuery;
|
||||||
@@ -46,7 +48,7 @@ public class EntrustAlterApplyController {
|
|||||||
EntrustAlterApplyVO vo = null;
|
EntrustAlterApplyVO vo = null;
|
||||||
try {
|
try {
|
||||||
vo = entrustAlterApplyService.save(dto);
|
vo = entrustAlterApplyService.save(dto);
|
||||||
} catch (Exception e) {
|
} catch (ValidateCodeException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return R.failed(e.getMessage());
|
return R.failed(e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,13 @@ public class EntrustAlterApplyController {
|
|||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyEdit')") // 委托申请修改消息修改权限
|
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyEdit')") // 委托申请修改消息修改权限
|
||||||
public R update(@RequestBody @Valid EntrustAlterApplyDTO dto) {
|
public R update(@RequestBody @Valid EntrustAlterApplyDTO dto) {
|
||||||
Boolean success = entrustAlterApplyService.update(dto);
|
Boolean success = null;
|
||||||
|
try {
|
||||||
|
success = entrustAlterApplyService.update(dto);
|
||||||
|
} catch (ValidateCodeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return R.failed(e.getMessage());
|
||||||
|
}
|
||||||
return R.ok(success).setMsg(success ? "修改成功" : "修改失败");
|
return R.ok(success).setMsg(success ? "修改成功" : "修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +73,13 @@ public class EntrustAlterApplyController {
|
|||||||
@PutMapping("/approve")
|
@PutMapping("/approve")
|
||||||
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyApprove')") // 委托申请修改消息审核权限
|
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyApprove')") // 委托申请修改消息审核权限
|
||||||
public R approve(@RequestBody @Valid EntrustAlterApplyApproveDTO approveDTO) {
|
public R approve(@RequestBody @Valid EntrustAlterApplyApproveDTO approveDTO) {
|
||||||
Boolean success = entrustAlterApplyService.approve(approveDTO);
|
Boolean success = null;
|
||||||
|
try {
|
||||||
|
success = entrustAlterApplyService.approve(approveDTO);
|
||||||
|
} catch (ValidateCodeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return R.failed(e.getMessage());
|
||||||
|
}
|
||||||
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +87,21 @@ public class EntrustAlterApplyController {
|
|||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyDelete')") // 委托申请修改消息删除权限
|
@PreAuthorize("@pms.hasPermission('EntrustAlterApplyDelete')") // 委托申请修改消息删除权限
|
||||||
public R delete(@RequestBody List<String> ids) {
|
public R delete(@RequestBody List<String> ids) {
|
||||||
Boolean success = entrustAlterApplyService.delete(ids);
|
Boolean success = null;
|
||||||
|
try {
|
||||||
|
success = entrustAlterApplyService.delete(ids);
|
||||||
|
} catch (ValidateCodeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return R.failed(e.getMessage());
|
||||||
|
}
|
||||||
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
return R.ok(success).setMsg(success ? "审核成功" : "审核失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "审核通过后,调用该接口修改委托案件简要、鉴定要求,x", notes = "审核通过后,调用该接口修改委托案件简要、鉴定要求")
|
||||||
|
@PutMapping("/updateEntrust")
|
||||||
|
public R updateEntrust(@Valid @RequestBody ApprovedUpdateEntrustDTO dto) {
|
||||||
|
Boolean success = entrustAlterApplyService.updateEntrust(dto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package digital.laboratory.platform.entrustment.dto;
|
||||||
|
|
||||||
|
import digital.laboratory.platform.sys.entity.DrugLite;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "ApprovedUpdateEntrustDTO", description = "审批通过后,更新委托信息的DTO类")
|
||||||
|
public class ApprovedUpdateEntrustDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "申请id")
|
||||||
|
@NotBlank(message = "申请id不能为空!")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关联的委托id")
|
||||||
|
@NotBlank(message = "关联的委托id不能为空!")
|
||||||
|
private String entrustId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "案件简要")
|
||||||
|
private String caseBrief;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "委托检材列表")
|
||||||
|
private List<MaterialDTO> materialList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否完成, true:已完成(标记该申请已完成,该申请将不在允许修改), false:未完成(不改变状态)")
|
||||||
|
private Boolean finished;
|
||||||
|
|
||||||
|
// 使用内部类MaterialDTO
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "MaterialDTO", description = "委托检材")
|
||||||
|
class MaterialDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检材id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "检材名称(疑似物种类)")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分析项目 1.定性分析 2.定量分析 3.定性定量分析 4.关联性判断 5。其他")
|
||||||
|
private Integer analysisOption;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "候选毒品列表(drug 对象的 json array)")
|
||||||
|
private List<DrugLite> candidateDrugs;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import java.util.List;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -487,6 +488,7 @@ public class EntrustmentIdentificationMaterial extends BaseEntity {
|
|||||||
* 分析项目 定性分析,定量分析,定性定量分析,关联性判断 其他
|
* 分析项目 定性分析,定量分析,定性定量分析,关联性判断 其他
|
||||||
* 1.定性分析 2.定量分析 3.定性定量分析 4.关联性判断 5。其他
|
* 1.定性分析 2.定量分析 3.定性定量分析 4.关联性判断 5。其他
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "分析项目 1.定性分析 2.定量分析 3.定性定量分析 4.关联性判断 5。其他")
|
||||||
private Integer analysisOption;
|
private Integer analysisOption;
|
||||||
|
|
||||||
@ApiModelProperty(value = "将分析项目转为字符串类型")
|
@ApiModelProperty(value = "将分析项目转为字符串类型")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package digital.laboratory.platform.entrustment.service;
|
package digital.laboratory.platform.entrustment.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import digital.laboratory.platform.entrustment.dto.ApprovedUpdateEntrustDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustAlterApply;
|
import digital.laboratory.platform.entrustment.entity.EntrustAlterApply;
|
||||||
@@ -51,4 +52,11 @@ public interface EntrustAlterApplyService extends IService<EntrustAlterApply> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean delete(List<String> ids);
|
Boolean delete(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改委托案件简要、鉴定要求, 并删除已生成的鉴定事项确认书和委托书
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateEntrust(ApprovedUpdateEntrustDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import digital.laboratory.platform.common.core.exception.ValidateCodeException;
|
||||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
||||||
import digital.laboratory.platform.common.security.util.SecurityUtils;
|
import digital.laboratory.platform.common.security.util.SecurityUtils;
|
||||||
|
import digital.laboratory.platform.entrustment.dto.ApprovedUpdateEntrustDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyApproveDTO;
|
||||||
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
import digital.laboratory.platform.entrustment.dto.EntrustAlterApplyDTO;
|
||||||
import digital.laboratory.platform.entrustment.entity.EntrustAlterApply;
|
import digital.laboratory.platform.entrustment.entity.EntrustAlterApply;
|
||||||
@@ -64,7 +66,7 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
|
|||||||
if (CollUtil.isNotEmpty(preApplyInfo)) {
|
if (CollUtil.isNotEmpty(preApplyInfo)) {
|
||||||
List<EntrustAlterApply> unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList());
|
List<EntrustAlterApply> unfinishedList = preApplyInfo.stream().filter(e -> !e.getStatus().equals(EntrustAlterApplyStatus.FINISHED.getStatus())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(unfinishedList)) {
|
if (CollUtil.isNotEmpty(unfinishedList)) {
|
||||||
throw new RuntimeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
|
throw new ValidateCodeException("该委托存在未完成的申请信息,请先完成其他申请后再进行申请修改!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,19 +97,37 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
|
|||||||
return entrustAlterApplyVOOne;
|
return entrustAlterApplyVOOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批委托申请修改
|
||||||
|
* @param approveDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean approve(EntrustAlterApplyApproveDTO approveDTO) {
|
public Boolean approve(EntrustAlterApplyApproveDTO approveDTO) {
|
||||||
if (approveDTO.getOpCode() == 0) {
|
// 判断当前申请是否在可以审核的状态
|
||||||
// 拒绝
|
EntrustAlterApply entrustAlterApply = super.getById(approveDTO.getId());
|
||||||
return super.update(Wrappers.<EntrustAlterApply>lambdaUpdate().eq(EntrustAlterApply::getId, approveDTO.getId())
|
if (entrustAlterApply == null) {
|
||||||
.set(EntrustAlterApply::getStatus, EntrustAlterApplyStatus.APPLY_FAIL.getStatus())
|
throw new ValidateCodeException("申请记录不存在!");
|
||||||
.set(EntrustAlterApply::getReason,approveDTO.getReason()));
|
|
||||||
} else {
|
|
||||||
// 同意
|
|
||||||
return super.update(Wrappers.<EntrustAlterApply>lambdaUpdate().eq(EntrustAlterApply::getId, approveDTO.getId())
|
|
||||||
.set(EntrustAlterApply::getStatus, EntrustAlterApplyStatus.APPLY_SUCCESS.getStatus())
|
|
||||||
.set(EntrustAlterApply::getReason,approveDTO.getReason()));
|
|
||||||
}
|
}
|
||||||
|
if (!entrustAlterApply.getStatus().equals(EntrustAlterApplyStatus.SUBMITTED_WAIT_APPROVE.getStatus())) {
|
||||||
|
throw new ValidateCodeException("当前申请状态不允许审核!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接根据opCode设置状态
|
||||||
|
EntrustAlterApplyStatus status;
|
||||||
|
if (approveDTO.getOpCode() == 0) {
|
||||||
|
status = EntrustAlterApplyStatus.APPLY_FAIL;
|
||||||
|
} else {
|
||||||
|
status = EntrustAlterApplyStatus.APPLY_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并重复的update操作
|
||||||
|
return super.update(
|
||||||
|
Wrappers.<EntrustAlterApply>lambdaUpdate()
|
||||||
|
.eq(EntrustAlterApply::getId, approveDTO.getId())
|
||||||
|
.set(EntrustAlterApply::getStatus, status.getStatus())
|
||||||
|
.set(EntrustAlterApply::getReason, approveDTO.getReason())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,11 +138,11 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
|
|||||||
@Override
|
@Override
|
||||||
public Boolean update(EntrustAlterApplyDTO dto) {
|
public Boolean update(EntrustAlterApplyDTO dto) {
|
||||||
if(StrUtil.isBlank(dto.getId())){
|
if(StrUtil.isBlank(dto.getId())){
|
||||||
throw new RuntimeException("修改的记录id不能为空");
|
throw new ValidateCodeException("修改的记录id不能为空");
|
||||||
}
|
}
|
||||||
EntrustAlterApply oldInfo = super.getById(dto.getId());
|
EntrustAlterApply oldInfo = super.getById(dto.getId());
|
||||||
if (dto.getOpCode() == 1 && oldInfo.getStatus().equals(EntrustAlterApplyStatus.SUBMITTED_WAIT_APPROVE.getStatus())) {
|
if (dto.getOpCode() == 1 && oldInfo.getStatus().equals(EntrustAlterApplyStatus.SUBMITTED_WAIT_APPROVE.getStatus())) {
|
||||||
throw new RuntimeException("该条记录不在可撤销的状态范围内!");
|
throw new ValidateCodeException("该条记录不在可撤销的状态范围内!");
|
||||||
}
|
}
|
||||||
return super.update(Wrappers.<EntrustAlterApply>lambdaUpdate().eq(EntrustAlterApply::getId, dto.getId())
|
return super.update(Wrappers.<EntrustAlterApply>lambdaUpdate().eq(EntrustAlterApply::getId, dto.getId())
|
||||||
.set(EntrustAlterApply::getEntrustId, dto.getEntrustId())
|
.set(EntrustAlterApply::getEntrustId, dto.getEntrustId())
|
||||||
@@ -138,15 +158,20 @@ public class EntrustAlterApplyServiceImpl extends ServiceImpl<EntrustAlterApplyM
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean delete(List<String> ids) {
|
public Boolean delete(List<String> ids) {
|
||||||
List<EntrustAlterApplyVO> entrustAlterAppliesVOS = baseMapper.getEntrustAlterApplyVOList(Wrappers.<EntrustAlterApply>lambdaQuery().in(EntrustAlterApply::getId,ids));
|
List<EntrustAlterApplyVO> entrustAlterAppliesVOS = baseMapper.getEntrustAlterApplyVOList(Wrappers.<EntrustAlterApply>query().in("eaa.id",ids));
|
||||||
entrustAlterAppliesVOS.forEach(e -> {
|
entrustAlterAppliesVOS.forEach(e -> {
|
||||||
if (e.getStatus().equals(EntrustAlterApplyStatus.WAIT_SUBMIT_APPLY.getStatus())) {
|
if (e.getStatus().equals(EntrustAlterApplyStatus.WAIT_SUBMIT_APPLY.getStatus())) {
|
||||||
throw new RuntimeException(String.format("案件名称为 %s 的记录不在可删除的状态,无法删除!", e.getCaseName()));
|
throw new ValidateCodeException(String.format("案件名称为 %s 的记录不在可删除的状态,无法删除!", e.getCaseName()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return super.remove(Wrappers.<EntrustAlterApply>lambdaUpdate().in(EntrustAlterApply::getId,ids));
|
return super.remove(Wrappers.<EntrustAlterApply>lambdaUpdate().in(EntrustAlterApply::getId,ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateEntrust(ApprovedUpdateEntrustDTO dto) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填充VO信息
|
* 填充VO信息
|
||||||
* @param e
|
* @param e
|
||||||
|
|||||||
Reference in New Issue
Block a user