From 0c8d20900c14651cb50180ade4ccd0e2074796b4 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期三, 07 一月 2026 18:38:01 +0800
Subject: [PATCH] 质押监管接口解析
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java | 107 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 91 insertions(+), 16 deletions(-)
diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
index c6c9507..5c3c073 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzzy.igds.domain.FileInfo;
import com.fzzy.igds.mapper.FileMapper;
+import com.fzzy.igds.utils.Base64Util;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.config.FrameworkConfig;
import org.apache.commons.lang3.time.DateFormatUtils;
@@ -98,15 +99,7 @@
}
/**
- *
- * @param id
- */
- public void delFile(String id) {
- fileMapper.deleteById(id);
- }
-
- /**
- * 鑾峰彇鍑哄叆搴撴枃浠惰矾寰�
+ * 鏍规嵁绫诲瀷鑾峰彇鏂囦欢璺緞
* @param pathTag
* @return
*/
@@ -114,19 +107,51 @@
if(StringUtils.isBlank(pathTag)){
pathTag = "COMMON";
}
+ if("EVENT".equals(pathTag)) return getEventFilePath();
+ if("SNAP".equals(pathTag)) return getSnapFilePath();
if("INOUT".equals(pathTag)) return getInoutFilePath();
if("PATROL".equals(pathTag)) return getPatrolFilePath();
if("DEPT".equals(pathTag)) return getDeptFilePath();
+ if("TEMP".equals(pathTag)) return getTempFilePath();
+ if("CONF".equals(pathTag)) return getConfPath();
+ if("TEMPLATE".equals(pathTag)) return getTemplateFilePath();
+ if("WORD".equals(pathTag)) return getWordPath();
return getCommonFilePath();
}
/**
- * 鑾峰彇鍑哄叆搴撴枃浠惰矾寰�
+ * 鑾峰彇浜嬩欢鏂囦欢璺緞
+ * @return
+ */
+ public String getEventFilePath() {
+ String basePath = FrameworkConfig.getProfile() + "EVENT/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
+
+ /**
+ * 鑾峰彇鎶撴媿鏂囦欢璺緞
+ * @return
+ */
+ public String getSnapFilePath() {
+ String basePath = FrameworkConfig.getProfile() + "SNAP/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
+
+ /**
+ * 鑾峰彇宸℃鏂囦欢璺緞
* @return
*/
public String getPatrolFilePath() {
- String basePath = FrameworkConfig.getProfile() + "INOUT/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
+ String basePath = FrameworkConfig.getProfile() + "PATROL/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
File file = new File(basePath);
if (!file.exists()) {
file.mkdirs();
@@ -179,15 +204,11 @@
/**
* 鑾峰彇涓存椂璺緞
- * @param companyId
* @return
*/
- public String getTempFilePath(String companyId) {
+ public String getTempFilePath() {
String basePath = FrameworkConfig.getProfile() + "TEMP/";
- if (org.apache.commons.lang3.StringUtils.isNotEmpty(companyId)) {
- basePath += companyId + "/";
- }
File file = new File(basePath);
if (!file.exists()) {
file.mkdirs();
@@ -207,6 +228,42 @@
file.mkdirs();
}
return basePath;
+ }
+
+ /**
+ * 鑾峰彇妯℃澘璺緞锛氭墍鏈夋ā鏉跨粺涓�鏀惧湪TEMPLATE/鐩綍涓�
+ * @return
+ */
+ public String getTemplateFilePath() {
+ String basePath = FrameworkConfig.getProfile() + "TEMPLATE/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
+
+ /**
+ * 鑾峰彇word璺緞
+ * @return
+ */
+ public String getWordPath() {
+
+ String basePath = FrameworkConfig.getProfile() + "WORD/";
+ File file = new File(basePath);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ return basePath;
+ }
+
+ /**
+ * base64杞浘鐗囦繚瀛�
+ * @param filePath
+ * @param imgData
+ */
+ public void baseImg2Disk(String filePath, String imgData) {
+ Base64Util.generateImage(imgData, filePath);
}
/**
@@ -233,6 +290,24 @@
ImageIO.write(compressedImage, "jpg", new File(outputPath));
}
+ /**
+ * 鍒ゆ柇璺緞涓嬫枃浠舵槸鍚﹀瓨鍦紝涓嶅瓨鍦ㄥ垯缁欓粯璁�
+ * @param imgPath
+ * @return
+ */
+ public String isImgExit(String imgPath, String tag) {
+ String path = "/img/img-fail.jpg";
+ if(StringUtils.isNotBlank(tag) && "dept".equals(tag)){
+ path = "/img/deptImg.jpg";
+ }
+ if(StringUtils.isNotBlank(imgPath)){
+ File file = new File(imgPath.replace("/profile", FrameworkConfig.getProfile()));
+ if(file.exists()){
+ path = imgPath;
+ }
+ }
+ return path;
+ }
}
--
Gitblit v1.9.3