Browse Source

Pull request #489: 无jira任务, release/10.0 合 bugfix/10.0

Merge in CORE/base-third from release/10.0 to bugfix/10.0

* commit '3230c231fdcfe002e38aca8eb5543b9febedc69a':
  无jira任务,persist合final
  REPORT-34320 块标签前的块标签含文本且文本尾部不是空格时会多出空白行
  REPORT-33863 html图片变成了图片后文字的背景图;html图片宽度大于实际盒子宽度时,图片后的文字丢失
  REPORT-32796 h1-h6标签,默认字体加粗不生效,默认margin值不生效
  build.third_step0.gradle edited online with Bitbucket
  build.third_step0.gradle edited online with Bitbucket
  更新apache工具类
  CORE-135 插件禁用再启用后Jackson实例化的java对象仍然用的插件卸载前的classLoader
  fix
  fix
  MOBILE-17909&MOBILE-17908 10.0微信》定时调度有微信任务时卸载微信插件,报错
  fix
  fix
  DEC-4839 druid没有写默认的ms连接前校验语句,hibernate也没加,最后导致出错
  无jira任务,打包失败
  REPORT-10262 html大文本精确分页
  REPORT-11516	富文本在内容前添加空格导出word和预览不一致
  build
  build
  build
bugfix/10.0
ju.ju 4 years ago
parent
commit
581000116f
  1. 53
      build.third_step0.gradle
  2. 17
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/Markup.java
  3. 4
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
  4. 16
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java
  5. 90
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/utils/DefaultPropertiesHandleUtils.java
  6. 1
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/pdf/PdfLine.java
  7. 2
      fine-jackson/src/main/java/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java
  8. 3
      fine-jackson/src/main/java/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java
  9. 2
      fine-spring/pom.xml
  10. 23
      pom.xml

53
build.third_step0.gradle

