init: WordFileParse docx→HTML 解析服务(含 Word EQ 域公式修复)
服务:Spring Boot 3.2 + docx4j 8.3.9,POST /api/v3/server_office_file/file/parse
接受 .docx,返回 HTML(公式 → LaTeX,图片 → RustFS 外链)
公式支持三类来源:
- OMML(Word 2007+ 公式) → Python omml_mathml2latex
- MathType OLE 对象 → Ruby mathtype2mathml → MathML → LaTeX
- Word EQ 域(老教辅主力) → EqToLatexUtil(本次新增)
本次改动:
1. 新增 java-svc/.../core/EqToLatexUtil.java:
移植自 jby backend-services office-core,EQ 语法 → LaTeX
(\f→\dfrac、\r→\sqrt、\i→\int/\sum/\prod、\s→^{}/_{}、\b→\left\right、
\a→array、\x→\boxed/\overline、\o\al 堆叠、圈码、化学符号、极限、连等式)
品牌标记 JBYU* → WPU*,与采集端一致
2. CtoMathFinder:接上 EQ 分支(原为 not-ported 桩),域代码经
EqToLatexUtil.convert 转 LaTeX 写入 eqLatexMap(WPEQNUM 占位符)
3. WordParseUtil.dealPlaceholder:EQ 的 LaTeX 同样加 \( \) 包裹
(原先因 WPEQNUM 例外不加包裹,前端/MathJax 不渲染)
修前症状:教辅 Word 里分式/方程组/上下标整段丢失(如 {−1/3, 1} 变成 {-,1})
修后实测:46 份教辅 2908 处 EQ 域全部还原,公式总数 2954 处、零未包裹残留
安全:application.yml(含 RustFS 密钥)不入库,提供 application.yml.example;
OssService 的 @Value 默认密钥已清空
This commit is contained in:
123
java-src/domain/bo/ImageBO.java
Normal file
123
java-src/domain/bo/ImageBO.java
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package com.jby.officecore.domain.bo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ImageBO
|
||||
implements Serializable {
|
||||
private static final long serialVersionUID = 6640950035295880234L;
|
||||
private InputStream is;
|
||||
private Double width;
|
||||
private Double height;
|
||||
private Integer pictureType;
|
||||
private String pictureUrl;
|
||||
|
||||
public InputStream getIs() {
|
||||
return this.is;
|
||||
}
|
||||
|
||||
public Double getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public Double getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public Integer getPictureType() {
|
||||
return this.pictureType;
|
||||
}
|
||||
|
||||
public String getPictureUrl() {
|
||||
return this.pictureUrl;
|
||||
}
|
||||
|
||||
public ImageBO setIs(InputStream is) {
|
||||
this.is = is;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImageBO setWidth(Double width) {
|
||||
this.width = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImageBO setHeight(Double height) {
|
||||
this.height = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImageBO setPictureType(Integer pictureType) {
|
||||
this.pictureType = pictureType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImageBO setPictureUrl(String pictureUrl) {
|
||||
this.pictureUrl = pictureUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ImageBO)) {
|
||||
return false;
|
||||
}
|
||||
ImageBO other = (ImageBO)o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
InputStream this$is = this.getIs();
|
||||
InputStream other$is = other.getIs();
|
||||
if (this$is == null ? other$is != null : !this$is.equals(other$is)) {
|
||||
return false;
|
||||
}
|
||||
Double this$width = this.getWidth();
|
||||
Double other$width = other.getWidth();
|
||||
if (this$width == null ? other$width != null : !((Object)this$width).equals(other$width)) {
|
||||
return false;
|
||||
}
|
||||
Double this$height = this.getHeight();
|
||||
Double other$height = other.getHeight();
|
||||
if (this$height == null ? other$height != null : !((Object)this$height).equals(other$height)) {
|
||||
return false;
|
||||
}
|
||||
Integer this$pictureType = this.getPictureType();
|
||||
Integer other$pictureType = other.getPictureType();
|
||||
if (this$pictureType == null ? other$pictureType != null : !((Object)this$pictureType).equals(other$pictureType)) {
|
||||
return false;
|
||||
}
|
||||
String this$pictureUrl = this.getPictureUrl();
|
||||
String other$pictureUrl = other.getPictureUrl();
|
||||
return !(this$pictureUrl == null ? other$pictureUrl != null : !this$pictureUrl.equals(other$pictureUrl));
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object other) {
|
||||
return other instanceof ImageBO;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int PRIME = 59;
|
||||
int result = 1;
|
||||
InputStream $is = this.getIs();
|
||||
result = result * 59 + ($is == null ? 43 : $is.hashCode());
|
||||
Double $width = this.getWidth();
|
||||
result = result * 59 + ($width == null ? 43 : ((Object)$width).hashCode());
|
||||
Double $height = this.getHeight();
|
||||
result = result * 59 + ($height == null ? 43 : ((Object)$height).hashCode());
|
||||
Integer $pictureType = this.getPictureType();
|
||||
result = result * 59 + ($pictureType == null ? 43 : ((Object)$pictureType).hashCode());
|
||||
String $pictureUrl = this.getPictureUrl();
|
||||
result = result * 59 + ($pictureUrl == null ? 43 : $pictureUrl.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ImageBO(is=" + this.getIs() + ", width=" + this.getWidth() + ", height=" + this.getHeight() + ", pictureType=" + this.getPictureType() + ", pictureUrl=" + this.getPictureUrl() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user