Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12.15 #261

Merged
merged 29 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
578b6d2
update erupt-log.html
Jul 3, 2024
20ef259
优化代码格式
Jul 9, 2024
e8a582f
优化代码格式,增加 JUL 的日志appender
Jul 11, 2024
6642464
name alignment use leftPad
Jul 11, 2024
b9d2d2d
优化对齐的算法逻辑
Jul 11, 2024
3f44879
update log html
erupts Jul 16, 2024
15de516
重写工作流代码
Jul 17, 2024
75ecf30
优化删除性能
Jul 17, 2024
17ff949
调整代码格式
Jul 18, 2024
368bd8f
tagType增加maxTagCount配置,控制最大可选择标签数
erupts Jul 18, 2024
6cbc22c
优化 flow 代码
Jul 19, 2024
4240abe
update erupt-web
erupts Jul 19, 2024
8f8ea7a
update erupt-web
erupts Jul 19, 2024
7da636b
Merge remote-tracking branch 'origin/develop' into develop
erupts Jul 20, 2024
73bd698
update erupt-api
erupts Aug 3, 2024
8dfc789
update erupt-api
erupts Aug 3, 2024
329682e
修复bi数据表组件声明顺序与渲染顺序不一致的bug
erupts Aug 3, 2024
e91526e
精确Long类型幂等转换
erupts Aug 3, 2024
617183d
增加open-api相关能力
erupts Aug 11, 2024
a782897
lambdaQuery 支持select返回目标对象
erupts Aug 13, 2024
603021c
lambdaQuery 支持select返回目标对象
erupts Aug 13, 2024
485dd16
调整openApi获取token的返回对象
erupts Aug 17, 2024
7b07bb0
update erupt-web
erupts Aug 20, 2024
0cbd535
rollback erupt-flow
erupts Aug 21, 2024
200a735
rollback erupt-flow
erupts Aug 21, 2024
884064d
update open api logic
erupts Aug 21, 2024
4a4ed8a
节点日志支持抽屉方式打开
erupts Aug 25, 2024
4a77528
upgrade to 1.12.15
erupts Aug 25, 2024
12c1b4c
upgrade to 1.12.15
erupts Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion erupt-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
//布局配置
Layout layout() default @Layout;

// @Comment("自定义页头")
// @Match("#value.path() != ''")
// Tpl header() default @Tpl(path = "");
//
// @Comment("画册视图定义")
// @Match("#value.enable() == true")
// Card cardView() default @Card(enable = false, galleryField = "", viewFields = {});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package xyz.erupt.annotation.sub_erupt;

