lxw
2022-08-17 bf1a97cd7d60f316022d5c5859261ccf8181558f
软件下载
1个文件已修改
4 ■■■ 已修改文件
src/main/java/com/whyc/service/ProductSoftwareService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/ProductSoftwareService.java
@@ -4,6 +4,7 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.UserOperation;
import com.whyc.dto.FileDirPath;
import com.whyc.dto.Response;
import com.whyc.dto.ZipUtils;
import com.whyc.mapper.ProductSoftwareMapper;
@@ -47,6 +48,7 @@
    }
    //根据软件名称实现软件下载
    public void downLoadSoftware(HttpServletRequest req, HttpServletResponse resp, String softwareName) {
        String fileDirName = FileDirPath.getFileDirName();
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("software_name",softwareName);
        wrapper.last("limit 1");
@@ -56,7 +58,7 @@
            resp.addHeader("Content-Disposition", "attachment;filename="
                    + new String(softwareName.getBytes("UTF-8"), "ISO8859-1"));
            OutputStream out = resp.getOutputStream();
            FileInputStream in = new FileInputStream(software.getSoftwareUrl());
            FileInputStream in = new FileInputStream(fileDirName+File.separator+software.getSoftwareUrl());
            int len=0;
            byte[] buffer =new byte[1024];
            //7. 将缓冲区中的数据输出