From 11bdf5c5cfac520034bf7decb55057e6d4ee4b13 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期三, 23 十月 2024 10:30:45 +0800 Subject: [PATCH] 2024-10-22 朱宝民 代码优化 --- /dev/null | 30 ------------------------------ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java | 1 - 2 files changed, 0 insertions(+), 31 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java index a2f3307..ef492f3 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoFi/WebFileMapper.java @@ -18,5 +18,4 @@ int updateByPrimaryKey(WebFile record); - } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileCtrl.java deleted file mode 100644 index 3518c3a..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileCtrl.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.dy.pipIrrWebFile.get; - -import com.dy.common.aop.SsoAop; -import com.dy.common.webUtil.BaseResponse; -import com.dy.common.webUtil.BaseResponseUtils; -import com.dy.pipIrrGlobal.dyFile.FileOperate; -import com.dy.pipIrrGlobal.dyFile.FileRestVo; -import com.dy.pipIrrGlobal.pojoFi.WebFile; -import com.dy.pipIrrGlobal.voFi.VoPhoto; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author ZhuBaoMin - * @date 2024-10-22 15:26 - * @LastEditTime 2024-10-22 15:26 - * @Description 鑾峰彇鏂囦欢鎺у埗绫� - */ - -@Slf4j -@RestController -@RequestMapping(path = "get") -@RequiredArgsConstructor -public class GetFileCtrl { - private final GetFileSv getFileSv; - - @Autowired - private FileOperate fileOp ; - - @Value("${dy.webFile.fmUrl}") - private String fmUrl ; - - /** - * 鏍规嵁鍥剧墖ID鑾峰彇鍥剧墖璺緞 - * @param photoId - * @return - */ - @GetMapping(path = "/getPhotoFile") - @SsoAop() - public BaseResponse<VoPhoto> getPhotoFile(@RequestParam("photoId") Long photoId) { - try { - - // 鏍规嵁鍥剧墖ID鑾峰彇鍥剧墖鏂囦欢瀵硅薄锛屼粠鍥剧墖鏂囦欢瀵硅薄涓幏鍙栨枃浠惰矾寰勩�佹墿灞曞悕銆佺缉鐣ュ浘鏂囦欢璺緞 - WebFile webFile = getFileSv.getWebFileById(photoId); - if(webFile == null) { - return BaseResponseUtils.buildErrorMsg("鍥炬爣ID閿欒"); - } - String filePath = webFile.getFilePath(); - String extName = webFile.getExtName(); - String filePathZip = filePath.substring(0, filePath.indexOf('.')) + "_." + extName; - - FileRestVo frVo = fileOp.parseHashcode(fmUrl, webFile.hash); - - VoPhoto photo = new VoPhoto(); - photo.setDownloadPath(frVo.fileWebDownloadPath + photoId); - photo.setWebPath(frVo.fileWebUrl + filePath); - photo.setWebPathZip(frVo.fileWebUrl + filePathZip); - - return BaseResponseUtils.buildSuccess(photo); - } catch (Exception e) { - log.error("鑾峰彇鍥剧墖鏂囦欢寮傚父", e); - return BaseResponseUtils.buildException(e.getMessage()); - } - } - -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileSv.java deleted file mode 100644 index d0aea44..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/get/GetFileSv.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.dy.pipIrrWebFile.get; - -import com.dy.pipIrrGlobal.daoFi.WebFileMapper; -import com.dy.pipIrrGlobal.pojoFi.WebFile; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author ZhuBaoMin - * @date 2024-10-22 15:27 - * @LastEditTime 2024-10-22 15:27 - * @Description - */ - -@Slf4j -@Service -public class GetFileSv { - @Autowired - private WebFileMapper webFileMapper; - - /** - * 鏍规嵁ID鑾峰彇鏂囦欢瀵硅薄 - * @param fileId - * @return - */ - public WebFile getWebFileById(Long fileId) { - return webFileMapper.selectByPrimaryKey(fileId); - } -} -- Gitblit v1.8.0