Эх сурвалжийг харах

feat(d2-02-t3): Java删对焦图孤儿接口getAutofocusPictures/downloadFocusPicture全链(零调用;selectFocusBestPicture占位链保留)

huangjie 1 өдөр өмнө
parent
commit
d4d182c87e

+ 0 - 16
aivfo-business-manage/aivfo-business-manage-controller/aivfo-business-manage-pc-controller/src/main/java/com/aivfo/business/manage/pc/controller/resource/ResourceController.java

@@ -202,24 +202,8 @@ public class ResourceController {
     }
 
 
-    @PostMapping("/getAutofocusPictures")
-    @OperateLog(module = "设备数据接口", operation = "患者管理-详情-对焦预览")
-    @ApiOperation(value = "患者管理-详情-对焦预览")
-    public Result<FocusPreviewVO> getAutofocusPictures(@Validated @RequestBody FocusPreviewQueryDTO focusPreviewQueryDTO) {
-        return R.succeed(resourceManage.getAutofocusPictures(focusPreviewQueryDTO));
-    }
-
-
     // =============================视频图片下载部分=============================
 
-    @GetMapping("/downloadFocusPicture")
-    @OperateLog(module = "设备数据接口", operation = "下载对焦图片")
-    @ApiOperation(value = "下载对焦图片")
-    @NoToken
-    public void downloadFocusPicture(FocusPreviewQueryDTO focusPreviewQueryDTO, HttpServletRequest request, HttpServletResponse response) {
-        resourceManage.downloadFocusPicture(focusPreviewQueryDTO, request, response);
-    }
-
 
     /**
      * 下载选中图片-单张

+ 0 - 31
aivfo-business-manage/aivfo-business-manage-entity/src/main/java/com/aivfo/business/manage/entity/param/query/resource/FocusPreviewQueryDTO.java

@@ -1,31 +0,0 @@
-package com.aivfo.business.manage.entity.param.query.resource;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * @description: 对焦预览查询接口
- * @author: wangyl
- * @date: 2024/4/29
- */
-@Data
-@ApiModel("图片分页查看")
-public class FocusPreviewQueryDTO {
-
-    @NotBlank(message = "[tl设备编号]不能为空")
-    @ApiModelProperty(value = "tl设备编号", required = true)
-    private String tlSn;
-
-    @NotNull(message = "[仓室编号]不能为空")
-    @ApiModelProperty(value = "仓室编号", required = true)
-    private Integer houseSn;
-
-    @NotNull(message = "[胚胎id]不能为空")
-    @ApiModelProperty(value = "胚胎id", required = true)
-    private Long embryoId;
-
-}

+ 0 - 79
aivfo-business-manage/aivfo-business-manage-entity/src/main/java/com/aivfo/business/manage/entity/vo/resource/picture/FocusPreviewPictureVO.java

@@ -1,79 +0,0 @@
-package com.aivfo.business.manage.entity.vo.resource.picture;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-
-@Data
-public class FocusPreviewPictureVO {
-    /**
-     * 自增id
-     */
-    @ApiModelProperty("自增id")
-    private Long id;
-    /**
-     * 舱室
-     */
-    @ApiModelProperty("仓室编号:1-11(11号仓室为缓冲瓶)")
-    private Integer houseSn;
-    /**
-     * well编号 1-16
-     */
-    @ApiModelProperty("well编号 1-16")
-    private Integer wellSn;
-    /**
-     * 拍照总层数
-     */
-    @ApiModelProperty("拍照总层数")
-    private Integer totalLayer;
-    /**
-     * 设备返回的拍摄时间
-     */
-    @ApiModelProperty("设备返回的拍摄时间")
-    private LocalDateTime imageTime;
-
-    /**
-     * 图片层
-     */
-    @ApiModelProperty("图片层")
-    private Integer pictureLayer;
-
-    /**
-     * 抠图url
-     */
-    @ApiModelProperty("抠图url")
-    private String imageUrl;
-    /**
-     * 裁剪高
-     */
-    @ApiModelProperty("裁剪高")
-    private Integer imageHeight;
-    /**
-     * 裁剪宽
-     */
-    @ApiModelProperty("裁剪宽")
-    private Integer imageWidth;
-    /**
-     * 源图url
-     */
-    @ApiModelProperty("源图url")
-    private String sourceImageUrl;
-
-    /**
-     * 水平位置
-     */
-    @ApiModelProperty("垂直位置")
-    private Integer shootingPosition;
-
-    @ApiModelProperty("分数")
-    private BigDecimal imageScore;
-
-    @ApiModelProperty("显示名字")
-    private String imageName;
-
-    @ApiModelProperty("是否是最高分")
-    private Boolean highestScore = false;
-}

