| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |