Browse Source

删掉了一些没用的代码

hyy 4 months ago
parent
commit
d0376773b9
16 changed files with 102 additions and 259 deletions
  1. 1 5
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimeninfo/SpecimenInfoController.java
  2. 6 0
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimeninfo/vo/SpecimenImportRespVO.java
  3. 16 15
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/controller/admin/specimenoutbound/SpecimenOutboundController.java
  4. 13 39
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/dal/mysql/specimeninfo/SpecimenInfoMapper.java
  5. 5 31
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/dal/mysql/specimenoutbound/SpecimenOutboundMapper.java
  6. 5 5
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/photogroup/PhotoGroupServiceImpl.java
  7. 0 2
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/photos/PhotosServiceImpl.java
  8. 1 1
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimeninfo/SpecimenInfoService.java
  9. 26 87
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimeninfo/SpecimenInfoServiceImpl.java
  10. 7 8
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimenoutbound/SpecimenOutboundService.java
  11. 14 20
      yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/specimenoutbound/SpecimenOutboundServiceImpl.java
  12. 0 7
      yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/museumsdocument/MuseumsDocumentMapper.xml
  13. 0 8
      yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/photogroup/PhotoGroupMapper.xml
  14. 0 7
      yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/photos/PhotosMapper.xml
  15. 8 18
      yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/specimeninfo/SpecimenInfoMapper.xml
  16. 0 6
      yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/specimenoutbound/SpecimenOutboundMapper.xml

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