+ 0 - 30
aivfo-business-manage/aivfo-business-manage-entity/src/main/java/com/aivfo/business/manage/entity/vo/resource/picture/FocusPreviewVO.java

@@ -1,30 +0,0 @@
-package com.aivfo.business.manage.entity.vo.resource.picture;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * ccd拍照图片留存表:记录CCD拍照和自动对焦原图以及抠图相关信息
- */
-@Data
-@ApiModel("对焦预览")
-public class FocusPreviewVO {
-    /**
-     * 自动对焦时间
-     */
-    @ApiModelProperty("自动对焦时间")
-    LocalDateTime autofocusTime;
-    /**
-     * 对焦图片显示
-     */
-    @ApiModelProperty("对焦图片显示")
-    List<FocusPreviewPictureVO> focusPreviewPictureVOList;
-
-    @ApiModelProperty("舱室对焦是否结束")
-    Boolean end = false;
-
-}

+ 0 - 94
aivfo-business-manage/aivfo-business-manage-manage/aivfo-business-manage-pc-manage/src/main/java/com/aivfo/business/manage/pc/manage/impl/ResourceManageImpl.java

@@ -618,100 +618,6 @@ public class ResourceManageImpl implements ResourceManage {
         });
     }
 
-    /**
-     * 自动对焦预览
-     *
-     * @param focusPreviewQueryDTO
-     * @return com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO
-     * @Date 2024/4/29
-     * @Author wangyl
-     */
-    @Override
-    public FocusPreviewVO getAutofocusPictures(FocusPreviewQueryDTO focusPreviewQueryDTO) {
-        return resourceService.getAutofocusPictures(focusPreviewQueryDTO);
-    }
-
-    /**
-     * 下载对焦图片
-     *
-     * @param focusPreviewQueryDTO
-     */
-    @Override
-    public void downloadFocusPicture(FocusPreviewQueryDTO focusPreviewQueryDTO, HttpServletRequest request, HttpServletResponse response) {
-        List<PictureDAO> pictureList = resourceService.getAllFocusPictureByEmbryoId(focusPreviewQueryDTO);
-        if (CollectionUtils.isEmpty(pictureList)) {
-            return;
-        }
-
-        Map<String, List<PictureDAO>> dayMap = pictureList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getImageTime(), "yyyyMMdd")));
-
-        Map<String, Map<String, String>> pictureMap = new HashMap<>();
-        for (String key : dayMap.keySet()) {
-            List<PictureDAO> pictures = dayMap.get(key);
-            Map<String, String> urlMap = getPictureDownloadMap(pictures, true);
-            pictureMap.put(key, urlMap);
-        }
-
-        // 设置响应头
-        response.setHeader("content-type", "application/octet-stream");
-        response.setCharacterEncoding("utf-8");
-
-        try {
-            // 设置下载文件名
-            String encodedFileName = URLEncoder.encode(String.valueOf(focusPreviewQueryDTO.getEmbryoId()), "UTF-8").replaceAll("\\+", "%20");
-            response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + encodedFileName + ".zip");
-
-            // 创建ZIP输出流
-            ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
-            zos.setMethod(ZipOutputStream.DEFLATED);
-            byte[] buffer = new byte[1024];
-
-            // 遍历每个文件夹
-            for (Map.Entry<String, Map<String, String>> entry : pictureMap.entrySet()) {
-                String folderName = entry.getKey();
-                Map<String, String> fileMap = entry.getValue();
-
-                // 确保文件夹名以/结尾
-                if (!folderName.endsWith("/")) {
-                    folderName += "/";
-                }
-
-                // 遍历文件夹中的每个文件
-                for (Map.Entry<String, String> fileEntry : fileMap.entrySet()) {
-                    String[] split = fileEntry.getKey().split("/");
-                    String fileNameInFolder = (String) split[split.length - 1];
-                    String fileUrl = fileEntry.getValue();
-
-                    try {
-                        // 下载文件内容
-                        byte[] fileBytes = client.downloadFile(fileUrl);
-                        ByteArrayInputStream fis = new ByteArrayInputStream(fileBytes);
-
-                        // 创建带文件夹路径的条目
-                        String entryName = folderName + fileNameInFolder;
-                        zos.putNextEntry(new ZipEntry(entryName));
-
-                        // 写入文件内容
-                        int length;
-                        while ((length = fis.read(buffer)) > 0) {
-                            zos.write(buffer, 0, length);
-                        }
-                        zos.closeEntry();
-                    } catch (Exception e) {
-                        log.error("下载文件失败: 文件夹={}, 文件={}, 路径={}", folderName, fileNameInFolder, fileUrl, e);
-                    }
-                }
-            }
-
-            // 关闭ZIP输出流
-            zos.finish();
-            zos.close();
-        } catch (Exception e) {
-            log.error("打包下载文件夹失败", e);
-        }
-
-    }
-
     /**
      * 分页获取源图
      *

+ 0 - 16
aivfo-business-manage/aivfo-business-manage-manage/aivfo-business-manage-pc-manage/src/main/java/com/aivfo/business/manage/pc/manage/resource/ResourceManage.java

@@ -207,15 +207,6 @@ public interface ResourceManage {
      */
     void cleanData(String tlSn, Integer houseSn, List<Long> embryoCultureRecordId);
 