public enum OpenWay {
//抽屉
DRAWER,
//对话框
MODAL
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package xyz.erupt.annotation.sub_erupt;

/**
* @author YuePeng
* date 2024/8/25 15:53
*/
public enum Placement {
TOP,
BOTTOM,
LEFT,
RIGHT
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
@Comment("弹出层宽度")
String width() default "";

@Comment("弹出层高度")
String height() default "";

@Comment("弹出层打开方式")
OpenWay openWay() default OpenWay.MODAL;

@Comment("抽屉打开方向")
Placement drawerPlacement() default Placement.RIGHT;

@Getter
enum Engine {
@Comment("原生H5, Native模式下不支持tplHandler")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
@Comment("是否允许自定义标签")
boolean allowExtension() default true;

@Comment("最大标签数")
int maxTagCount() default 9999;

@Transient
@Comment("可选标签列表")
String[] tags() default {};
Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-cloud/erupt-cloud-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import xyz.erupt.annotation.EruptI18n;
import xyz.erupt.annotation.constant.AnnotationConst;
import xyz.erupt.annotation.expr.ExprBool;
import xyz.erupt.annotation.sub_erupt.Layout;
import xyz.erupt.annotation.sub_erupt.RowOperation;
import xyz.erupt.annotation.sub_erupt.Tpl;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
Expand Down Expand Up @@ -48,7 +46,7 @@
title = "节点日志", mode = RowOperation.Mode.SINGLE,
ifExpr = "item.version && item.version != '-'",
show = @ExprBool(exprHandler = ViaMenuValueCtrl.class, params = CloudServerConst.ERUPT_CLOUD_NODE_LOG),
type = RowOperation.Type.TPL, tpl = @Tpl(path = "/tpl/erupt-log.html", width = "85%")
type = RowOperation.Type.TPL, tpl = @Tpl(path = "/tpl/erupt-log.html", height = "80%", openWay = OpenWay.DRAWER, drawerPlacement = Placement.BOTTOM)
),
}, layout = @Layout(tableLeftFixed = 1, pageSize = 30)
)
Expand Down
2 changes: 1 addition & 1 deletion erupt-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.14</version>
<version>1.12.15</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
29 changes: 25 additions & 4 deletions erupt-core/src/main/java/xyz/erupt/core/config/GsonFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/
public class GsonFactory {

public static final double JS_MAX_NUMBER = Math.pow(2, 53) - 1;

public static final double JS_MIN_NUMBER = Math.pow(-2, 53);

@Getter
private final static GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat(DateUtil.DATE_TIME)
.registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (src, typeOfSrc, context)
Expand All @@ -25,10 +29,27 @@ public class GsonFactory {
-> LocalDateTime.parse(json.getAsJsonPrimitive().getAsString(), DateTimeFormatter.ofPattern(DateUtil.DATE_TIME)))
.registerTypeAdapter(LocalDate.class, (JsonDeserializer<LocalDate>) (json, type, jsonDeserializationContext)
-> LocalDate.parse(json.getAsJsonPrimitive().getAsString(), DateTimeFormatter.ofPattern(DateUtil.DATE)))
.registerTypeAdapter(Long.class, (JsonSerializer<Long>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
.registerTypeAdapter(Double.class, (JsonSerializer<Double>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
// .registerTypeAdapter(Integer.class, (JsonSerializer<Integer>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
.registerTypeAdapter(BigDecimal.class, (JsonSerializer<BigDecimal>) (src, type, jsonSerializationContext) -> new JsonPrimitive(src.toString()))
.registerTypeAdapter(Long.class, (JsonSerializer<Long>) (src, type, jsonSerializationContext) -> {
if (src > JS_MAX_NUMBER || src < JS_MIN_NUMBER) {
return new JsonPrimitive((src).toString());
} else {
return new JsonPrimitive(src);
}
})
.registerTypeAdapter(Double.class, (JsonSerializer<Double>) (src, type, jsonSerializationContext) -> {
if (src > JS_MAX_NUMBER || src < JS_MIN_NUMBER) {
return new JsonPrimitive((src).toString());
} else {
return new JsonPrimitive(src);
}
})
.registerTypeAdapter(BigDecimal.class, (JsonSerializer<BigDecimal>) (src, type, jsonSerializationContext) -> {
if (src.longValue() > JS_MAX_NUMBER || src.longValue() < JS_MIN_NUMBER) {
return new JsonPrimitive((src).toString());
} else {
return new JsonPrimitive(src);
}
})
.serializeNulls().setExclusionStrategies(new EruptGsonExclusionStrategies());

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.util.StreamUtils;
Expand All @@ -16,13 +15,12 @@
import xyz.erupt.annotation.sub_field.sub_edit.AttachmentType;
import xyz.erupt.annotation.sub_field.sub_edit.HtmlEditorType;
import xyz.erupt.core.annotation.EruptRouter;
import xyz.erupt.core.constant.EruptConst;
import xyz.erupt.core.constant.EruptRestPath;
import xyz.erupt.core.exception.EruptWebApiRuntimeException;
import xyz.erupt.core.i18n.I18nTranslate;
import xyz.erupt.core.prop.EruptProp;
import xyz.erupt.core.service.EruptCoreService;
import xyz.erupt.core.util.DateUtil;
import xyz.erupt.core.service.EruptFileService;
import xyz.erupt.core.util.EruptUtil;
import xyz.erupt.core.util.Erupts;
import xyz.erupt.core.view.EruptApiModel;
Expand All @@ -38,7 +36,10 @@
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

/**
Expand All @@ -53,6 +54,8 @@ public class EruptFileController {

private final EruptProp eruptProp;

private final EruptFileService eruptFileService;

private static final String FS_SEP = "/";

@SneakyThrows
Expand All @@ -63,15 +66,7 @@ public EruptApiModel upload(@PathVariable("erupt") String eruptName, @PathVariab
EruptModel eruptModel = EruptCoreService.getErupt(eruptName);
Erupts.powerLegal(eruptModel, powerObject -> powerObject.isEdit() || powerObject.isAdd());
Edit edit = eruptModel.getEruptFieldMap().get(fieldName).getEruptField().edit();
String path;
if (eruptProp.isKeepUploadFileName()) {
path = File.separator + DateUtil.getFormatDate(new Date(), DateUtil.DATE) + File.separator + file.getOriginalFilename()
.replaceAll("&|#|\\?|\\s", "").replace(edit.attachmentType().fileSeparator(), "");
} else {
String[] fileNameSplit = file.getOriginalFilename().split("\\.");
path = File.separator + DateUtil.getFormatDate(new Date(), DateUtil.DATE)
+ File.separator + RandomStringUtils.randomAlphabetic(12) + EruptConst.DOT + fileNameSplit[fileNameSplit.length - 1];
}
String path = eruptFileService.createPath(file).replace(edit.attachmentType().fileSeparator(), "");
switch (edit.type()) {
case ATTACHMENT:
AttachmentType attachmentType = edit.attachmentType();
Expand Down Expand Up @@ -118,27 +113,8 @@ public EruptApiModel upload(@PathVariable("erupt") String eruptName, @PathVariab
}
break;
}
try {
boolean localSave = true;
AttachmentProxy attachmentProxy = EruptUtil.findAttachmentProxy();
if (null != attachmentProxy) {
path = attachmentProxy.upLoad(file.getInputStream(), path.replace("\\", "/"));
localSave = attachmentProxy.isLocalSave();
}
if (localSave) {
File dest = new File(eruptProp.getUploadPath() + path);
if (!dest.getParentFile().exists()) {
if (!dest.getParentFile().mkdirs()) {
return EruptApiModel.errorApi(I18nTranslate.$translate("erupt.upload_error.cannot_created"));
}
}
file.transferTo(dest);
}
return EruptApiModel.successApi(path.replace("\\", "/"));
} catch (Exception e) {
log.error("erupt upload error", e);
return EruptApiModel.errorApi(I18nTranslate.$translate("erupt.upload_error") + " " + e.getMessage());
}
return EruptApiModel.successApi(eruptFileService.upload(file, path));

}


Expand Down Expand Up @@ -170,8 +146,10 @@ public Map<String, Object> uploadHtmlEditorImage(@PathVariable("erupt") String e
map.put("url", EruptRestPath.ERUPT_ATTACHMENT + eruptApiModel.getData());
}
map.put("uploaded", true);
map.put("state", "SUCCESS");
} else {
map.put("uploaded", false);
map.put("state", "ERROR");
throw new EruptWebApiRuntimeException(eruptApiModel.getMessage());
}
return map;
Expand All @@ -194,9 +172,11 @@ public void uploadUEditorImage(@PathVariable("erupt") String eruptName,
response.getOutputStream().write((callback + "(" + json + ")").getBytes(StandardCharsets.UTF_8));
}
} else {
Map<String, Object> map = uploadHtmlEditorImage(eruptName, fieldName, file);
Boolean status = (Boolean) map.get("uploaded");
map.put("state", status ? "SUCCESS" : "ERROR");
Map<String, Object> map = this.uploadHtmlEditorImage(eruptName, fieldName, file);
map.put("filename", file.getName());
map.put("original", file.getOriginalFilename());
map.put("name", file.getName());
map.put("size", file.getSize());
response.getOutputStream().write(new Gson().toJson(map).getBytes(StandardCharsets.UTF_8));
}
}
Expand Down
41 changes: 41 additions & 0 deletions erupt-core/src/main/java/xyz/erupt/core/log/EruptJULAppender.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package xyz.erupt.core.log;

import java.util.logging.Handler;
import java.util.logging.LogRecord;

public class EruptJULAppender extends Handler implements EruptAppender {

@Override
public void publish(LogRecord record) {
EruptLogManager.log(new Formatter()
.timestamp(record.getMillis())
.space()
.level(record.getLevel().toString())
.value(" --- [")
.thread(Thread.currentThread().getName())
.value("] ")
.name(record.getLoggerName())
.value("(" + record.getSourceMethodName() + ":" + record.getSequenceNumber() + ")")
.value(" : ")
.value(record.getMessage())
.throwable(record.getThrown())
.toString()
);
}

@Override
public void flush() {

}

@Override
public void close() throws SecurityException {

}

@Override
public void init() {

}

}
Loading
Loading