whycxzp
2022-09-16 799c0abc3691c63806e978af57c2e16a96da7cca
更新图纸对比
1个文件已修改
40 ■■■■■ 已修改文件
src/main/java/com/whyc/service/MaterialService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/MaterialService.java
@@ -12,6 +12,7 @@
import com.whyc.pojo.ProductBom;
import com.whyc.util.DateUtil;
import com.whyc.util.*;
import org.apache.commons.codec.binary.Base64;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,7 +24,10 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -453,20 +457,24 @@
        }
        ByteArrayOutputStream stream = ImageDiff.compareImages(absoluteDwgPngPath, absoluteDwgPngPath2);
        String fileName = "name.png";
        OutputStream toClient = null;
        try {
            response.setContentType("application/octet-stream");
            response.addHeader("Content-Disposition","attachment;filename=" + fileName);
            toClient = response.getOutputStream();
            toClient.write(stream.toByteArray());
            toClient.flush();
            toClient.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
        return new Response().setII(1,true, Base64.encodeBase64(stream.toByteArray()),null);
        //String fileName = "name.png";
        //OutputStream toClient = null;
        //try {
        //    response.setContentType("application/octet-stream");
        //    response.setHeader("Content-Disposition","attachment;filename=" + fileName);
        //    response.addHeader("Pragma", "no-cache");
        //    response.addHeader("Cache-Control", "no-cache");
        //    toClient = response.getOutputStream();
        //    stream.writeTo(toClient);
        //    //toClient.write(stream.toByteArray());
        //    toClient.flush();
        //    toClient.close();
        //} catch (IOException e) {
        //    e.printStackTrace();
        //}
        //
        //
        //return null;
    }
}