-    /**
-     * 自动对焦预览
-     *
-     * @param focusPreviewQueryDTO
-     * @return com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO
-     * @Date 2024/4/29
-     * @Author wangyl
-     */
-    FocusPreviewVO getAutofocusPictures(FocusPreviewQueryDTO focusPreviewQueryDTO);
     /**
      * 分页获取源图
      *
@@ -239,11 +230,4 @@ public interface ResourceManage {
      **/
     void exportPictures(PictureBatchExportDTO dto, HttpServletRequest request, HttpServletResponse response);
 
-    /**
-     * 下载对焦图片
-     *
-     * @param focusPreviewQueryDTO
-     */
-    void downloadFocusPicture(FocusPreviewQueryDTO focusPreviewQueryDTO, HttpServletRequest request, HttpServletResponse response);
-
 }

+ 0 - 45
aivfo-business-manage/aivfo-business-manage-service-impl/src/main/java/com/aivfo/business/manage/service/impl/ResourceServiceImpl.java

@@ -4,8 +4,6 @@ import com.aivfo.business.manage.entity.dao.Embryo;
 import com.aivfo.business.manage.entity.param.query.resource.*;
 import com.aivfo.business.manage.entity.param.setting.photosearchbutton.PictureSearchButtonDTO;
 import com.aivfo.business.manage.entity.vo.resource.EmbryoRecordDetailResourceVO;
-import com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewPictureVO;
-import com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO;
 import com.aivfo.business.manage.entity.vo.resource.picture.VideoLinePictureVO;
 import com.aivfo.business.manage.entity.vo.resource.video.VideoVO;
 import com.aivfo.business.manage.service.EmbryoService;
@@ -452,41 +450,6 @@ public class ResourceServiceImpl implements ResourceService {
         return pictureService.getPictures(videoDAO.getTlSn(), videoDAO.getHouseSn(), wrapper);
     }
 
