From f71f31780ed55200f3e370e61c81cfd05feb34bd Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期五, 10 四月 2026 14:25:01 +0800
Subject: [PATCH] 对接网关的地磅抓拍,生成批复告警内容

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/FileService.java |  171 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 149 insertions(+), 22 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 accef06..c2f37cc 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
@@ -2,7 +2,9 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fzzy.igds.domain.FileInfo;
+import com.fzzy.igds.domain.Quantity;
 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;
@@ -30,6 +32,29 @@
     private FileMapper fileMapper;
 
     /**
+     * 鏍规嵁鏉′欢鑾峰彇闄勪欢淇℃伅
+     * @param companyId
+     * @param bizId
+     * @return
+     */
+    public List<FileInfo> listFile(String companyId, String bizId) {
+        if (StringUtils.isEmpty(companyId)) {
+            companyId = ContextUtil.getCompanyId();
+        }
+
+        if (StringUtils.isEmpty(bizId)){
+            return null;
+        }
+
+        QueryWrapper<FileInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("company_id", companyId);
+        queryWrapper.eq("biz_id", bizId);
+        queryWrapper.orderByAsc("create_time");
+
+        return fileMapper.selectList(queryWrapper);
+    }
+
+    /**
      * 寮傛鎵ц闄勪欢淇濆瓨
      * @param files     闄勪欢淇℃伅
      * @param bizId     涓氬姟id
@@ -50,10 +75,13 @@
             }
 
             data.setId(ContextUtil.generateId());
+            data.setCreateTime(new Date());
+            data.setCreateBy(ContextUtil.getLoginUserName());
             data.setCompanyId(ContextUtil.getCompanyId());
 
             //鏂囦欢鍏ㄨ矾寰�
             String filePath = getFileSavePath(pathTag) + data.getFileName();
+
             filePath = filePath.replace(FrameworkConfig.getProfile(), "/profile/");
             data.setFilePath(filePath);
 
@@ -64,14 +92,28 @@
                 data.setBizTag(bizTag);
             }
 
-            data.setCreateTime(new Date());
-            data.setCreateBy(ContextUtil.getLoginUserName());
-
-            data.setUpdateTime(new Date());
-            data.setUpdateBy(ContextUtil.getLoginUserName());
-            fileMapper.insert(data);
+            saveFile(data);
         }
     }
+
+    /**
+     *
+     * @param data
+     */
+    public void saveFile(FileInfo data) {
+
+        data.setUpdateTime(new Date());
+        data.setUpdateBy(ContextUtil.getLoginUserName());
+
+        if(StringUtils.isBlank(data.getId())){
+            data.setId(ContextUtil.UUID());
+            data.setCreateTime(new Date());
+            data.setCreateBy(ContextUtil.getLoginUserName());
+        }
+
+        fileMapper.insert(data);
+    }
+
 
     /**
      * 鏍规嵁鏉′欢鏌ヨ鏁版嵁
@@ -98,15 +140,7 @@
     }
 
     /**
-     *
-     * @param id
-     */
-    public void delFile(String id) {
-        fileMapper.deleteById(id);
-    }
-
-    /**
-     * 鑾峰彇鍑哄叆搴撴枃浠惰矾寰�
+     * 鏍规嵁绫诲瀷鑾峰彇鏂囦欢璺緞
      * @param pathTag
      * @return
      */
@@ -114,19 +148,79 @@
         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("QUANTITY".equals(pathTag)) return getQuantityPath();
+        if("WORD".equals(pathTag)) return getWordPath();
+        if("WEIGHTNAP".equals(pathTag)) return getWeightSnapPath();
 
         return getCommonFilePath();
     }
 
     /**
-     * 鑾峰彇鍑哄叆搴撴枃浠惰矾寰�
+     * 鑾峰彇浜嬩欢鏂囦欢璺緞
+     * @return
+     */
+    public String getQuantityPath() {
+        String basePath = FrameworkConfig.getProfile() + "QUANTITY/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
+        File file = new File(basePath);
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+        return basePath;
+    }
+
+    /**
+     * 鑾峰彇浜嬩欢鏂囦欢璺緞
+     * @return
+     */
+    public String getWeightSnapPath() {
+        String basePath = FrameworkConfig.getProfile() + "WEIGHTNAP/" + DateFormatUtils.format(new Date(), "yyyyMM") + "/";
+        File file = new File(basePath);
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+        return basePath;
+    }
+
+    /**
+     * 鑾峰彇浜嬩欢鏂囦欢璺緞
+     * @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 +273,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 +297,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);
     }
 
     /**
@@ -252,4 +378,5 @@
         return path;
     }
 
+
 }

--
Gitblit v1.9.3