| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | |
| | | String attr = parse.head().attr("name"); |
| | | |
| | | staticPathParser(parse, "img", "src"); |
| | | staticPathParser(parse, "href", "link"); |
| | | staticPathParser(parse, "link", "href"); |
| | | staticPathParser(parse, "script", "src"); |
| | | |
| | | FileOutputStream outputStream = new FileOutputStream(file); |
| | | outputStream.write(parse.html().getBytes()); |
| | | outputStream.close(); |
| | | |
| | | CmsTemplateEntity cmsTemplate = new CmsTemplateEntity(); |
| | | cmsTemplate.setCompanyId(companyId); |
| | |
| | | for (Element element : elements) { |
| | | String attr = element.attr(attrKey); |
| | | if (StrUtil.isNotBlank(attr) && !attr.contains("http://") && !attr.contains("https://")) { |
| | | element.attr(attrKey, cmsProperties.getStaticPath() + attr); |
| | | element.attr(attrKey, cmsProperties.getStaticUrl() + attr); |
| | | } |
| | | } |
| | | } |