Browse Source

做了标本管理模块的日志,优化了标本审批、新增了一个审批前或审批驳回修改标本出库信息的接口

hyy 9 months ago
parent
commit
a0226755b1

+ 26 - 0
yudao-module-museums/yudao-module-museums-api/src/main/java/cn/iocoder/yudao/module/museums/enums/social/LogRecordConstants.java

@@ -0,0 +1,26 @@
+package cn.iocoder.yudao.module.museums.enums.social;
+
+/**
+ * Museums 操作日志枚举
+ * 目的:统一管理,也减少 Service 里各种“复杂”字符串
+ *
+ * @author 芋道源码
+ */
+public interface LogRecordConstants {
+
+    // ======================= MUSEUMS_SPECIMEN 标本 =======================
+
+    String MUSEUMS_SPECIMEN_TYPE = "MUSEUMS 标本";
+    String MUSEUMS_SPECIMEN_CREATE_SUB_TYPE = "创建标本";
+    String MUSEUMS_SPECIMEN_CREATE_SUCCESS = "创建了标本【{{#specimenInfo.specimenNumber}}】";
+    String MUSEUMS_SPECIMEN_UPDATE_SUB_TYPE = "更新标本";
+    String MUSEUMS_SPECIMEN_UPDATE_SUCCESS = "更新了标本【{{#updateReqVO.specimenNumber}}】: {_DIFF{#updateReqVO}}";
+    String MUSEUMS_SPECIMEN_DELETE_SUB_TYPE = "删除标本";
+    String MUSEUMS_SPECIMEN_DELETE_SUCCESS = "删除了标本【编号: {{#specimenNumber}}】, 理由: {{#deletedReason}}";
+
+    // ======================= SPECIMEN 导入 =======================
+    String SPECIMEN_IMPORT_TYPE = "标本导入";
+    String SPECIMEN_IMPORT_SUB_TYPE = "导入标本";
+    String SPECIMEN_IMPORT_SUCCESS = "成功导入标本,总数量: {{#totalImported}}";
+
+}

+ 3 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimeninfo/vo/SpecimenImportRespVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo;
 
+import com.mzt.logapi.starter.annotation.DiffLogField;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Builder;
 import lombok.Data;
