Procházet zdrojové kódy

部分配置修改

yzx před 7 měsíci
rodič
revize
174ab3e89d

+ 3 - 1
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/dal/mysql/specimenoutbound/SpecimenOutboundMapper.java

@@ -91,6 +91,8 @@ public interface SpecimenOutboundMapper extends BaseMapperX<SpecimenOutboundDO>
 //    })
 //    List<SpecimenOutboundDO> selectByIds(@Param("infoIds") List<Long> infoIds);
 
+
+    // TODO selectByIds 干嘛还单独写一个这个
     @Select({
             "<script>",
             "SELECT so.*, si.specimen_number, si.image_path, si.storage_location ",
@@ -104,7 +106,7 @@ public interface SpecimenOutboundMapper extends BaseMapperX<SpecimenOutboundDO>
     })
     List<SpecimenOutboundDO> selectByIds(@Param("infoIds") List<Long> infoIds);
 
-
+    // TODO selectById 干嘛还单独写一个这个
     @Select("SELECT * FROM museums_specimen_outbound WHERE id = #{outboundId}")
     SpecimenOutboundDO selectById(@Param("outboundId") Long outboundId);
 

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

@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.*;
 
 
@@ -45,6 +46,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     public Long createSpecimenOutbound(SpecimenOutboundSaveReqVO createReqVO) {
         // 插入
         SpecimenOutboundDO specimenOutbound = BeanUtils.toBean(createReqVO, SpecimenOutboundDO.class);
+        //TODO 判断标本是否已经出库,如果已经出库,则要求先完成回库
         specimenOutboundMapper.insert(specimenOutbound);
         // 返回
         return specimenOutbound.getId();
@@ -73,6 +75,14 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
             throw new IllegalStateException("只能更新状态为已出库的标本回库单");
         }
 
+        //TODO 合并一下set写法,可以减少重复代码
+        //existingSpecimen.setStatus(4).setReturnDate(LocalDateTime.now())
+        // .setSpecimenCondition(updateReqVO.getSpecimenCondition())
+        // .setReturner(updateReqVO.getReturner())
+        // .setReceiver(updateReqVO.getReceiver())
+        // .setReceiver(updateReqVO.getRemarks())
+
+
         // 更新标本状态为已回库(4)
         existingSpecimen.setStatus(4); // 修改状态为已回库
 
@@ -88,6 +98,8 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
         // 更新数据库
         specimenOutboundMapper.updateById(existingSpecimen);
 
+        //TODO 下面只有一句,并且全局只使用了一次,没必要写另外的方法
+
         // 更新标本信息的馆藏状态为0(在馆)
         updateSpecimenInfoExistStatus(Long.valueOf(existingSpecimen.getInfoId()));
     }
@@ -117,10 +129,14 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
             specimenOutbound.setApprovalTime(req.getApprovalTime()); // 设置当前驳回时间
         }
 
-        // 获取当前用户 ID
-        SecurityFrameworkUtils UserContext = null;
-        Long userId = UserContext.getLoginUserId(); // 通过方法获取当前用户 ID
-        specimenOutbound.setApproveUsers(userId); // 设置操作员 ID
+        // TODO 获取用户的id有现成的方法
+        //  specimenOutbound.setApproveUsers(getLoginUserId()); // 设置操作员 ID
+
+//        // 获取当前用户 ID
+//        SecurityFrameworkUtils UserContext = null;
+//        Long userId = getLoginUserId(); // 通过方法获取当前用户 ID
+//        specimenOutbound.setApproveUsers(userId); // 设置操作员 ID
+        specimenOutbound.setApproveUsers(getLoginUserId()); // 设置操作员 ID
 
         // 更新数据库
         specimenOutboundMapper.updateById(specimenOutbound);
@@ -132,6 +148,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
         // 校验存在
         validateSpecimenOutboundExists(id);
 
+        // TODO 下面方法的改动和上面同理, 合并set 并且减少一个额外方法的引入
         // 获取当前标本的状态
         SpecimenOutboundDO existingSpecimen = specimenOutboundMapper.selectById(id);
 
@@ -161,6 +178,9 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
 
     @Override
     public void deleteSpecimenOutbound(Long id) {
+
+        // TODO 删除方法待考虑是否关闭开放,如果开放可以考虑鉴权,或者需要多个老师确认(先不弄)
+
         // 校验存在
         validateSpecimenOutboundExists(id);
         // 删除