|
@@ -1,5 +1,6 @@
|
|
|
package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound;
|
|
|
|
|
|
+import cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper;
|
|
|
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import javax.annotation.Resource;
|
|
@@ -44,6 +45,8 @@ public class SpecimenOutboundController {
|
|
|
private SpecimenOutboundService specimenOutboundService;
|
|
|
@Resource
|
|
|
private PermissionApi permissionApi;
|
|
|
+ @Resource
|
|
|
+ private SpecimenOutboundMapper specimenOutboundMapper;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建标本出库申请")
|
|
@@ -86,12 +89,19 @@ public class SpecimenOutboundController {
|
|
|
@Operation(summary = "修改标本出库信息")
|
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:update')")
|
|
|
public CommonResult<Boolean> recompileSpecimenOutbound(@Valid @RequestBody SpecimenOutboundSaveReqVO updateReqVO) {
|
|
|
+ // 从数据库获取当前标本出库信息
|
|
|
+ SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(updateReqVO.getId());
|
|
|
+ if (specimenOutbound == null) {
|
|
|
+ throw exception(SPECIMEN_OUTBOUND_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ int currentStatus = specimenOutbound.getStatus();
|
|
|
+
|
|
|
// 校验状态
|
|
|
- if (updateReqVO.getStatus() == 0 || updateReqVO.getStatus() == 2 || updateReqVO.getStatus() == 6) {
|
|
|
- // 根据状态更新
|
|
|
- if (updateReqVO.getStatus() == 2) {
|
|
|
+ if (currentStatus == 0 || currentStatus == 2 || currentStatus == 6) {
|
|
|
+ // 根据当前状态更新
|
|
|
+ if (currentStatus == 2) {
|
|
|
updateReqVO.setStatus(0); // 编辑后将状态变为0
|
|
|
- } else if (updateReqVO.getStatus() == 6) {
|
|
|
+ } else if (currentStatus == 6) {
|
|
|
updateReqVO.setStatus(1); // 编辑后将状态变为1
|
|
|
}
|
|
|
// 调用服务层更新方法
|
|
@@ -102,6 +112,7 @@ public class SpecimenOutboundController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@PostMapping("/confirmOutbound")
|
|
|
@Operation(summary = "确认标本出库")
|
|
|
@PreAuthorize("@ss.hasPermission('museums:specimen-outbound:confirm')")
|