-    /**
-     * 对焦预览
-     *
-     * @param focusPreviewQueryDTO
-     * @return com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO
-     * @Date 2024/4/29
-     * @Author wangyl
-     */
-    @Override
-    public FocusPreviewVO getAutofocusPictures(FocusPreviewQueryDTO focusPreviewQueryDTO) {
-        List<PictureDAO> lastAutofocusPictureByEmbryoId = pictureService.getLastAutofocusPictureByEmbryoId(focusPreviewQueryDTO.getTlSn(), focusPreviewQueryDTO.getHouseSn(), Arrays.asList(focusPreviewQueryDTO.getEmbryoId()));
-        FocusPreviewVO focusPreviewVO = new FocusPreviewVO();
-        if (CollectionUtils.isEmpty(lastAutofocusPictureByEmbryoId)) {
-            return focusPreviewVO;
-        }
-        List<FocusPreviewPictureVO> copy = BeanUtils.copyPropertiesListCallBack(lastAutofocusPictureByEmbryoId, FocusPreviewPictureVO.class, (s, t) -> {
-            // M3-02: image_score 已停写(本地对焦后无云端打分),文件名不再拼分数段,避免拼成 "..._null"
-            t.setImageName(StringUtils.format("{}_{}_{}", s.getHouseSn(), s.getWellSn(), s.getShootingPosition()));
-            if (s.getCropState() != CropState.SUCCEED) {
-                t.setImageUrl("");
-            }
-            // M3-02: 原 max(comparing(getImageScore)) 在 image_score 全 null 时 Comparator 抛 NPE、空流 .get() 抛 NoSuchElement。
-            // 本地对焦后无打分,"最高分高亮"失去数据源;改判据为下位机标记的 clearest(CLEAREST)。
-            // clearest 取自源 PictureDAO,对 null 安全(equals 反向调用);无 CLEAREST 标记则不高亮(highestScore 默认 false)。
-            if (DegreeOfClarity.CLEAREST.equals(s.getClearest())) {
-                t.setHighestScore(true);
-            }
-        });
-        int asInt = copy.stream().mapToInt(FocusPreviewPictureVO::getPictureLayer).max().getAsInt();
-        focusPreviewVO.setAutofocusTime(lastAutofocusPictureByEmbryoId.get(0).getImageTime());
-        focusPreviewVO.setEnd(lastAutofocusPictureByEmbryoId.get(0).getTotalLayer() == asInt);
-        focusPreviewVO.setFocusPreviewPictureVOList(copy);
-        return focusPreviewVO;
-    }
-
     /**
      * 获取源图分页信息
      *
@@ -641,14 +604,6 @@ public class ResourceServiceImpl implements ResourceService {
         return resList;
     }
 
-    @Override
-    public List<PictureDAO> getAllFocusPictureByEmbryoId(FocusPreviewQueryDTO focusPreviewQueryDTO) {
-        LambdaQueryWrapper<PictureDAO> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(PictureDAO::getEmbryoId, focusPreviewQueryDTO.getEmbryoId())
-                .eq(PictureDAO::getPhotographType, PhotoMode.AUTOFOCUS);
-        return pictureService.getPictures(focusPreviewQueryDTO.getTlSn(), focusPreviewQueryDTO.getHouseSn(), wrapper);
-    }
-
     /**
      * 图片视频组装
      *

+ 0 - 12
aivfo-business-manage/aivfo-business-manage-service/src/main/java/com/aivfo/business/manage/service/ResourceService.java

@@ -3,7 +3,6 @@ package com.aivfo.business.manage.service;
 import com.aivfo.business.manage.entity.dao.Embryo;
 import com.aivfo.business.manage.entity.param.query.resource.*;
 import com.aivfo.business.manage.entity.vo.resource.EmbryoRecordDetailResourceVO;
-import com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO;
 import com.aivfo.data.transmission.entity.dao.PictureDAO;
 import com.aivfo.data.transmission.entity.dao.PictureIdentifyResultDAO;
 import com.aivfo.data.transmission.entity.dao.VideoDAO;
@@ -196,15 +195,6 @@ public interface ResourceService {
      **/
     IdentifyResultDTO getPictureIdentifyResult(String tlSn, Integer houseSn, LocalDateTime lastUpdateTime);
 
-    /**
-     * 对焦预览
-     *
-     * @param focusPreviewQueryDTO
-     * @return com.aivfo.business.manage.entity.vo.resource.picture.FocusPreviewVO
-     * @Date 2024/4/29
-     * @Author wangyl
-     */
-    FocusPreviewVO getAutofocusPictures(FocusPreviewQueryDTO focusPreviewQueryDTO);
     /**
      * 获取源图分页信息
      *
@@ -286,7 +276,5 @@ public interface ResourceService {
                                                        List<Embryo> embryoList,
                                                        Integer layer);
 
-    List<PictureDAO> getAllFocusPictureByEmbryoId(FocusPreviewQueryDTO focusPreviewQueryDTO);
-
     List<PictureDAO> getPicturesByEmbryoIdAndDevelopTime(String tlSn, Integer houseSn, List<Long> embryoIdList, Integer developTime);
 }