lxw
2022-08-13 b72144f43b9851a9fc30678115869cca451af6e7
src/main/java/com/whyc/service/ProductBomService.java
@@ -58,7 +58,7 @@
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        cellStyle.setFont(font);
        //生成excel并将dwg文件放在同一报下压缩
        creatBomExcel(req,resp,boms,wb);
        creatBomExcel(req,resp,boms,wb,"pic");
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体图纸为数量:"+boms.size();
@@ -205,7 +205,7 @@
            }
        }
        //生成excel并将dwg文件放在同一报下压缩
        creatBomExcel(req,resp,list,wb);
        creatBomExcel(req,resp,list,wb,"bom");
        //记录日志
        DocUser docUser= ActionUtil.getUser();
        String operationDetail="具体产品母料型号为:"+parentModel;
@@ -214,7 +214,7 @@
        logService.recordOperationLog(docUser.getId(),docUser.getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),terminalIp,opreationMsg,operationDetail);
    }
    //根据产品信息创建excel表格并存放在指定目录
    public void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,List list, HSSFWorkbook wb){
    public void creatBomExcel(HttpServletRequest req, HttpServletResponse resp,List list, HSSFWorkbook wb,String type){
        String fileDirName = FileDirPath.getFileDirName();
        String rootFace="";
        String excelName="";
@@ -333,6 +333,10 @@
            File file=new File(rootFace+".zip");
            FileOutputStream forootFace = new FileOutputStream(file);
            ZipUtils.toZip(rootFace, forootFace,true);
            String timeStr= ActionUtil.sdfwithFTP.format(new Date());
            if(type.equals("pic")){
                excelName=timeStr;
            }
            // 转码防止乱码
            resp.addHeader("Content-Disposition", "attachment;filename="
                    + new String(excelName.getBytes("UTF-8"), "ISO8859-1")