@ -16,7 +16,7 @@ targetCompatibility=1.7
//lib下的jar到classes文件夹
version='10.0'
jar{
baseName="fine-third"
zip64 true
@ -42,11 +42,21 @@ FileTree files =fileTree(dir:'./',include:'build*.gradle')
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf (java.io.File.separator))
def branchName=buildDir.substring(buildDir.lastIndexOf (java.io.File.separator)+1)
def date = new Date()
def formattedDate = date.format('yyyy.MM.dd')
def srcDir="."
def MVN_BRANCH = branchVariable.toUpperCase()
def maven_version_build = ""
def indexV = branchName.indexOf( "%2F");
if(indexV != -1){
version= branchName.substring(indexV+3, branchName.length()).toUpperCase()
maven_version_build = project.version +"-" + branchName.substring(0, indexV).toUpperCase() +"-SNAPSHOT"
} else {
version= branchName
maven_version_build = project.version +"-SNAPSHOT"
}
// @branch -
def maven_version="${version}-${MVN_BRANCH}-SNAPSHOT"
def maven_version="${version}.${formattedDate}"
def jar_version = version
configurations {
@ -67,13 +77,32 @@ publishing {
groupId "com.fr.third"
artifactId "fine-third"
version maven_version
ext.repo = 'release'
from components.java
}
third_build(MavenPublication) {
groupId "com.fr.third"
artifactId "fine-third"
version maven_version_build
ext.repo = 'snapshot'
from components.java
}
}
repositories {
maven {
url "http://mvn.finedevelop.com/repository/fanruan/"
name "release"
url "http://mvn.finedevelop.com/repository/fanruan-release/"
credentials {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
}
}
maven {
name "snapshot"
url "http://mvn.finedevelop.com/repository/fanruan/"
credentials {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
@ -83,6 +112,17 @@ publishing {
}
}
afterEvaluate {
tasks.withType(PublishToMavenRepository) { task ->
if (task.publication.hasProperty('repo') && task.publication.repo != task.repository.name) {
task.enabled = false
task.group = null
}
}
}
task unpack(type:Copy) {
delete classesDir
destinationDir=file(classesDir)
@ -114,4 +154,3 @@ task unpack(type:Copy) {
}
jar.dependsOn unpack

17
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/Markup.java

@ -52,6 +52,8 @@
package com.fr.third.v2.lowagie.text.html;
import com.fr.third.v2.lowagie.text.ElementTags;
import com.fr.third.v2.lowagie.text.html.simpleparser.ChainedProperties;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
@ -417,6 +419,21 @@ public class Markup {
return f;
}
/**
* 解析当前字号可能是继承来的
*
* @param cprops
* @return
*/
public static float parseDefaultFontSize(ChainedProperties cprops) {
if (null == cprops) {
return DEFAULT_FONT_SIZE;
}
String size = cprops.getProperty(ElementTags.SIZE);
return null == size ? Markup.DEFAULT_FONT_SIZE : Markup.parseLength(size,
Markup.DEFAULT_FONT_SIZE);
}
/**
* Converts a <CODE>Color</CODE> into a HTML representation of this <CODE>
* Color</CODE>.

4
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java

@ -211,14 +211,14 @@ public class FactoryProperties {
List<String> list = Markup.parseNESW(props.getPropertyFromChain("div", Markup.CSS_KEY_MARGIN));
if (null != list && 4 == list.size()) {
for (int i = 0; i < HtmlConstants.MARGIN.size() && i < list.size(); i++) {
p.setAttribute(HtmlConstants.MARGIN.get(i), list.get(i));
p.setAttribute(HtmlConstants.MARGIN.get(i), String.valueOf(Markup.parseLength(list.get(i), Markup.parseDefaultFontSize(props))));
}
}
}
for (String margin : HtmlConstants.MARGIN) {
if (props.hasPropertyInChain("div", margin)) {
String ss = props.getPropertyFromChain("div", margin);
p.setAttribute(margin, ss);
p.setAttribute(margin, String.valueOf(Markup.parseLength(ss, Markup.parseDefaultFontSize(props))));
}
}
}

16
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java

@ -50,6 +50,7 @@
package com.fr.third.v2.lowagie.text.html.simpleparser;
import com.fr.third.v2.lowagie.text.html.utils.DefaultPropertiesHandleUtils;
import com.fr.third.v2.lowagie.text.pdf.PdfFont;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
@ -211,17 +212,7 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
return;
try {
style.applyStyle(tag, h);
if(tag.equals("p")){
h.put(Markup.CSS_KEY_MARGINTOP, "16px");
h.put(Markup.CSS_KEY_MARGINBOTTOM, "16px");
}
if (tag.equals("th")) {
h.put("b", null);
}
if (tag.equals(HtmlTags.ANCHOR)) {
h.put("u", null);
h.put("color", "blue");
}
DefaultPropertiesHandleUtils.fillDefaultProperties(tag, h);
String follow = (String) FactoryProperties.followTags.get(tag);
if (follow != null) {
HashMap prop = new HashMap();
@ -736,7 +727,8 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener {
currentParagraph.add(chunk);
return;
}
if (content.trim().length() == 0 && content.indexOf(' ') < 0) {
if (content.trim().length() == 0 && null == currentParagraph) {
return;
}

90
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/utils/DefaultPropertiesHandleUtils.java

@ -0,0 +1,90 @@
package com.fr.third.v2.lowagie.text.html.utils;
import com.fr.third.v2.lowagie.text.html.HtmlTags;
import com.fr.third.v2.lowagie.text.html.Markup;
import java.util.HashMap;
import java.util.Properties;
/**
* 处理标签默认属性值
*
* @author Hugh.C
* @version 1.0
* Created by Hugh.C on 2020/7/3
*/
public class DefaultPropertiesHandleUtils {
//h1-h6 标签默认字体大小
private static final HashMap<String, String> H_TAG_DEFAULT_FONT_SIZE = new HashMap<String, String>(6);
//h1-h6 标签默认margin-top and bottom大小
private static final HashMap<String, String> H_TAG_DEFAULT_MARGIN = new HashMap<String, String>(6);
static {
H_TAG_DEFAULT_FONT_SIZE.put("h1", "2em");
H_TAG_DEFAULT_FONT_SIZE.put("h2", "1.5em");
H_TAG_DEFAULT_FONT_SIZE.put("h3", "1.17em");
H_TAG_DEFAULT_FONT_SIZE.put("h4", "1em");
H_TAG_DEFAULT_FONT_SIZE.put("h5", "0.83em");
H_TAG_DEFAULT_FONT_SIZE.put("h6", "0.67em");
H_TAG_DEFAULT_MARGIN.put("h1", "0.67em");
H_TAG_DEFAULT_MARGIN.put("h2", "0.83em");
H_TAG_DEFAULT_MARGIN.put("h3", "1em");
H_TAG_DEFAULT_MARGIN.put("h4", "1.33em");
H_TAG_DEFAULT_MARGIN.put("h5", "1.67em");
H_TAG_DEFAULT_MARGIN.put("h6", "2.33em");
}
/**
* 填充默认属性值
*
* @param tag
* @param h
*/
public static void fillDefaultProperties(String tag, HashMap h) {
if (null == tag || null == h) {
return;
}
if (HtmlTags.HEADERCELL.endsWith(tag)) {
h.put("b", null);
return;
}
if (HtmlTags.ANCHOR.equals(tag)) {
h.put("u", null);
h.put("color", "blue");
return;
}
String style = (String) h.get("style");
if (HtmlTags.PARAGRAPH.equals(tag)) {
Properties props = Markup.parseAttributes(style);
if (!props.containsKey(Markup.CSS_KEY_MARGINTOP)) {
h.put(Markup.CSS_KEY_MARGINTOP, "1em");
}
if (!props.containsKey(Markup.CSS_KEY_MARGINBOTTOM)) {
h.put(Markup.CSS_KEY_MARGINBOTTOM, "1em");
}
return;
}
if (H_TAG_DEFAULT_FONT_SIZE.containsKey(tag)) {
h.put("b", null);
Properties props = Markup.parseAttributes(style);
if (!props.containsKey(Markup.CSS_KEY_MARGINTOP)) {
h.put(Markup.CSS_KEY_MARGINTOP, H_TAG_DEFAULT_MARGIN.get(tag));
}
if (!props.containsKey(Markup.CSS_KEY_MARGINBOTTOM)) {
h.put(Markup.CSS_KEY_MARGINBOTTOM, H_TAG_DEFAULT_MARGIN.get(tag));
}
if (!props.containsKey(Markup.CSS_KEY_FONTSIZE)) {
h.put("style", new StringBuilder(null == style ? "" : style).append(";")
.append(Markup.CSS_KEY_FONTSIZE).append(":").append(H_TAG_DEFAULT_FONT_SIZE.get(tag)).append(";").toString());
}
return;
}
}
}

1
fine-itext/src/main/java/com/fr/third/v2/lowagie/text/pdf/PdfLine.java

@ -214,6 +214,7 @@ public class PdfLine {
// if the chunk couldn't even be truncated, we add everything, so be it
else if (overflow != null){
addToLine(overflow);
width = 0;
return null;
}else{
addToLine(chunk);

2
fine-jackson/src/main/java/com/fr/third/fasterxml/jackson/databind/type/ClassFactory.java

@ -8,4 +8,4 @@ public interface ClassFactory {
Class<?> classForName(String className) throws ClassNotFoundException;
Class<?> classForName(String className, ClassLoader classLoader) throws ClassNotFoundException;
}
}

3
fine-jackson/src/main/java/com/fr/third/fasterxml/jackson/databind/type/TypeFactory.java

@ -137,7 +137,7 @@ public final class TypeFactory
* ClassLoader used by this factory [databind#624].
*/
protected final ClassLoader _classLoader;
private ClassFactory classFactory;
/*
@ -146,6 +146,7 @@ public final class TypeFactory
/**********************************************************
*/
public void setClassFactory(ClassFactory classFactory) {
this.classFactory = classFactory;

2
fine-spring/pom.xml

@ -65,7 +65,7 @@
<artifactId>fine-javax-annotation</artifactId>
<version>${revision}</version>
</dependency>
<!-->以下是lib的本地jar包依赖<-->
<!-->以下是lib的本地jar包依赖<-->
<dependency>
<groupId>com.fr.third</groupId>
<artifactId>aopalliance</artifactId>

23
pom.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modules>
<module>fine-hibernate</module>
<module>fine-druid</module>
</modules>>
<parent>
<groupId>com.fr.maven</groupId>
<artifactId>finereport-maven</artifactId>
<version>10.0</version>
<relativePath>../finereport-maven</relativePath>
</parent>
<groupId>com.fr.third</groupId>
<artifactId>base-third-code</artifactId>
<version>${branch}</version>
<packaging>pom</packaging>
</project>
Loading…
Cancel
Save