Browse Source

查看标本出库单详情

hyy 7 months ago
parent
commit
e027d92567

+ 2 - 1
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java

@@ -49,6 +49,7 @@ public class FileController {
     //自加的
     @PostMapping("/museums-upload")
     @Operation(summary = "上传博物馆文件", description = "模式二:后端上传文件,包含另一个字段")
+    @PreAuthorize("@ss.hasPermission('museums:specimen-info:file')")
     public CommonResult<String> uploadFileWithAnother(FileUploadReqVO uploadReqVO) throws Exception {
         MultipartFile file = uploadReqVO.getFile();
         String path = uploadReqVO.getPath();
@@ -113,7 +114,7 @@ public class FileController {
     //自加的
     @GetMapping("/page/another")
     @Operation(summary = "获得另一个字段为1的文件分页")
-    @PreAuthorize("@ss.hasPermission('infra:file:query')")
+    @PreAuthorize("@ss.hasPermission('infra:file:museums')")
     public CommonResult<PageResult<FileRespVO>> getFilePageWithAnotherOne(@Valid FilePageReqVO pageVO) {
         PageResult<FileDO> pageResult = fileService.getFilePageWithAnotherOne(pageVO);
         return success(BeanUtils.toBean(pageResult, FileRespVO.class));

+ 1 - 1
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimeninfo/SpecimenInfoController.java

@@ -151,7 +151,7 @@ public class SpecimenInfoController {
                         .purpose("研究")
                         .description("这是一个矿石标本")
                         .notes("备注信息")
-                        .imageName("image1.jpg,image3.jpg,image3.jpg")
+                        .imageName("image1.jpg、image3.jpg、image3.jpg")
                         .specimenPrice(new BigDecimal("100.01"))
                         .specimenAmount(20)
                         .collectionStatus(CollectionStatusEnum.IN_MUSEUM.getStatus()) // 使用枚举

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

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound;
 
+import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoPageReqVO;
 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.*;
@@ -86,7 +87,7 @@ public class SpecimenOutboundController {
 
     @PutMapping("/recompile")
     @Operation(summary = "修改标本出库信息")
-    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:update')")
+    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:recompile')")
     public CommonResult<Boolean> recompileSpecimenOutbound(@Valid @RequestBody SpecimenOutboundSaveReqVO updateReqVO) {
         // 从数据库获取当前标本出库信息
         SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(updateReqVO.getId());
@@ -149,7 +150,7 @@ public class SpecimenOutboundController {
     @GetMapping("/getReturn")
     @Operation(summary = "获得标本回库信息")
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
+    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:return')")
     public CommonResult<SpecimenOutboundRespVO> getSpecimenReturnInformation(@RequestParam("id") Long id) {
         SpecimenOutboundDO specimenOutbound = specimenOutboundService.getSpecimenReturnInformation(id);
         if (specimenOutbound != null && specimenOutbound.getStatus() == 4) {
@@ -229,15 +230,28 @@ public class SpecimenOutboundController {
     }
 
     //获取出库单,方便操作员查看标本编号、图片及标本存放位置等。
+//    @GetMapping("/specimenInfo")
+//    @Operation(summary = "获得标本出库单")
+//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+//    @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
+//    public CommonResult<SpecimenOutboundWithInfoRespVO> getSpecimen(@RequestParam("id") Long id) {
+//        SpecimenOutboundWithInfoRespVO specimenOutbound = specimenOutboundService.getSpecimenOutboundWithInfo(id);
+//        if (specimenOutbound == null) {
+//            throw exception(SPECIMEN_OUTBOUND_ORDER_NOT_EXISTS);
+//        }
+//        return success(specimenOutbound);
+//    }
     @GetMapping("/specimenInfo")
-    @Operation(summary = "获得标本出库单")
+    @Operation(summary = "获得标本出库单及分页的关联标本信息")
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('museums:specimen-outbound:query')")
-    public CommonResult<SpecimenOutboundWithInfoRespVO> getSpecimen(@RequestParam("id") Long id) {
-        SpecimenOutboundWithInfoRespVO specimenOutbound = specimenOutboundService.getSpecimenOutboundWithInfo(id);
+    public CommonResult<SpecimenOutboundWithInfoRespVO> getSpecimen(@RequestParam("id") Long id,
+                                                                    @Valid SpecimenInfoPageReqVO pageReqVO) {
+        SpecimenOutboundWithInfoRespVO specimenOutbound = specimenOutboundService.getSpecimenOutboundWithInfo(id, pageReqVO);
         if (specimenOutbound == null) {
             throw exception(SPECIMEN_OUTBOUND_ORDER_NOT_EXISTS);
         }
         return success(specimenOutbound);
     }
+
 }

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

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound.vo;
 
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
 import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
 import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoRespVO;
@@ -68,8 +69,8 @@ public class SpecimenOutboundWithInfoRespVO {
     @DictFormat(DictTypeConstants.MUSEUMS_APPROAL_STATUS)
     private Integer status;
 
-    @Schema(description = "关联标本信息列表")
+    @Schema(description = "关联标本信息分页")
     @ExcelProperty("关联标本信息")
-    private List<SpecimenInfoRespVO> specimenInfoList;
+    private PageResult<SpecimenInfoRespVO> specimenInfoList;
 
 }

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

@@ -222,7 +222,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         if (imageNames == null || imageNames.trim().isEmpty()) {
             return true; // 如果图片名称为空或仅含空格,则视为通过校验
         }
-        String[] names = imageNames.split(",");
+        String[] names = imageNames.split("");
         for (String name : names) {
             if (!name.matches(".+\\.(jpg|jpeg|png)$")) {
                 return false; // 只要有一个格式不正确就返回 false

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

@@ -1,6 +1,8 @@
 package cn.iocoder.yudao.module.museums.service.specimenoutbound;
 
 import javax.validation.*;
+
+import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoPageReqVO;
 import cn.iocoder.yudao.module.museums.controller.admin.specimenoutbound.vo.*;
 import cn.iocoder.yudao.module.museums.dal.dataobject.specimenoutbound.SpecimenOutboundDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
@@ -104,7 +106,8 @@ public interface SpecimenOutboundService {
      * @param id 出库信息编号
      * @return 标本出库回库信息及相关标本信息
      */
-    SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id);
+//    SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id);
+    SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id, SpecimenInfoPageReqVO pageReqVO);
 
 
 

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

@@ -1,5 +1,7 @@
 package cn.iocoder.yudao.module.museums.service.specimenoutbound;
 
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoPageReqVO;
 import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenInfoRespVO;
 import cn.iocoder.yudao.module.museums.controller.admin.specimeninfo.vo.SpecimenOutboundFormRespVO;
 import cn.iocoder.yudao.module.museums.dal.dataobject.specimeninfo.SpecimenInfoDO;
@@ -322,8 +324,36 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     }
 
     //获取出库表单的方法
+//    @Override
+//    public SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id) {
+//        // 查询出库信息
+//        SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(id);
+//
+//        // 如果没有找到相关出库信息,返回 null 或抛出异常
+//        if (specimenOutbound == null) {
+//            return null; // 或抛出自定义异常
+//        }
+//
+//        // 查询关联的标本信息
+//        String infoIds = specimenOutbound.getInfoId();
+//        // 处理 infoId 字段
+//        infoIds = infoIds.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
+//        List<Long> idList = Arrays.stream(infoIds.split(","))
+//                .map(Long::parseLong)
+//                .collect(Collectors.toList());
+//
+//        // 查询所有关联的标本信息
+//        List<SpecimenOutboundFormRespVO> specimenInfoList = specimenInfoMapper.selectByIds(idList);
+//        SpecimenOutboundWithInfoRespVO response = BeanUtils.toBean(specimenOutbound,SpecimenOutboundWithInfoRespVO.class);
+//        List<SpecimenInfoRespVO> newSpecimenInfoList =BeanUtils.toBean(specimenInfoList,SpecimenInfoRespVO.class);
+//
+//        // 创建返回对象
+//        // 设置所有关联的标本信息
+//        response.setSpecimenInfoList(newSpecimenInfoList);
+//        return response;
+//    }
     @Override
-    public SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id) {
+    public SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id, SpecimenInfoPageReqVO pageReqVO) {
         // 查询出库信息
         SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(id);
 
@@ -340,15 +370,19 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
                 .map(Long::parseLong)
                 .collect(Collectors.toList());
 
-        // 查询所有关联的标本信息
-        List<SpecimenOutboundFormRespVO> specimenInfoList = specimenInfoMapper.selectByIds(idList);
-        SpecimenOutboundWithInfoRespVO response = BeanUtils.toBean(specimenOutbound,SpecimenOutboundWithInfoRespVO.class);
-        // 假设你有这个 Mapper
-        List<SpecimenInfoRespVO> newSpecimenInfoList =BeanUtils.toBean(specimenInfoList,SpecimenInfoRespVO.class);
+        // 这里修改为分页查询标本信息
+        PageResult<SpecimenInfoDO> pageResult = specimenInfoMapper.selectPage(pageReqVO, new LambdaQueryWrapperX<SpecimenInfoDO>()
+                .inIfPresent(SpecimenInfoDO::getId, idList));  // 根据 infoIds 查询标本信息
+
+        // 将 DO 转换为 VO
+        PageResult<SpecimenInfoRespVO> pageResultVO = BeanUtils.toBean(pageResult, SpecimenInfoRespVO.class);
+
         // 创建返回对象
-        // 设置所有关联的标本信息
-        response.setSpecimenInfoList(newSpecimenInfoList);
+        SpecimenOutboundWithInfoRespVO response = BeanUtils.toBean(specimenOutbound, SpecimenOutboundWithInfoRespVO.class);
+        response.setSpecimenInfoList(pageResultVO); // 设置分页后的标本信息列表
+
         return response;
     }
 
+
 }