@@ -13,9 +14,11 @@ import java.util.Map;
 public class SpecimenImportRespVO {
 
     @Schema(description = "创建成功的标本编号数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    @DiffLogField(name = "创建成功的标本编号")
     private List<String> createSpecimenNumbers;
 
     @Schema(description = "更新成功的标本编号数组", requiredMode = Schema.RequiredMode.REQUIRED)
+    @DiffLogField(name = "更新成功的标本编号")
     private List<String> updateSpecimenNumbers;
 
     @Schema(description = "导入失败的标本集合,key 为标本编号,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)

+ 9 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimeninfo/vo/SpecimenInfoSaveReqVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo;
 
+import com.mzt.logapi.starter.annotation.DiffLogField;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import java.util.*;
@@ -17,22 +18,27 @@ public class SpecimenInfoSaveReqVO {
 
     @Schema(description = "标本类型(矿物、岩石矿石、化石、陨石)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
     @NotNull(message = "标本类型(矿物、岩石矿石、化石、陨石)不能为空")
+    @DiffLogField(name = "标本类型")
     private Integer specimenType;
 
     @Schema(description = "标本编号", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotEmpty(message = "标本编号不能为空")
+    @DiffLogField(name = "标本编号")
     private String specimenNumber;
 
     @Schema(description = "资产号")
     private String assetNumber;
 
     @Schema(description = "存放位置")
+    @DiffLogField(name = "存放位置")
     private String storageLocation;
 
     @Schema(description = "中文名称", example = "赵六")
+    @DiffLogField(name = "中文名称")
     private String chineseName;
 
     @Schema(description = "英文名称", example = "Maven")
+    @DiffLogField(name = "英文名称")
     private String englishName;
 
     @Schema(description = "成分")
@@ -75,6 +81,7 @@ public class SpecimenInfoSaveReqVO {
     private String description;
 
     @Schema(description = "馆藏状态(在馆、借出、展陈)", example = "2")
+    @DiffLogField(name = "馆藏状态")
     private Integer collectionStatus;
 
     @Schema(description = "备注")
@@ -102,9 +109,11 @@ public class SpecimenInfoSaveReqVO {
     private LocalDateTime acquisitionTime;
 
     @Schema(description = "注销原因", example = "坏了")
+    @DiffLogField(name = "注销原因")
     private String deletedReason;
 
     @Schema(description = "标本数量")
+    @DiffLogField(name = "标本数量")
     private String specimenAmount;
 
     @Schema(description = "标本价格")

+ 25 - 99
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/SpecimenOutboundController.java

@@ -61,57 +61,8 @@ public class SpecimenOutboundController {
         return success(true);
     }
 
-
-//    @PostMapping("/approveFirst")
-//    @Operation(summary = "一审通过")
-//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:approveFirst')")
-//    public CommonResult<Void> approveFirstSpecimenOutbound(@RequestBody SpecimenOutboundApprovalReqVO req) {
-//        req.setApproveUsers(getLoginUserId()); // 获取操作员ID
-//
-//        req.setApprovalTime(LocalDateTime.now()); // 设置当前时间
-//        req.setStatus(1); // 设置审批状态为一审通过
-//        specimenOutboundService.updateStatus(req);
-//        return success(null);
-//    }
-//    @PostMapping("/approveSecond")
-//    @Operation(summary = "二审通过")
-//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:approveSecond')")
-//    public CommonResult<Void> approveSecondSpecimenOutbound(@RequestBody SpecimenOutboundApprovalReqVO req) {
-//        req.setTwoApproveUsers(getLoginUserId()); // 获取二审操作员ID
-//        req.setTwoApprovalTime(LocalDateTime.now()); // 设置当前时间
-//        req.setStatus(5); // 设置审批状态为二审通过
-//        specimenOutboundService.updateStatus(req);
-//        return success(null);
-//    }
-
-//    @PostMapping("/approve")
-//    @Operation(summary = "审批")
-//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:approve')")
-//    public CommonResult<Void> approveSpecimenOutbound(@RequestBody SpecimenOutboundApprovalReqVO req) {
-//        // 获取当前操作员ID
-//        Long operatorId = getLoginUserId();
-//        LocalDateTime now = LocalDateTime.now();
-//
-//        // 验证审批类型
-//        if (req.getStatus() == 1 || req.getStatus() == 2) {
-//            // 一审逻辑
-//            req.setApproveUsers(operatorId);
-//            req.setApprovalTime(now);
-//        } else if (req.getStatus() == 5 || req.getStatus() == 6) {
-//            // 二审逻辑
-//            req.setTwoApproveUsers(operatorId);
-//            req.setTwoApprovalTime(now);
-//        } else {
-//            throw new IllegalArgumentException("无效的审批状态");
-//        }
-//
-//        // 调用更新状态方法
-//        specimenOutboundService.updateStatus(req);
-//        return success(null);
-//    }
-
     @PostMapping("/approve")
-    @Operation(summary = "审批")
+    @Operation(summary = "标本出库审批")
     @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:approve')")
     public CommonResult<Void> approveSpecimenOutbound(@RequestBody SpecimenOutboundApprovalReqVO req) {
         Long operatorId = getLoginUserId();
@@ -120,16 +71,16 @@ public class SpecimenOutboundController {
         // 验证审批类型
         if (req.getStatus() == 1 || req.getStatus() == 2) {
             // 一审逻辑
-            if (!permissionApi.hasAnyRoles(operatorId, "deputy_leader")) {
-                throw new IllegalArgumentException("用户没有一审权限");
-            }
+//            if (!permissionApi.hasAnyRoles(operatorId, "deputy_leader")) {
+//                throw new IllegalArgumentException("用户没有一审权限");
+//            }
             req.setApproveUsers(operatorId);
             req.setApprovalTime(now);
         } else if (req.getStatus() == 5 || req.getStatus() == 6) {
             // 二审逻辑
-            if (!permissionApi.hasAnyRoles(operatorId, "leadership")) {
-                throw new IllegalArgumentException("用户没有二审权限");
-            }
+//            if (!permissionApi.hasAnyRoles(operatorId, "leadership")) {
+//                throw new IllegalArgumentException("用户没有二审权限");
+//            }
             req.setTwoApproveUsers(operatorId);
             req.setTwoApprovalTime(now);
         } else {
@@ -140,35 +91,27 @@ public class SpecimenOutboundController {
         return success(null);
     }
 
-    @PostMapping("/rejectFirst")
-    @Operation(summary = "一审驳回")
-    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:rejectFirst')")
-    public CommonResult<Void> rejectFirstSpecimenOutbound(@Valid @RequestBody SpecimenOutboundApprovalReqVO req) {
-        req.setApproveUsers(getLoginUserId()); // 获取操作员ID
-        req.setApprovalTime(LocalDateTime.now()); // 设置当前时间
-        req.setStatus(2); // 设置审批状态为一审驳回
-        specimenOutboundService.updateStatus(req);
-        return success(null);
+    @PutMapping("/recompile")
+    @Operation(summary = "修改标本出库信息")
+    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:update')")
+    public CommonResult<Boolean> recompileSpecimenOutbound(@Valid @RequestBody SpecimenOutboundSaveReqVO updateReqVO) {
+        // 校验状态
+        if (updateReqVO.getStatus() == 0 || updateReqVO.getStatus() == 2 || updateReqVO.getStatus() == 6) {
+            // 根据状态更新
+            if (updateReqVO.getStatus() == 2) {
+                updateReqVO.setStatus(0); // 编辑后将状态变为0
+            } else if (updateReqVO.getStatus() == 6) {
+                updateReqVO.setStatus(1); // 编辑后将状态变为1
+            }
+            // 调用服务层更新方法
+            specimenOutboundService.recompileSpecimenOutbound(updateReqVO);
+            return success(true);
+        } else {
+            throw new IllegalArgumentException("无效的审批状态,无法编辑");
+        }
     }
 
-    @PostMapping("/rejectSecond")
-    @Operation(summary = "二审驳回")
-    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:rejectSecond')")
-    public CommonResult<Void> rejectSecondSpecimenOutbound(@Valid @RequestBody SpecimenOutboundApprovalReqVO req) {
-        req.setTwoApproveUsers(getLoginUserId()); // 获取二审操作员ID
-        req.setTwoApprovalTime(LocalDateTime.now()); // 设置当前时间
-        req.setStatus(6); // 设置审批状态为二审驳回
-        specimenOutboundService.updateStatus(req);
-        return success(null);
-    }
 
-//    @GetMapping("/confirmOutbound")
-//    @Operation(summary = "确认标本出库")
-//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:confirm')")
-//    public CommonResult<Boolean> confirmOutbound(@RequestParam("id")  Long id) {
-//        specimenOutboundService.confirmOutbound(id, getLoginUserId());
-//        return success(true);
-//    }
     @PostMapping("/confirmOutbound")
     @Operation(summary = "确认标本出库")
     @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:confirm')")
@@ -237,15 +180,6 @@ public class SpecimenOutboundController {
 
     //工作台
     //根据出库的登记情况统计本年标本出库信息。
-//    @GetMapping("/statistics/outgoing/{year}")
-//    @Operation(summary = "根据出库登记情况统计本年标本出库信息")
-//    @Parameter(name = "year", description = "年份", required = true, example = "2024")
-//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
-//    public CommonResult<List<SpecimenOutboundOutgoingReqVO>> getOutboundStatistics(@PathVariable int year) {
-//        List<SpecimenOutboundOutgoingReqVO> outboundStatistics = specimenOutboundService.getOutboundStatistics(year);
-//        return success(outboundStatistics);
-//    }
-
     @GetMapping("/statistics/outgoing/{year}")
     @Operation(summary = "根据出库登记情况统计本年标本出库信息")
     @Parameter(name = "year", description = "年份", required = true, example = "2024")
@@ -269,14 +203,6 @@ public class SpecimenOutboundController {
         return success(response);
     }
 
-
-//    @GetMapping("/statistics/return/{year}")
-//    @Operation(summary = "统计本年标本回库信息")
-//    @Parameter(name = "year", description = "年份", required = true, example = "2024")
-//    public CommonResult<List<SpecimenOutboundReturnReqVO>> getReturnStatistics(@PathVariable int year) {
-//        List<SpecimenOutboundReturnReqVO> result = specimenOutboundService.getReturnStatistics(year);
-//        return success(result);
-//    }
     @GetMapping("/statistics/return/{year}")
     @Operation(summary = "根据回库登记情况统计本年标本回库信息")
     @Parameter(name = "year", description = "年份", required = true, example = "2024")

+ 3 - 3
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/vo/SpecimenOutboundSaveReqVO.java

@@ -7,7 +7,7 @@ import javax.validation.constraints.*;
 import org.springframework.format.annotation.DateTimeFormat;
 import java.time.LocalDateTime;
 
-@Schema(description = "管理后台 - 标本出库回库信息新增/修改 Request VO")
+@Schema(description = "管理后台 - 标本出库单填写/修改 Request VO")
 @Data
 public class SpecimenOutboundSaveReqVO {
 
@@ -40,8 +40,8 @@ public class SpecimenOutboundSaveReqVO {
     @Schema(description = "出库附件上传")
     private String attachments;
 
-//    @Schema(description = "审批状态", example = "2")
-//    private Integer status;
+    @Schema(description = "审批状态", example = "2")
+    private Integer status;
 
     @Schema(description = "备注信息")
     private String remarks;

+ 0 - 7
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/dal/mysql/specimeninfo/SpecimenInfoMapper.java

@@ -161,13 +161,6 @@ public interface SpecimenInfoMapper extends BaseMapperX<SpecimenInfoDO> {
      */
     void updateDeletedReasonById(@Param("id") Integer id, @Param("deletedReason") String deletedReason);
 
-    /**
-     * 将记录标记为删除
-     *
-     * @param id 编号
-     */
-    void markAsDeletedById(@Param("id") Integer id);
-
     boolean existsByNumber(String number);
 
 

+ 57 - 7
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimeninfo/SpecimenInfoServiceImpl.java

@@ -5,9 +5,12 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 import cn.iocoder.yudao.module.infra.api.file.FileApi;
 import cn.iocoder.yudao.module.museums.dal.dataobject.specimenoutbound.SpecimenOutboundDO;
 import cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper;
+import cn.iocoder.yudao.module.museums.enums.social.LogRecordConstants;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.mzt.logapi.context.LogRecordContext;
+import com.mzt.logapi.starter.annotation.LogRecord;
 import org.apache.tomcat.util.http.fileupload.FileUtils;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
@@ -31,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.*;
+import static cn.iocoder.yudao.module.museums.enums.social.LogRecordConstants.*;
 
 /**
  * 标本管理 Service 实现类
@@ -53,6 +57,9 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
+    @LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_CREATE_SUB_TYPE, bizNo = "{{#specimenInfo.id}}",
+            success = MUSEUMS_SPECIMEN_CREATE_SUCCESS)
     public String createSpecimenInfo(SpecimenInfoSaveReqVO createReqVO) {
         // 校验标本编号是否已存在
         if (specimenInfoMapper.existsByNumber(createReqVO.getSpecimenNumber())) {
@@ -61,32 +68,61 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         // 插入新标本信息
         SpecimenInfoDO specimenInfo = BeanUtils.toBean(createReqVO, SpecimenInfoDO.class);
         specimenInfoMapper.insert(specimenInfo);
+
+        // 记录操作日志上下文
+        LogRecordContext.putVariable("specimenInfo", specimenInfo);
+
         // 返回新创建的标本ID
-        return "标本创建成功"+specimenInfo.getId();
+        return "标本创建成功 " + specimenInfo.getId();
     }
 
+
+//    @Override
+//    public void updateSpecimenInfo(SpecimenInfoSaveReqVO updateReqVO) {
+//        // 校验存在
+//        validateSpecimenInfoExists(updateReqVO.getId());
+//        // 更新
+//        SpecimenInfoDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenInfoDO.class);
+//        specimenInfoMapper.updateById(updateObj);
+//    }
+
     @Override
+    @LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}",
+            success = MUSEUMS_SPECIMEN_UPDATE_SUCCESS)
     public void updateSpecimenInfo(SpecimenInfoSaveReqVO updateReqVO) {
         // 校验存在
         validateSpecimenInfoExists(updateReqVO.getId());
+
         // 更新
         SpecimenInfoDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenInfoDO.class);
         specimenInfoMapper.updateById(updateObj);
-    }
 
+        // 记录操作日志上下文
+        LogRecordContext.putVariable("update-specimen", updateObj);
+    }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
+    @LogRecord(type = MUSEUMS_SPECIMEN_TYPE, subType = MUSEUMS_SPECIMEN_DELETE_SUB_TYPE, bizNo = "{{#id}}",
+            success = MUSEUMS_SPECIMEN_DELETE_SUCCESS)
     public void deleteSpecimenInfo(Integer id, String deletedReason) {
         // 校验存在
         validateSpecimenInfoExists(id);
 
+        // 获取标本信息
+        SpecimenInfoDO specimenInfo = specimenInfoMapper.selectById(id); // 假设有这个方法可以根据ID查找标本
+        String specimenNumber = specimenInfo.getSpecimenNumber(); // 获取标本编号
+
         // 更新注销原因
         specimenInfoMapper.updateDeletedReasonById(id, deletedReason);
 
         // 进行逻辑删除
-        specimenInfoMapper.markAsDeletedById(id); // 这是假设你已经有一个方法来标记为删除
-    }
+        specimenInfoMapper.deleteById(id); // 这是假设你已经有一个方法来标记为删除
 
+        // 记录操作日志上下文
+        LogRecordContext.putVariable("deletedReason", deletedReason);
+        LogRecordContext.putVariable("specimenNumber", specimenNumber);
+    }
 
     private void validateSpecimenInfoExists(Integer id) {
         if (specimenInfoMapper.selectById(id) == null) {
@@ -104,9 +140,13 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         return specimenInfoMapper.selectPage(pageReqVO);
     }
 
-    //标本Excel的批量导入
+    // 标本Excel的批量导入
     @Override
     @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
+//    @LogRecord(type = SPECIMEN_IMPORT_TYPE,
+//            subType = SPECIMEN_IMPORT_SUB_TYPE,
+//            bizNo = "{{#specimenNumbers}}",
+//            success = SPECIMEN_IMPORT_SUCCESS)
     public SpecimenImportRespVO importSpecimenList(List<SpecimenImportExcelVO> importSpecimens, boolean isUpdateSupport) {
         // 1.1 参数校验
         if (CollUtil.isEmpty(importSpecimens)) {
@@ -139,7 +179,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
                 return;
             }
 
-//             2.2.2 如果存在,判断是否允许更新
+            // 2.2.2 如果存在,判断是否允许更新
             if (!isUpdateSupport) {
                 respVO.getFailureSpecimenNumbers().put(importSpecimen.getSpecimenNumber(), "标本编号已存在,且不支持更新");
                 return;
@@ -152,10 +192,20 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
             respVO.getUpdateSpecimenNumbers().add(importSpecimen.getSpecimenNumber());
         });
 
+//        // 记录成功导入的标本编号到日志上下文
+//        LogRecordContext.putVariable("specimenNumbers", String.join(", ", respVO.getCreateSpecimenNumbers()));
+//        LogRecordContext.putVariable("updateSpecimenNumbers", String.join(", ", respVO.getUpdateSpecimenNumbers()));
+//
+//        // 记录操作日志上下文
+//        LogRecordContext.putVariable("totalImported", respVO.getCreateSpecimenNumbers().size() + respVO.getUpdateSpecimenNumbers().size());
+
         return respVO;
     }
+
     private boolean isValidImageName(String imageNames) {
-        if (imageNames == null) return false;
+        if (imageNames == null || imageNames.trim().isEmpty()) {
+            return true; // 如果图片名称为空或仅含空格,则视为通过校验
+        }
         String[] names = imageNames.split(",");
         for (String name : names) {
             if (!name.matches(".+\\.(jpg|jpeg|png)$")) {

+ 7 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimenoutbound/SpecimenOutboundService.java

@@ -70,6 +70,13 @@ public interface SpecimenOutboundService {
      */
     PageResult<SpecimenOutboundDO> getSpecimenOutboundPage(SpecimenOutboundPageReqVO pageReqVO);
 
+    /**
+     * 标本重新编辑
+     *
+     * @param updateReqVO 更新信息
+     */
+    void recompileSpecimenOutbound(@Valid SpecimenOutboundSaveReqVO updateReqVO);
+
     void updateStatus(SpecimenOutboundApprovalReqVO req);
 
     //工作台

+ 12 - 27
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimenoutbound/SpecimenOutboundServiceImpl.java

@@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.museums.dal.dataobject.specimeninfo.SpecimenInfoD
 import cn.iocoder.yudao.module.museums.dal.mysql.specimeninfo.SpecimenInfoMapper;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
 import org.springframework.validation.annotation.Validated;
 
@@ -128,35 +129,16 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
         }
     }
 
+    @Override
+    public void recompileSpecimenOutbound(@Valid SpecimenOutboundSaveReqVO updateReqVO) {
+        // 校验存在
+        validateSpecimenOutboundExists(updateReqVO.getId());
+        // 更新
+        SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
+        specimenOutboundMapper.updateById(updateObj);
+    }
 
     //出库审批
-//    @Override
-//    public void updateStatus(SpecimenOutboundApprovalReqVO req) {
-//        // 从数据库获取标本出库记录
-//        SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(req.getId());
-//
-//        // 判断状态是否为审批中状态(0)
-//        if (specimenOutbound == null || specimenOutbound.getStatus() != 0) {
-//            throw new IllegalStateException("只有状态为审批中的标本才能进行审批");
-//        }
-//
-//        // 更新状态
-//        specimenOutbound.setStatus(req.getStatus());
-//        if (req.getStatus() == 1) { // 审批通过
-//            specimenOutbound.setApprovalTime(req.getApprovalTime()); // 设置当前审批时间
-//        } else if (req.getStatus() == 2) { // 审批驳回
-//            specimenOutbound.setProcessInstanceId(req.getProcessInstanceId());
-//            specimenOutbound.setApprovalTime(req.getApprovalTime()); // 设置当前驳回时间
-//        }
-//
-//        // TODO 获取用户的id有现成的方法
-//        //  specimenOutbound.setApproveUsers(getLoginUserId()); // 设置操作员 ID
-//        specimenOutbound.setApproveUsers(getLoginUserId()); // 设置操作员 ID
-//
-//        // 更新数据库
-//        specimenOutboundMapper.updateById(specimenOutbound);
-//    }
-
     @Override
     public void updateStatus(SpecimenOutboundApprovalReqVO req) {
         // 从数据库获取标本出库记录
@@ -201,6 +183,9 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     }
 
 
+
+
+
     //确认出库,已经简化
     @Override
     public String confirmOutbound(Long id, Long operator) {