@@ -60,7 +60,7 @@ public class SpecimenInfoController {
     @PostMapping("/create")
     @Operation(summary = "创建标本管理")
     @PreAuthorize("@ss.hasPermission('museums:specimen-info:create')")
-    public CommonResult<String> createSpecimenInfo(@Valid @RequestBody SpecimenInfoSaveReqVO createReqVO) {
+    public CommonResult<Long> createSpecimenInfo(@Valid @RequestBody SpecimenInfoSaveReqVO createReqVO) {
         return success(specimenInfoService.createSpecimenInfo(createReqVO));
     }
 
@@ -185,7 +185,6 @@ public class SpecimenInfoController {
 
         // 处理标本图片的导入(如果存在)
         if (imageFile != null && !imageFile.isEmpty()) {
-//            SpecimenImportRespVO imageResult = specimenInfoService.importSpecimenImages(imageFile);
             importResult = specimenInfoService.importSpecimenImages(imageFile);
             if (importResult == null) {
                 throw exception(INVALID_IMAGE_FORMAT);
@@ -196,7 +195,6 @@ public class SpecimenInfoController {
     }
 
     //工作台
-    //统计本年标本每月入库数量
     @GetMapping("/statistics/entry/{year}")
     @Operation(summary = "统计本年标本每月入库数量")
     @Parameter(name = "year", description = "年份", required = true, example = "2024")
@@ -218,7 +216,6 @@ public class SpecimenInfoController {
         return success(responseData);
     }
 
-    //根据出、回、入库的登记信息统计本馆标本历年增减情况。
     @GetMapping("/statistics/yearly")
     @Operation(summary = "根据出、回、入库登记统计标本历年增减情况")
     @PreAuthorize("@ss.hasPermission('museums:specimen-info:workbench')")
@@ -227,7 +224,6 @@ public class SpecimenInfoController {
         return CommonResult.success(yearlyStatistics);
     }
 
-    //根据入馆凭证中标本来源的登记情况统计
     @GetMapping("/statistics/source")
     @Operation(summary = "根据标本来源统计历年标本登记情况")
     @PreAuthorize("@ss.hasPermission('museums:specimen-info:workbench')")

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

@@ -33,4 +33,10 @@ public class SpecimenImportRespVO {
     @Schema(description = "导入失败的图片集合,key 为图片名称,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED)
     private Map<String, String> failureSpecimenImages;
 
+    @Schema(description = "失败的图片数量", requiredMode = Schema.RequiredMode.REQUIRED)
+    private int successCount;
+
+    @Schema(description = "失败的图片数量", requiredMode = Schema.RequiredMode.REQUIRED)
+    private int failureCount;
+
 }

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

@@ -149,18 +149,18 @@ public class SpecimenOutboundController {
         return success(BeanUtils.toBean(specimenOutbound, SpecimenOutboundEditRespVO.class));
     }
 
-    @GetMapping("/getReturn")
-    @Operation(summary = "获得标本回库信息")
-    @Parameter(name = "id", description = "编号", required = true, example = "1024")
-    @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) {
-            return success(BeanUtils.toBean(specimenOutbound, SpecimenOutboundRespVO.class));
-        } else {
-            throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
-        }
-    }
+//    @GetMapping("/getReturn")
+//    @Operation(summary = "获得标本回库信息")
+//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+//    @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) {
+//            return success(BeanUtils.toBean(specimenOutbound, SpecimenOutboundRespVO.class));
+//        } else {
+//            throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
+//        }
+//    }
 
     @GetMapping("/page")
     @Operation(summary = "获得标本出库回库信息分页")
@@ -184,9 +184,9 @@ public class SpecimenOutboundController {
     }
 
     //工作台
-    //根据出库的登记情况统计本年标本出库信息
+    //统计本年标本每月出库数量
     @GetMapping("/statistics/outgoing/{year}")
-    @Operation(summary = "根据出库登记情况统计本年标本出库信息")
+    @Operation(summary = "统计本年标本每月出库数量")
     @Parameter(name = "year", description = "年份", required = true, example = "2024")
     @PreAuthorize("@ss.hasPermission('museums:specimen-info:workbench')")
     public CommonResult<Map<String, Object>> getOutboundStatistics(@PathVariable int year) {
@@ -208,8 +208,9 @@ public class SpecimenOutboundController {
         return success(response);
     }
 
+    //统计本年标本每月回库数量
     @GetMapping("/statistics/return/{year}")
-    @Operation(summary = "根据回库登记情况统计本年标本回库信息")
+    @Operation(summary = "统计本年标本每月回库数量")
     @Parameter(name = "year", description = "年份", required = true, example = "2024")
     @PreAuthorize("@ss.hasPermission('museums:specimen-info:workbench')")
     public CommonResult<Map<String, Object>> getReturnStatistics(@PathVariable int year) {

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

@@ -52,6 +52,10 @@ public interface SpecimenInfoMapper extends BaseMapperX<SpecimenInfoDO> {
                 .betweenIfPresent(SpecimenInfoDO::getCreateTime, reqVO.getCreateTime())
                 .betweenIfPresent(SpecimenInfoDO::getAcquisitionTime, reqVO.getAcquisitionTime())
                 .likeIfPresent(SpecimenInfoDO::getDeletedReason, reqVO.getDeletedReason())
+                .eqIfPresent(SpecimenInfoDO::getSaveStatus, reqVO.getSaveStatus())
+                .eqIfPresent(SpecimenInfoDO::getEconomize, reqVO.getEconomize())
+                .eqIfPresent(SpecimenInfoDO::getCountry, reqVO.getCountry())
+                .eqIfPresent(SpecimenInfoDO::getMainPurpose, reqVO.getMainPurpose())
                 .orderByDesc(SpecimenInfoDO::getId));
     }
 
@@ -102,65 +106,35 @@ public interface SpecimenInfoMapper extends BaseMapperX<SpecimenInfoDO> {
     @Update("UPDATE museums_specimen_info SET collection_status = #{collection_status} WHERE id = #{id} AND deleted = 0")
     void updateCollectionStatus(@Param("id") Long id, @Param("collection_status") Integer collectionStatus);
 
-    /**
-     * 根据年份统计已出库和已回库的标本信息
-     *
-     * @param year 年份
-     * @return 标本回库信息列表
-     */
-    @Select("SELECT * FROM museums_specimen_info " + "WHERE YEAR(entry_date) = #{year} " + "AND deleted = 0")
-    List<SpecimenInfoDO> selectEntryStatisticsByYear(int year);
-
     /**
      * 查询各类标本的数量统计
      * @return 各类标本的类型及数量
      */
-    @Select("SELECT specimen_type, COUNT(*) as count FROM specimen_info GROUP BY specimen_type")
+    @Select("SELECT specimen_type, COUNT(*) as count FROM specimen_info WHERE deleted = 0 GROUP BY specimen_type")
     List<Map<String, Object>> selectAllSpecimenTypeStatistics();
 
-    /**
-     * 根据年份统计标本来源增减情况
-     *
-     * @param year 年份
-     * @return 标本来源统计信息列表
-     */
-    @Select("SELECT source, COUNT(*) as count " +
-            "FROM museums_specimen_info " +
-            "WHERE YEAR(acquisition_time) = #{year} AND deleted = 0 " +
-            "GROUP BY source")
-    List<SpecimenInfoDO> selectSpecimenSourceStatistics(int year);
-
-    //根据出、回、入库登记统计标本历年增减情况
-    @Select("SELECT * FROM museums_specimen_info WHERE deleted = 0")
-    List<SpecimenInfoDO> getInStockRecords();
-
-    //acquisition_time
+    //根据标本来源统计历年标本登记情况
     @Select("SELECT YEAR(acquisition_time) AS year, source, COUNT(*) AS count " +
-            "FROM museums_specimen_info WHERE acquisition_time != '' AND acquisition_time IS NOT NULL " +
+            "FROM museums_specimen_info WHERE deleted = 0 AND acquisition_time != '' AND acquisition_time IS NOT NULL " +
             "GROUP BY YEAR(acquisition_time), source")
     List<Map<String, Object>> getYearlySourceStatistics();
 
-    @Select("SELECT YEAR(create_time) AS year, COUNT(*) AS in_stock_count " +
+    //根据入库登记统计标本历年增减情况(入库记录)
+    @Select("SELECT YEAR(acquisition_time) AS year, COUNT(*) AS in_stock_count " +
             "FROM museums_specimen_info " +
-            "WHERE deleted = 0 " +
-            "GROUP BY YEAR(create_time)")
+            "WHERE deleted = 0 AND acquisition_time != '' AND acquisition_time IS NOT NULL " +
+            "GROUP BY YEAR(acquisition_time)")
     List<Map<String, Object>> getYearlyInStockRecords();
 
     default SpecimenInfoDO selectBySpecimenNumber(String specimenNumber){
         return selectOne(SpecimenInfoDO::getSpecimenNumber,specimenNumber);
     }
 
-    @Select("SELECT * FROM museums_specimen_info WHERE image_name = #{imageName}")
-    SpecimenInfoDO selectByImageName(@Param("imageName") String imageName);
-
     default SpecimenInfoDO selectByImageNames(String imageName) {
         return selectOne(new LambdaQueryWrapperX<SpecimenInfoDO>()
-                .likeIfPresent(SpecimenInfoDO::getImageName, imageName)
-        );
+                .likeIfPresent(SpecimenInfoDO::getImageName, imageName));
     }
 
+    //根据入库的登记情况统计本年标本入库信息
     List<Map<String, Object>> selectMonthlyEntryStatisticsByYear(@Param("year") int year);
-
-    boolean existsByNumber(String number);
-
 }

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

@@ -51,45 +51,19 @@ public interface SpecimenOutboundMapper extends BaseMapperX<SpecimenOutboundDO>
 
     }
 
-      List<Map<String, Object>> selectMonthlyOutboundStatistics(int year);
-      List<Map<String, Object>> getMonthlyReturnStatistics(int year);
+    //统计标本本年每月出库回库数量
+    List<Map<String, Object>> selectMonthlyOutboundStatistics(int year);
+    List<Map<String, Object>> getMonthlyReturnStatistics(int year);
 
-
-    //根据出、回、入库登记统计标本历年增减情况
+    //根据出库登记统计标本历年增减情况
     @Select("SELECT YEAR(outgoing_time) AS year, COUNT(*) AS out_stock_count " +
             "FROM museums_specimen_outbound WHERE outgoing_time != '' AND outgoing_time IS NOT NULL " +
             "GROUP BY YEAR(outgoing_time)")
     List<Map<String, Object>> getYearlyOutboundRecords();
-
+    //根据回库登记统计标本历年增减情况
     @Select("SELECT YEAR(return_date) AS year, COUNT(*) AS return_count " +
             "FROM museums_specimen_outbound " +
             "WHERE return_date IS NOT NULL " +
             "GROUP BY YEAR(return_date)")
     List<Map<String, Object>> getYearlyInboundRecords();
-
-    @Select({
-            "<script>",
-            "SELECT so.*, si.specimen_number, si.image_path, si.storage_location ",
-            "FROM museums_specimen_outbound so ",
-            "JOIN museums_specimen_info si ON so.info_id = si.id ",
-            "WHERE so.info_id IN ",
-            "<foreach item='id' collection='infoIds' open='(' separator=',' close=')'>",
-            "#{id}",
-            "</foreach>",
-            "</script>"
-    })
-    List<SpecimenOutboundDO> selectByIds(@Param("infoIds") List<Long> infoIds);
-
-    @Select({
-            "<script>",
-            "SELECT si.specimen_number, si.image_path, si.storage_location ",
-            "FROM museums_specimen_outbound so ",
-            "JOIN museums_specimen_info si ON so.info_id = si.id ",
-            "WHERE so.outbound_order_id = #{outboundOrderId}",
-            "</script>"
-    })
-    List<SpecimenOutboundDO> selectByOutboundOrderId(@Param("outboundOrderId") Long outboundOrderId);
-
-
-
 }

+ 5 - 5
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/photogroup/PhotoGroupServiceImpl.java

@@ -94,17 +94,17 @@ public class PhotoGroupServiceImpl implements PhotoGroupService {
         return photoGroupMapper.selectPage(pageReqVO);
     }
 
-
     //公共方法
     public List<Integer> processZipFile(ZipInputStream zipInputStream, Integer groupId) throws Exception {
         List<Integer> photoIds = new ArrayList<>();
         ZipEntry entry;
         while ((entry = zipInputStream.getNextEntry()) != null) {
             if (!entry.isDirectory()) {
-                // 检查文件类型,只处理图片
-                if (entry.getName().endsWith(".jpg") || entry.getName().endsWith(".png") || entry.getName().endsWith(".gif")
-                        || entry.getName().endsWith(".bmp") || entry.getName().endsWith(".tiff")
-                        || entry.getName().endsWith(".psd") || entry.getName().endsWith(".raw") || entry.getName().endsWith(".svg")) {
+                String fileName = entry.getName().toLowerCase();  // 转为小写
+                // 检查文件类型,只处理图片(转换为小写后进行检查)
+                if (fileName.endsWith(".jpg") || fileName.endsWith(".png") || fileName.endsWith(".gif")
+                        || fileName.endsWith(".bmp") || fileName.endsWith(".tiff")|| fileName.endsWith(".jpeg")
+                        || fileName.endsWith(".psd") || fileName.endsWith(".raw") || fileName.endsWith(".svg")) {
 
                     // 使用 ByteArrayOutputStream 读取文件内容
                     ByteArrayOutputStream bos = new ByteArrayOutputStream();

+ 0 - 2
yudao-module-museums/yudao-module-museums-biz/src/main/java/cn/iocoder/yudao/module/museums/service/photos/PhotosServiceImpl.java

@@ -37,8 +37,6 @@ public class PhotosServiceImpl implements PhotosService {
     @Resource
     private PhotosMapper photosMapper;
     @Resource
-    private FileApi fileApi;
-    @Resource
     private PhotoGroupServiceImpl photoGroupServiceImpl;
 
     @Override

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

@@ -20,7 +20,7 @@ public interface SpecimenInfoService {
      * @param createReqVO 创建信息
      * @return 编号
      */
-    String createSpecimenInfo(@Valid SpecimenInfoSaveReqVO createReqVO);
+    Long createSpecimenInfo(@Valid SpecimenInfoSaveReqVO createReqVO);
 
     /**
      * 更新标本管理

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

@@ -47,10 +47,6 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
     private SpecimenOutboundMapper specimenOutboundMapper;
     @Resource
     private FileApi fileApi;
-    public SpecimenInfoServiceImpl(SpecimenInfoMapper specimenInfoMapper, FileApi fileApi) {
-        this.specimenInfoMapper = specimenInfoMapper;
-        this.fileApi = fileApi;
-    }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -58,12 +54,12 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
             bizNo = "{{#specimenInfo.id}}",
             success = MUSEUMS_SPECIMEN_CREATE_SUCCESS,
             extra = "[{{#specimenInfo.id}}]")
-    public String createSpecimenInfo(SpecimenInfoSaveReqVO createReqVO) {
+    public Long createSpecimenInfo(SpecimenInfoSaveReqVO createReqVO) {
         // 校验标本编号是否已存在
-        if (specimenInfoMapper.existsByNumber(createReqVO.getSpecimenNumber())) {
+        SpecimenInfoDO existsByNumber = specimenInfoMapper.selectBySpecimenNumber(createReqVO.getSpecimenNumber());
+        if (existsByNumber != null) {
             throw exception(SPECIMEN_NUMBER_ALREADY_EXISTS_CANNOT_ADDED);
         }
-
         // 插入新标本信息
         SpecimenInfoDO specimenInfo = BeanUtils.toBean(createReqVO, SpecimenInfoDO.class);
         specimenInfoMapper.insert(specimenInfo);
@@ -72,7 +68,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         LogRecordContext.putVariable("specimenInfo", specimenInfo);
 
         // 返回新创建的标本ID
-        return "标本创建成功,标本ID:" + specimenInfo.getId();
+        return specimenInfo.getId();
     }
 
     @Override
@@ -217,83 +213,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         return true;
     }
 
-//    @Override
-//    @Transactional(rollbackFor = Exception.class)
-//    public String importSpecimenImages(MultipartFile file) throws Exception {
-//        // 校验文件类型
-//        if (!file.getOriginalFilename().toLowerCase().endsWith(".zip")) {
-//            throw exception(UPLOADED_FOLDER_CANNOT_EMPTY);
-//        }
-//
-//        // 创建临时目录存放解压后的文件
-//        File tempDir = Files.createTempDirectory("specimen_images").toFile();
-//
-//        try (ZipArchiveInputStream zipInputStream = new ZipArchiveInputStream(file.getInputStream())) {
-//            ZipArchiveEntry entry;
-//            Set<String> imagePathsSet = new HashSet<>();  // 使用 Set 来去重
-//
-//            while ((entry = zipInputStream.getNextEntry()) != null) {
-//                if (!entry.isDirectory()) {
-//                    File newFile = new File(tempDir, entry.getName());
-//                    try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(newFile))) {
-//                        byte[] buffer = new byte[1024];
-//                        int len;
-//                        while ((len = zipInputStream.read(buffer)) > 0) {
-//                            bos.write(buffer, 0, len);
-//                        }
-//                    }
-//
-//                    String imageName = newFile.getName();
-//                    if (!isValidImageName(imageName)) {
-//
-//                        System.err.println("无效的图片格式: " + imageName);
-//                        continue;
-//                    }
-//
-//                    // 根据图片名称查找对应的标本
-//                    SpecimenInfoDO specimenInfo = specimenInfoMapper.selectByImageNames(imageName);
-//                    if (specimenInfo != null) {
-//                        // 上传图片并获取 URL
-//                        String imagePath = fileApi.createFile(Files.readAllBytes(newFile.toPath()));
-//
-//                        // 确保 imagePath 有效且不为空
-//                        if (imagePath != null && !imagePath.trim().isEmpty()) {
-//                            // 添加新上传的路径
-//                            imagePathsSet.add(imagePath.trim());  // 使用 Set 来去重
-//
-//                            // 获取已存在的路径,并处理空值或无效的路径
-//                            String existingImagePaths = specimenInfo.getImagePath();
-//                            if (existingImagePaths != null && !existingImagePaths.trim().isEmpty()) {
-//                                // 清理已有路径中的方括号(如果有)
-//                                existingImagePaths = existingImagePaths.replaceAll("^\\[|\\]$", "").trim();
-//                                // 如果原路径是有效的且不是空数组,则拆分并添加到 Set 中
-//                                String[] existingPaths = existingImagePaths.split(",\\s*");
-//                                Collections.addAll(imagePathsSet, existingPaths);  // 也用 Set 来去重
-//                            }
-//                        }
-//                    }
-//                }
-//            }
-//
-//            // 将 Set 中的路径重新拼接成逗号分隔的字符串
-//            String newImagePaths = String.join(", ", imagePathsSet);
-//
-//            // 更新所有标本的信息,确保只更新一次
-//            for (File imageFile : tempDir.listFiles()) {
-//                String imageName = imageFile.getName();
-//                SpecimenInfoDO specimenInfo = specimenInfoMapper.selectByImageNames(imageName);
-//                if (specimenInfo != null) {
-//                    specimenInfo.setImagePath("[" + newImagePaths + "]"); // 设置多个图片路径的字符串,外面加上方括号
-//                    updateSpecimenInfo(BeanUtils.toBean(specimenInfo, SpecimenInfoSaveReqVO.class));
-//                }
-//            }
-//
-//        } finally {
-//            // 清理临时文件
-//            FileUtils.deleteDirectory(tempDir);
-//        }
-//        return "标本图片导入成功";
-//    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public SpecimenImportRespVO importSpecimenImages(MultipartFile file) throws Exception {
@@ -401,6 +321,8 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
                 .collect(Collectors.toList());
     }
 
+
+
     //按标本类别统计库存数
     @Override
     public Map<String, Integer> getSpecimenTypeStatistics() {
@@ -481,6 +403,14 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
             yearData.putAll(entry.getValue());
             yearlyStatisticsList.add(yearData);
         }
+
+        // 按年份升序排序
+        yearlyStatisticsList.sort((map1, map2) -> {
+            Integer year1 = Integer.valueOf((String) map1.get("year"));
+            Integer year2 = Integer.valueOf((String) map2.get("year"));
+            return year1.compareTo(year2); // 年份升序排列
+        });
+
         // 构建最终的返回结果
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("code", 0);
@@ -490,6 +420,7 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
         return resultMap;
     }
 
+
     @Override
     public List<Map<String, Object>> getYearlySpecimenSourceStatistics() {
         // 从数据库直接获取统计数据
@@ -518,12 +449,20 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
             resultList.add(yearData);
         }
 
+        // 按年份升序排序
+        resultList.sort((map1, map2) -> {
+            Long year1 = Long.valueOf((String) map1.get("year"));
+            Long year2 = Long.valueOf((String) map2.get("year"));
+            return year1.compareTo(year2); // 年份升序排列
+        });
+
         return resultList;
     }
 
+
     // Helper 方法将整数源转换为字符串
-    private String getSourceKey(Integer source) { // 使用 Integer 允许 null
-        if (source == null) return "unknown"; // 处理 null 的情况
+    private String getSourceKey(Integer source) {
+        if (source == null) return "unknown";
         switch (source) {
             case 0: return "purchase";
             case 1: return "donate";

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

@@ -55,13 +55,13 @@ public interface SpecimenOutboundService {
      * @return 标本出库回库信息
      */
     SpecimenOutboundDO getSpecimenOutbound(Long id);
-    /**
-     * 获得标本出库回库信息
-     *
-     * @param id 编号
-     * @return 标本出库回库信息
-     */
-    SpecimenOutboundDO getSpecimenReturnInformation(Long id);
+//    /**
+//     * 获得标本出库回库信息
+//     *
+//     * @param id 编号
+//     * @return 标本出库回库信息
+//     */
+//    SpecimenOutboundDO getSpecimenReturnInformation(Long id);
 
     /**
      * 获得标本出库回库信息分页
@@ -106,7 +106,6 @@ public interface SpecimenOutboundService {
      * @param id 出库信息编号
      * @return 标本出库回库信息及相关标本信息
      */
-//    SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id);
     SpecimenOutboundWithInfoRespVO getSpecimenOutboundWithInfo(Long id, SpecimenInfoPageReqVO pageReqVO);
 
 

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

@@ -3,7 +3,6 @@ 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.SpecimenInfoSaveReqVO;
 import cn.iocoder.yudao.module.museums.dal.dataobject.specimeninfo.SpecimenInfoDO;
 import cn.iocoder.yudao.module.museums.dal.mysql.specimeninfo.SpecimenInfoMapper;
 import com.mzt.logapi.context.LogRecordContext;
@@ -28,7 +27,6 @@ import java.util.*;
 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.framework.security.core.util.SecurityFrameworkUtils.getLoginUserNickname;
 import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.*;
 import static cn.iocoder.yudao.module.museums.enums.social.LogRecordConstants.*;
@@ -47,7 +45,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     private SpecimenOutboundMapper specimenOutboundMapper;
 
     @Resource
-    private SpecimenInfoMapper specimenInfoMapper; // 引入标本信息的Mapper
+    private SpecimenInfoMapper specimenInfoMapper;
 
     //创建出库申请
     @Override
@@ -195,7 +193,6 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     public String confirmOutbound(Long id, String operator) {
         // 校验存在
         validateSpecimenOutboundExists(id);
-
         // 获取当前标本的状态
         SpecimenOutboundDO existingSpecimen = specimenOutboundMapper.selectById(id);
         // 判断状态是否为审批通过(5)
@@ -231,16 +228,13 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
     public void updateSpecimenOutbound(SpecimenOutboundReturnReqVO updateReqVO) {
         // 校验存在
         validateSpecimenOutboundExists(updateReqVO.getId());
-
         // 获取当前标本的状态
         SpecimenOutboundDO existingSpecimen = specimenOutboundMapper.selectById(updateReqVO.getId());
-
         // 判断状态是否为已出库(3)
         if (existingSpecimen == null || existingSpecimen.getStatus() != 3) {
             throw exception(ONLY_OUTBOUND_SPECIMEN_CAN_RETURNED);
         }
 
-        // 使用链式调用合并设置
         SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
         updateObj.setStatus(4).setReturnDate(LocalDateTime.now()); // 设置回库时间为当前时间
 
@@ -255,7 +249,6 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
         for (String infoId : infoIds) {
             specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 0);
         }
-
         // 记录日志上下文
         LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
     }
@@ -280,18 +273,19 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
         return specimenOutboundMapper.selectById(id);
     }
 
-    @Override
-    public SpecimenOutboundDO getSpecimenReturnInformation(Long id) {
-        // 获取标本出库回库信息
-        SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(id);
-        // 检查审批状态是否为4(已回库)
-        if (specimenOutbound != null && specimenOutbound.getStatus() == 4) {
-            return specimenOutbound;
-        } else {
-            // 如果审批状态不是4,抛出异常
-            throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
-        }
-    }
+    //目前没用到
+//    @Override
+//    public SpecimenOutboundDO getSpecimenReturnInformation(Long id) {
+//        // 获取标本出库回库信息
+//        SpecimenOutboundDO specimenOutbound = specimenOutboundMapper.selectById(id);
+//        // 检查审批状态是否为4(已回库)
+//        if (specimenOutbound != null && specimenOutbound.getStatus() == 4) {
+//            return specimenOutbound;
+//        } else {
+//            // 如果审批状态不是4,抛出异常
+//            throw exception(NO_PERMISSION_VIEW_NON_RETURNED_SPECIMENS);
+//        }
+//    }
 
     @Override
     public PageResult<SpecimenOutboundDO> getSpecimenOutboundPage(SpecimenOutboundPageReqVO pageReqVO) {

+ 0 - 7
yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/museumsdocument/MuseumsDocumentMapper.xml

@@ -2,11 +2,4 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.iocoder.yudao.module.museums.dal.mysql.museumsdocument.MuseumsDocumentMapper">
 
-    <!--
-        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
-        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
-        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
-        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-     -->
-
 </mapper>

+ 0 - 8
yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/photogroup/PhotoGroupMapper.xml

@@ -2,12 +2,4 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.iocoder.yudao.module.museums.dal.mysql.photogroup.PhotoGroupMapper">
 
-    <!--
-        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
-        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
-        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
-        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-     -->
-
-
 </mapper>

+ 0 - 7
yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/photos/PhotosMapper.xml

@@ -2,13 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.iocoder.yudao.module.museums.dal.mysql.photos.PhotosMapper">
 
-    <!--
-        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
-        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
-        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
-        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-     -->
-
     <update id="deletePhotosByGroupId">
         UPDATE museums_photos
         SET deleted = 1

+ 8 - 18
yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/specimeninfo/SpecimenInfoMapper.xml

@@ -2,35 +2,25 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.iocoder.yudao.module.museums.dal.mysql.specimeninfo.SpecimenInfoMapper">
 
-    <select id="selectByIds" >
-        SELECT * FROM museums_specimen_info WHERE id IN
-        <foreach item="id" collection="list" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </select>
-
-        <select id="selectAllSpecimenTypeStatistics" resultType="map">
-            SELECT specimen_type, COUNT(*) as count
-            FROM museums_specimen_info
-            GROUP BY specimen_type
-        </select>
-
     <select id="selectMonthlyEntryStatisticsByYear" parameterType="int" resultType="map">
         SELECT
-            MONTH(create_time) AS month,
+            MONTH(acquisition_time) AS month,
             COUNT(*) AS entryCount
         FROM
             museums_specimen_info
         WHERE
-            YEAR(create_time) = #{year}
+            YEAR(acquisition_time) = #{year} AND deleted = 0
         GROUP BY
-            MONTH(create_time)
+            MONTH(acquisition_time)
         ORDER BY
             month
     </select>
 
-    <select id="existsByNumber" resultType="boolean">
-        SELECT COUNT(*) > 0 FROM museums_specimen_info WHERE specimen_number = #{number}
+    <select id="selectAllSpecimenTypeStatistics" resultType="map">
+        SELECT specimen_type, COUNT(*) as count
+        FROM museums_specimen_info
+        WHERE deleted = 0
+        GROUP BY specimen_type
     </select>
 
 </mapper>

+ 0 - 6
yudao-module-museums/yudao-module-museums-biz/src/main/resources/mapper/specimenoutbound/SpecimenOutboundMapper.xml

@@ -2,12 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.iocoder.yudao.module.museums.dal.mysql.specimenoutbound.SpecimenOutboundMapper">
 
-    <!--
-        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
-        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
-        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
-        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-     -->
     <select id="selectMonthlyOutboundStatistics" resultType="map">
         SELECT
             MONTH(outgoing_time) AS month,