diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/ScrapApplyDetailsServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/ScrapApplyDetailsServiceImpl.java index 5d4e04bc..db127df3 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/ScrapApplyDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/ScrapApplyDetailsServiceImpl.java @@ -72,7 +72,7 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService { @Override public List getFileUrl(String fileIds) { List fileUrlList = new ArrayList<>(); - if (fileIds!=null &&fileIds.isEmpty()){ + if (fileIds != null && !fileIds.isEmpty()) { for (String s : fileIds.split(",")) { String url = scrapApplyDetailsMapper.getFileUrl(s); fileUrlList.add(url); diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java index 225cd82d..1df54485 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java @@ -12,6 +12,7 @@ import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.openxml4j.util.ZipSecureFile; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -37,6 +38,11 @@ public class SysFileServiceImpl implements SysFileService { @Resource private FileInfoMapper dao; + /** + * 上传文件存储在本地的根路径 + */ + @Value("${file.path}") + private String localFilePath; /** * 本地文件上传接口 @@ -133,7 +139,7 @@ public class SysFileServiceImpl implements SysFileService { String tmpName = multipartFile.getOriginalFilename(); tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1); tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() + tmpName.substring(tmpName.lastIndexOf("."), tmpName.length()); - String imageFiles = "/data/sgzb/" + fileType + "/"; + String imageFiles = localFilePath + fileType + "/"; String os = System.getProperty("os.name"); if (os.toLowerCase().startsWith(GlobalConstants.STRING_WIN)) { imageFiles = "D://files/" + fileType + "/"; @@ -172,7 +178,7 @@ public class SysFileServiceImpl implements SysFileService { String tmpName = multipartFile.getOriginalFilename(); tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1); tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() + tmpName.substring(tmpName.lastIndexOf("."), tmpName.length()); - String imageFiles = "/data/sgzb/" + fileType + "/"; + String imageFiles = localFilePath + fileType + "/"; String os = System.getProperty("os.name"); if (os.toLowerCase().startsWith(GlobalConstants.STRING_WIN)) { imageFiles = "D://files/" + fileType + "/";