sgj
2026-03-10 ea4b6749adbd7dae4ccff32f9f7bd5fcdc0ab3b2
fzzy-igdss-view/src/main/java/com/fzzy/igds/FileUploadManage.java
@@ -4,6 +4,7 @@
import com.bstek.dorado.uploader.annotation.FileResolver;
import com.fzzy.igds.service.FileService;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.config.FrameworkConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils;
@@ -13,7 +14,6 @@
import java.io.IOException;
import java.util.Date;
import java.util.Map;
/**
 * @Description Dorado7 附件上传公共管理层
@@ -38,16 +38,22 @@
   @FileResolver
   public String imgFile(UploadFile file, Map<String, Object> parameter) {
      String fileId = null;
      String filePath = null;
      try {
         String basePath = fileService.getFileSavePath("DEPT");
         fileId = "aerial-" + ContextUtil.subDeptId(null)
         //新文件名
         String fileId = "aerial-" + ContextUtil.subDeptId(null)
               + file.getFileName().substring(
               file.getFileName().lastIndexOf("."));
         //文件全路径
         filePath = basePath + fileId;
         //保存
         file.transferTo(new File(filePath));
         file.transferTo(new File(basePath + fileId));
         //替换后文件全路径
         filePath = filePath.replace(FrameworkConfig.getProfile(), "/profile/");
      } catch (IllegalStateException e) {
         e.printStackTrace();
@@ -55,7 +61,7 @@
         e.printStackTrace();
      }
      return fileId;
      return filePath;
   }
   /**
@@ -91,4 +97,35 @@
      return newFileName;
   }
   /**
    * 上传出入库导入Excel模板
    * fileUploadManage#uploadExcel
    * @param file
    * @param parameter
    * @return
    */
   @FileResolver
   public String uploadExcel(UploadFile file, Map<String, Object> parameter) {
      String newFileName = null;
      try {
         String basePath = fileService.getFileSavePath("TEMP");
         newFileName = DateFormatUtils.format(new Date(), "yyyyMMddHHmmss");
         newFileName = "EXCEL" + "_" + newFileName;
         // 文件后缀名
         String suffixName = file.getFileName().substring(file.getFileName().lastIndexOf("."));
         // 合成新的文件名
         newFileName = newFileName + suffixName;
         file.transferTo(new File(basePath + newFileName));
      } catch (IllegalStateException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return newFileName;
   }
}