2 次代码提交 f3a5ca56bd ... 777fb472a0

作者 SHA1 备注 提交日期
  hyy 777fb472a0 Merge branch 'master' of http://gogs.gisvg.com/YDM/museums 2 月之前
  hyy e3d042513e 回库两人确认 2 月之前

+ 1 - 0
yudao-module-museums/yudao-module-museums-api/src/main/java/cn/iocoder/yudao/module/museums/enums/ErrorCodeConstants.java

@@ -34,6 +34,7 @@ public class ErrorCodeConstants {
     public static final ErrorCode ONLY_PASSED_SECOND_INSTANCE_OUTBOUND = new ErrorCode(1-016-001-010, "仅二审通过状态的标本可确认出库");
     public static final ErrorCode ONLY_OUTBOUND_SPECIMEN_CAN_RETURNED = new ErrorCode(1-016-001-010, "只有已出库状态的标本出库单才能进行回库操作");
     public static final ErrorCode YOU_HAVE_CONFIRMED_THAT_SPECIMEN = new ErrorCode(1-016-001-010, "您已经确认过该标本出库");
+    public static final ErrorCode YOU_HAVE_CONFIRMED_THAT_SPECIMEN_RETURNED = new ErrorCode(1-016-001-010, "您已经确认过该标本出库");
 
     // ========== 博物馆照片组 1-016-002-000 ==========
     public static final ErrorCode PHOTO_GROUP_NOT_EXISTS = new ErrorCode(1-016-002-000, "博物馆照片组记录不存在");

+ 7 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/vo/SpecimenOutboundPageReqVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.*;
 import io.swagger.v3.oas.annotations.media.Schema;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
@@ -83,6 +84,12 @@ public class SpecimenOutboundPageReqVO extends PageParam {
 
     @Schema(description = "点收人")
     private String receiver;
+
+    @Schema(description = "一回库确认员")
+    private String returnConfirm;
+
+    @Schema(description = "二回库确认员")
+    private String twoReturnConfirm;
     
     @Schema(description = "退还日期")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

+ 8 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/vo/SpecimenOutboundRespVO.java

@@ -110,6 +110,14 @@ public class SpecimenOutboundRespVO {
     @ExcelProperty("退还日期")
     private LocalDateTime returnDate;
 
+    @Schema(description = "一回库确认员")
+    @ExcelProperty("一回库确认员")
+    private String returnConfirm;
+
+    @Schema(description = "二回库确认员")
+    @ExcelProperty("二回库确认员")
+    private String twoReturnConfirm;
+
     @Schema(description = "一审时间")
     @ExcelProperty("一审时间")
     private LocalDateTime approvalTime;

+ 7 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/vo/SpecimenOutboundReturnReqVO.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import java.util.*;
@@ -29,4 +30,10 @@ public class SpecimenOutboundReturnReqVO {
 
     @Schema(description = "回库附件上传")
     private String sampleStatus;
+
+    @Schema(description = "一回库确认员")
+    private String returnConfirm;
+
+    @Schema(description = "二回库确认员")
+    private String twoReturnConfirm;
 }

+ 8 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/vo/SpecimenOutboundWithInfoRespVO.java

@@ -94,6 +94,14 @@ public class SpecimenOutboundWithInfoRespVO {
     @ExcelProperty("退还日期")
     private LocalDateTime returnDate;
 
+    @Schema(description = "一回库确认员")
+    @ExcelProperty("一回库确认员")
+    private String returnConfirm;
+
+    @Schema(description = "二回库确认员")
+    @ExcelProperty("二回库确认员")
+    private String twoReturnConfirm;
+
     @Schema(description = "一审时间")
     @ExcelProperty("一审时间")
     private LocalDateTime approvalTime;

+ 8 - 0
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/dal/dataobject/specimenoutbound/SpecimenOutboundDO.java

@@ -118,6 +118,14 @@ public class SpecimenOutboundDO extends BaseDO {
      * 退还日期
      */
     private LocalDateTime returnDate;
+    /**
+     * 一回库确认员
+     */
+    private Long returnConfirm;
+    /**
+     * 二回库确认员
+     */
+    private Long twoReturnConfirm;
     /**
      * 一审时间
      */

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

@@ -342,6 +342,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
             //记录日志上下文
             String operatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getOperator());
             String twoOperatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getTwoOperator());
+            LogRecordContext.putVariable("existingSpecimen", existingSpecimen);
             LogRecordContext.putVariable("operatorNickname", operatorNickname);
             LogRecordContext.putVariable("twoOperatorNickname", twoOperatorNickname);
             LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
@@ -385,36 +386,51 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
             throw exception(ONLY_OUTBOUND_SPECIMEN_CAN_RETURNED);
         }
 
-        SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
-        updateObj.setStatus(4).setReturnDate(LocalDateTime.now()); // 设置回库时间为当前时间
+           // 判断是否已经填写回库表单
+        if (existingSpecimen.getReturnConfirm() == null) {
+            // 如果回库表单为空,则更新回库单
+            SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
+            updateObj.setReturnConfirm(getLoginUserId());
+            // 更新数据库
+            specimenOutboundMapper.updateById(updateObj);
 
-        // 更新数据库
-        specimenOutboundMapper.updateById(updateObj);
+        } else if(existingSpecimen.getTwoReturnConfirm() == null){
 
-        String infoIdString = existingSpecimen.getInfoId();
-        infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
-        String[] infoIds = infoIdString.split(","); // 按逗号分割
+            // 检查是否和第一个出库确认员相同
+            if (existingSpecimen.getReturnConfirm().equals(getLoginUserId())) {
+                throw exception(YOU_HAVE_CONFIRMED_THAT_SPECIMEN_RETURNED);
+            }
+            // 更新数据库
+            SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
+            updateObj.setTwoReturnConfirm(getLoginUserId())
+                    .setStatus(4).setReturnDate(LocalDateTime.now()); // 设置回库时间为当前时间
+            specimenOutboundMapper.updateById(updateObj);
 
-        // 更新所有标本信息的馆藏状态为0(在馆)
-        for (String infoId : infoIds) {
-            specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 0);
-        }
-        // 记录日志上下文
-        LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
+            String infoIdString = existingSpecimen.getInfoId();
+            infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
+            String[] infoIds = infoIdString.split(","); // 按逗号分割
 
-        //发送站内信
-        String templateCode = "specimen_return_request_approved";
-        Map<String, Object> templateParams = new HashMap<>();
+            // 更新所有标本信息的馆藏状态为0(在馆)
+            for (String infoId : infoIds) {
+                specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 0);
+            }
+            // 记录日志上下文
+            LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
 
-        // 定义格式化模板
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            //发送站内信
+            String templateCode = "specimen_return_request_approved";
+            Map<String, Object> templateParams = new HashMap<>();
 
-        // 转换 LocalDateTime 为字符串
-        String formattedDate = existingSpecimen.getCreateTime().format(formatter);
-        templateParams.put("createTime",formattedDate);
+            // 定义格式化模板
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 
-        notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
-                .setUserId(Long.valueOf(existingSpecimen.getCreator())).setTemplateCode(templateCode).setTemplateParams(templateParams));
+            // 转换 LocalDateTime 为字符串
+            String formattedDate = existingSpecimen.getCreateTime().format(formatter);
+            templateParams.put("createTime",formattedDate);
+
+            notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
+                    .setUserId(Long.valueOf(existingSpecimen.getCreator())).setTemplateCode(templateCode).setTemplateParams(templateParams));
+        }
     }
 
     @Override