管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-18 f0575e4223310b694ff409e870cebaf1d93d2198
src/main/java/com/lf/server/service/all/BaseUploadService.java
@@ -45,7 +45,7 @@
    /**
     * 上传文件
     */
    public <T> List<MetaFileEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception {
    public <T> List<MetaFileEntity> uploadData(T t, String path, boolean isGetGuid, HttpServletRequest req, HttpServletResponse res) throws Exception {
        StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req;
        req.setCharacterEncoding("utf-8");
        res.setContentType("application/json;charset=utf-8");
@@ -54,7 +54,7 @@
            setEntity(t, request);
        }
        return getFiles(path, request);
        return getFiles(path, isGetGuid, request);
    }
    /**
@@ -97,7 +97,7 @@
    /**
     * 获取文件
     */
    public List<MetaFileEntity> getFiles(String subPath, StandardMultipartHttpServletRequest req) throws Exception {
    public List<MetaFileEntity> getFiles(String subPath, boolean isGetGuid, StandardMultipartHttpServletRequest req) throws Exception {
        List<MetaFileEntity> list = new ArrayList<>();
        String path = pathHelper.getTempPath(subPath);
@@ -116,7 +116,9 @@
            mf.setPath(path + File.separator + mf.getName());
            file.transferTo(new File(mf.getPath()));
            mf.setGuid(FileHelper.getFileMd5(mf.getPath()));
            if (isGetGuid) {
                mf.setGuid(FileHelper.getFileMd5(mf.getPath()));
            }
            list.add(mf);
        }