create 2022/4/18 4:32 PM
+ * + * @author ayh + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +@Documented +public @interface BooleanConverter { + /** + * 数据库字段累心 + * @return + */ + BooleanConverterEnum value(); + + /** + * 如果是字符串,那么当字符串等于什么的时候为true + * @return + */ + String trueStr() default "true"; + + /** + * 如果是字符串,那么当字符串等与什么的时候为false + * @return + */ + String falseStr() default "false"; + + /** + * 数字,如果等于多少的时候是true + * @return + */ + String trueInteger() default "1"; + + /** + * 数字,,但如果等于多少的时候是false + * @return + */ + String falseInteger() default "0"; + + /** + * 当字段有值时就为给定的默认值 + * @return + */ + boolean hasValueTrue() default false; + + /** + * 如果没有这个字段或者数据库数据为null时给定的值 + * @return + */ + boolean defaultValue() default false; +} diff --git a/src/main/java/aiyh/utils/annotation/BooleanConverterEnum.java b/src/main/java/aiyh/utils/annotation/BooleanConverterEnum.java new file mode 100644 index 0000000..675c9dd --- /dev/null +++ b/src/main/java/aiyh/utils/annotation/BooleanConverterEnum.java @@ -0,0 +1,19 @@ +package aiyh.utils.annotation; + +/** + * + *create 2022/4/18 4:34 PM
+ * + * @author ayh + */ + +public enum BooleanConverterEnum { + /** + * 数据库字段类型为varchar 其实这个是通用的,无所谓 + */ + STRING, + /** + * 数据库字段是int类型的 + */ + INTEGER +} diff --git a/src/main/java/aiyh/utils/apirequest/core/factory/AbstractFactoryImpl.java b/src/main/java/aiyh/utils/apirequest/core/factory/AbstractFactoryImpl.java index 77a1a86..7942b70 100644 --- a/src/main/java/aiyh/utils/apirequest/core/factory/AbstractFactoryImpl.java +++ b/src/main/java/aiyh/utils/apirequest/core/factory/AbstractFactoryImpl.java @@ -21,6 +21,9 @@ public class AbstractFactoryImpl implements AbstractFactory { if (DataSourceHandlerFactory.class.equals(type)) { return (T) new DataSourceHandlerFactory(); } + if(ApiAsyncFactory.class.equals(type)){ + return (T) new ApiAsyncFactory(); + } return null; } } diff --git a/src/main/java/aiyh/utils/apirequest/core/factory/DataSourceHandlerFactory.java b/src/main/java/aiyh/utils/apirequest/core/factory/DataSourceHandlerFactory.java index 3b6f6b3..7529182 100644 --- a/src/main/java/aiyh/utils/apirequest/core/factory/DataSourceHandlerFactory.java +++ b/src/main/java/aiyh/utils/apirequest/core/factory/DataSourceHandlerFactory.java @@ -4,7 +4,6 @@ import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler; import aiyh.utils.apirequest.core.typehandler.datasource.ModelDataHandler; import aiyh.utils.apirequest.core.typehandler.datasource.WorkflowDataHandler; import aiyh.utils.apirequest.enumtype.DataSourceRuleEnum; -import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum; /** *解析参数处理器工厂
@@ -14,7 +13,7 @@ import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum; */ -public class DataSourceHandlerFactory implements ParamHandlerFactory参数处理工厂接口
- *create 2022/1/24 0024 10:59
- * - * @author EBU7-dev1-ayh - */ - - -public interface ParamHandlerFactorycreate 2022/5/6 4:00 PM
+ * + * @author ayh + */ +@Data +public class DocImageInfo { + + private Integer docId; + private Integer imageFileId; + private String imageFileName; + private Integer id; + +} diff --git a/src/main/java/aiyh/utils/entity/WorkflowNodeConfig.java b/src/main/java/aiyh/utils/entity/WorkflowNodeConfig.java new file mode 100644 index 0000000..9e7958d --- /dev/null +++ b/src/main/java/aiyh/utils/entity/WorkflowNodeConfig.java @@ -0,0 +1,19 @@ +package aiyh.utils.entity; + +import lombok.Data; + +/** + * + *create 2022/5/16 11:45
+ * + * @author ayh + */ + +@Data +public class WorkflowNodeConfig { + private String id; + private String workflowType; + private String markOnly; + private String workflowNodes; + private String enableNodes; +} diff --git a/src/main/java/aiyh/utils/excention/CustomerException.java b/src/main/java/aiyh/utils/excention/CustomerException.java new file mode 100644 index 0000000..1984afa --- /dev/null +++ b/src/main/java/aiyh/utils/excention/CustomerException.java @@ -0,0 +1,56 @@ +package aiyh.utils.excention; + +import aiyh.utils.Util; +import org.apache.log4j.Logger; + +/** + *自定义异常类
+ *create 2022/3/9 2:20 PM
+ * + * @author ayh + */ + +public class CustomerException extends RuntimeException{ + private Logger logger = Util.getLogger(); + private String msg; + private Throwable throwable; + private Integer code; + + public CustomerException(String msg){ + super(msg); + this.msg = msg; + } + + public CustomerException(String msg,Integer code){ + super(msg); + this.code = code; + this.msg = msg; + } + public CustomerException(String msg, Integer code, Throwable throwable){ + super(msg); + this.code= code; + this.msg = msg; + } + public CustomerException(String msg, Throwable throwable){ + super(msg,throwable); + this.msg = msg; + this.throwable = throwable; + } + + @Override + public void printStackTrace() { + logger.error("二开自定义异常:" + this.msg); + if(this.throwable != null){ + logger.error("异常信息: " + Util.getErrString(this.throwable)); + } + } + + public Integer getCode (){ + return this.code; + } + + @Override + public String getMessage() { + return this.msg; + } +} diff --git a/src/main/java/aiyh/utils/excention/monad/Try.java b/src/main/java/aiyh/utils/excention/monad/Try.java new file mode 100644 index 0000000..e26703e --- /dev/null +++ b/src/main/java/aiyh/utils/excention/monad/Try.java @@ -0,0 +1,369 @@ +package aiyh.utils.excention.monad; + +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; + +/** + * url: https://github.com/jasongoodwin/better-java-monads/blob/master/src/main/java/com/jasongoodwin/monads/Try.java + * Monadic Try type. + * Represents a result type that could have succeeded with type T or failed with a Throwable. + * Originally was Exception but due to seeing issues with eg play with checked Throwable, + * And also seeing that Scala deals with throwable, + * I made the decision to change it to use Throwable. + * + * @param自定义pdf读取监听器
+ *create 2022/4/27 3:45 PM
+ * + * @author ayh + */ + +public class CustomerPdfRenderListener implements RenderListener { + + private final Listpdf关键字坐标信息
+ *create 2022/4/27 3:41 PM
+ * + * @author ayh + */ + +public class PdfPointItem { + /** + * 当前查询的关键字 + */ + private String kewWords; + /** + * 当前关键字所在开始位置的页码 + */ + private int startPage; + /** + * 当前关键字结束位置所在的耶main + */ + private int endPage; + /** + * 关键字开始坐标x + */ + private float startPointX; + /** + * 关键字开始坐标y + */ + private float startPointY; + /** + * 关键字结束坐标x + */ + private float endPointX; + /** + * 关键字结束坐标y + */ + private float endPointY; + /** + * 总页面 + */ + private int totalPage; + + public String getKewWords() { + return kewWords; + } + + public void setKewWords(String kewWords) { + this.kewWords = kewWords; + } + + public int getStartPage() { + return startPage; + } + + public int getEndPage() { + return endPage; + } + + public void setEndPage(int endPage) { + this.endPage = endPage; + } + + public void setStartPage(int startPage) { + this.startPage = startPage; + } + + public float getStartPointX() { + return startPointX; + } + + public void setStartPointX(float startPointX) { + this.startPointX = startPointX; + } + + public float getStartPointY() { + return startPointY; + } + + public void setStartPointY(float startPointY) { + this.startPointY = startPointY; + } + + public float getEndPointX() { + return endPointX; + } + + public void setEndPointX(float endPointX) { + this.endPointX = endPointX; + } + + public float getEndPointY() { + return endPointY; + } + + public void setEndPointY(float endPointY) { + this.endPointY = endPointY; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + @Override + public String toString() { + return "PdfPointItem{" + + ", kewWords='" + kewWords + '\'' + + ", startPage=" + startPage + + ", endPage=" + endPage + + ", startPointX=" + startPointX + + ", startPointY=" + startPointY + + ", endPointX=" + endPointX + + ", endPointY=" + endPointY + + ", totalPage=" + totalPage + + '}'; + } +} diff --git a/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java new file mode 100644 index 0000000..90d8a1f --- /dev/null +++ b/src/main/java/aiyh/utils/fileUtil/pdf/PdfUtil.java @@ -0,0 +1,245 @@ +package aiyh.utils.fileUtil.pdf; + +import aiyh.utils.Util; +import aiyh.utils.excention.CustomerException; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Image; +import com.itextpdf.text.pdf.PdfContentByte; +import com.itextpdf.text.pdf.PdfGState; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.parser.PdfReaderContentParser; +import org.apache.log4j.Logger; +import weaver.file.FileUpload; +import weaver.file.ImageFileManager; +import weaver.system.SystemComInfo; + +import java.io.*; +import java.net.URLDecoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import java.util.UUID; + +/** + *pdf工具类
+ *create 2022/4/27 4:16 PM
+ * + * @author ayh + */ + +public class PdfUtil { + + private static final Logger log = Util.getLogger("util_water_log"); + + /** + * 获取关键字位置信息 + * + * @param inputStream pdf文件流 + * @param keyword 关键字 + * @return 关键字位置信息 + */ + public static List