wente
2024-01-15 f381953105a1d4d9f08467b3529d6f3f2f8ef858
core/src/main/java/com/zt/life/export/service/WordFileService.java
@@ -62,31 +62,36 @@
            Object staticFieldValue = ReflectUtil.getFieldValue(dataObj, field.getName()); // 属性对应的数据
            if (typeName.contains("com.zt.life.modules")) {
                formatWordData(staticFieldValue, wordData, builder);
            }else {
            } else {
                if (field.getType().getName().equals("java.util.List")) {
                    builder.bind(fieldName, new HackLoopTableRenderPolicy());
                } else if (staticFieldValue != null) {
                    if (typeName.contains("java.util.Date") && fieldName.contains("Date")) {
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        staticFieldValue=sdf.format(staticFieldValue);
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
                        staticFieldValue = sdf.format(staticFieldValue);
                    }
                    String valStr = staticFieldValue.toString();
                    if (valStr.contains("文件图片:")) {
                        valStr = localPath + valStr.replace("文件图片:", "");
                        File file = new File(valStr);
                        if (file.exists()) {
                        if (file.exists() && !localPath.equals(valStr)) {
                            try (InputStream in = ossEncryptService.decrypt(file)) {
                                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);
                                if (width > 900 ) {
                                    height = (height * 900) / width;
                                    staticFieldValue = new PictureRenderData(900, height, ".png", in);
                                } else {
                                    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");
                            staticFieldValue = new PictureRenderData(100, 30, localPath + "template/noSign.png");
                        }
                    }
                }