| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | |
| | | } else if (staticFieldValue != null) { |
| | | String valStr = staticFieldValue.toString(); |
| | | if (valStr.contains("文件图片:")) { |
| | | valStr = valStr.replace("文件图片:", ""); |
| | | valStr = localPath + valStr.replace("文件图片:", ""); |
| | | File file = new File(valStr); |
| | | if (file.exists()) { |
| | | try (InputStream in = ossEncryptService.decrypt(file)) { |
| | | staticFieldValue = new PictureRenderData(500, 500, ".png", in); |
| | | InputStream in2 = ossEncryptService.decrypt(file); |
| | | BufferedImage bufferedImage = ImageIO.read(in2); |
| | | int width = bufferedImage.getWidth(); |
| | | int height = bufferedImage.getHeight(); |
| | | staticFieldValue = new PictureRenderData(width, height, ".png", in); |
| | | /*staticFieldValue = new PictureRenderData(80, 100, "d://" + valStr);*/ |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | staticFieldValue = new PictureRenderData(100, 30, "template/noSign.png"); |
| | | } |
| | | } |
| | | } |
| | | if (wordData.get(fieldName) == null) |
| | | wordData.put(fieldName, staticFieldValue); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |