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.10 #229

Merged
merged 22 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
95c8262
dual
erupts Dec 10, 2023
9dcf94e
upgrade to 1.12.10
erupts Dec 11, 2023
7d834e1
优化 node 节点查找性能,避免使用 keys *
erupts Dec 11, 2023
d17ad91
打印其它未知的 SQL 异常
erupts Dec 17, 2023
a221b84
优化异常SQL提示
erupts Dec 19, 2023
887bdec
解决Exception为空导致失败状态未记录的bug
erupts Dec 24, 2023
b64aba2
代码生成器增加评分组件
erupts Dec 30, 2023
2ed585d
erupt-job增加是否记录日志配置
erupts Jan 9, 2024
0b8f0e1
下钻组件依据实际类型调整表达式是否需要引号
erupts Jan 18, 2024
65b5ef1
下钻组件依据实际类型调整表达式是否需要引号
erupts Jan 18, 2024
a704aee
左树右表组件依据实际类型调整表达式是否需要引号
erupts Jan 23, 2024
2645613
删除菜单后自动移除角色关联
erupts Jan 23, 2024
7321a62
支持导出模板修饰字段类型是LocalDate或LocalDateTime自动限制填充格式的能力
erupts Jan 30, 2024
00222e0
Remove invalid code
erupts Feb 2, 2024
452dc6d
调整e_cloud_node表字段定义,remark变为 varchar(2000)避免 oracle数据库出现多个 long报错
erupts Feb 3, 2024
3d46b64
input组件增加autoTrim配置,提交内容会自动 trim 默认开启
erupts Feb 3, 2024
ba1aa59
移除无用不过文件
erupts Feb 3, 2024
3c69014
解决 oracle 数据库无法创建 upms_menu表的问题,h2数据库默认读取提交的erupt.mv.db文件
erupts Feb 3, 2024
b13b726
根据 ID 获取数据时clear jpa对象的值,防止在编辑时脏读
erupts Feb 3, 2024
87f5f31
eruptDao新增findById方法,防止线程内多次读取导致脏读的问题
erupts Feb 3, 2024
054fd16
update erupt-web sourcemap
erupts Feb 4, 2024
0c340ac
update Rose chart define
erupts Feb 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.9</version>
<version>1.12.10</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.9</version>
<version>1.12.10</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@
*/
public @interface InputType {

@Comment("最大输入长度")
@Comment("Maximum input length")
int length() default 255;

String type() default "text";

@Comment("是否整行显示")
@Comment("Display the whole line")
boolean fullSpan() default false;

@Transient
@Comment("对提交内容进行正则校验")
@Comment("Regex the input value")
String regex() default "";

@Transient
@Comment("Automatically trim input value")
boolean autoTrim() default true;

VL[] prefix() default {};

VL[] suffix() 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.9</version>
<version>1.12.10</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.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions 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.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -36,7 +36,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>5.8.16</version>
<version>5.8.25</version>
</dependency>
</dependencies>
</project>
Expand Down
4 changes: 2 additions & 2 deletions 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.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>5.8.16</version>
<version>5.8.25</version>
</dependency>
</dependencies>
</project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.EruptI18n;
import xyz.erupt.annotation.constant.AnnotationConst;
import xyz.erupt.annotation.expr.ExprBool;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.annotation.fun.TagsFetchHandler;
Expand Down Expand Up @@ -134,7 +135,7 @@ public class CloudNode extends MetaModelUpdateVo implements DataProxy<CloudNode>
@Type(type = "org.hibernate.type.TextType")
@EruptField(
views = @View(title = "节点配置"),
edit = @Edit(title = "节点配置", type = EditType.CODE_EDITOR, codeEditType = @CodeEditorType(language = "json"))
edit = @Edit(title = "节点配置", desc = "配置后可在子节点中读取", type = EditType.CODE_EDITOR, codeEditType = @CodeEditorType(language = "json"))
)
private String config;

Expand All @@ -143,8 +144,7 @@ public class CloudNode extends MetaModelUpdateVo implements DataProxy<CloudNode>
)
private String accessToken;

@Lob
@Type(type = "org.hibernate.type.TextType")
@Column(length = AnnotationConst.REMARK_LENGTH)
@EruptField(
views = @View(title = "描述", type = ViewType.HTML),
edit = @Edit(title = "描述", type = EditType.TEXTAREA)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.stereotype.Component;
import xyz.erupt.cloud.server.config.EruptCloudServerProp;
import xyz.erupt.cloud.server.model.CloudNode;
import xyz.erupt.jpa.dao.EruptDao;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
* @author YuePeng
Expand All @@ -22,6 +26,9 @@ public class NodeManager {

public static final String NODE_SPACE = "node:";

@Resource
private EruptDao eruptDao;

private RedisTemplate<String, MetaNode> redisTemplate;

@Autowired
Expand Down Expand Up @@ -64,11 +71,16 @@ public void removeNodeInstance(String nodeName, String instanceAddress) {


public List<MetaNode> findAllNodes() {
List<MetaNode> metaNodes = new ArrayList<>();
Optional.ofNullable(redisTemplate.keys(eruptCloudServerProp.getCloudNameSpace() + NODE_SPACE + "*")).flatMap(keys ->
Optional.ofNullable(redisTemplate.opsForValue().multiGet(keys))).ifPresent(metaNodes::addAll
);
return metaNodes;
List<String> keys = eruptDao.queryEntityList(CloudNode.class).stream().map(it ->
eruptCloudServerProp.getCloudNameSpace() + NODE_SPACE + it.getNodeName()
).collect(Collectors.toList());
if (!keys.isEmpty()) {
List<MetaNode> metaNodes = Optional.ofNullable(redisTemplate.opsForValue().multiGet(keys)).orElse(new ArrayList<>());
metaNodes.removeIf(Objects::isNull);
return metaNodes;
} else {
return new ArrayList<>();
}
}

}
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.9</version>
<version>1.12.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import xyz.erupt.core.util.EruptUtil;
import xyz.erupt.core.util.Erupts;
import xyz.erupt.core.util.ReflectUtil;
import xyz.erupt.core.view.EruptFieldModel;
import xyz.erupt.core.view.EruptModel;
import xyz.erupt.core.view.Page;
import xyz.erupt.core.view.TableQuery;
Expand Down Expand Up @@ -63,14 +64,19 @@ public Page getEruptData(EruptModel eruptModel, TableQuery tableQuery, List<Cond
if (dependTree.dependNode()) return new Page();
} else {
EruptModel treeErupt = EruptCoreService.getErupt(ReflectUtil.findClassField(eruptModel.getClazz(), dependTree.field()).getType().getSimpleName());
conditionStrings.add(String.format("%s = '%s'", dependTree.field() + EruptConst.DOT + treeErupt.getErupt().primaryKeyCol(), tableQuery.getLinkTreeVal()));
EruptFieldModel pk = treeErupt.getEruptFieldMap().get(treeErupt.getErupt().primaryKeyCol());
if (pk.getField().getType() == String.class) {
conditionStrings.add(String.format("%s = '%s'", dependTree.field() + EruptConst.DOT + pk.getFieldName(), tableQuery.getLinkTreeVal()));
} else {
conditionStrings.add(String.format("%s = %s", dependTree.field() + EruptConst.DOT + pk.getFieldName(), tableQuery.getLinkTreeVal()));
}
}
}
Layout layout = eruptModel.getErupt().layout();
if (Layout.PagingType.FRONT == layout.pagingType() || Layout.PagingType.NONE == layout.pagingType()) {
tableQuery.setPageSize(layout.pageSizes()[layout.pageSizes().length - 1]);
}
this.drillProcess(eruptModel, (link, val) -> conditionStrings.add(String.format("%s = '%s'", link.linkErupt().getSimpleName() + EruptConst.DOT + link.joinColumn(), val)));
this.drillProcess(eruptModel, (link, val) -> conditionStrings.add(String.format(val instanceof String ? "%s = '%s'" : "%s = %s", link.linkErupt().getSimpleName() + EruptConst.DOT + link.joinColumn(), val)));
conditionStrings.addAll(Arrays.asList(customCondition));
DataProxyInvoke.invoke(eruptModel, (dataProxy -> Optional.ofNullable(dataProxy.beforeFetch(legalConditions)).ifPresent(conditionStrings::add)));
Optional.ofNullable(serverCondition).ifPresent(legalConditions::addAll);
Expand Down
6 changes: 5 additions & 1 deletion erupt-core/src/main/java/xyz/erupt/core/util/EruptUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ public static Object dataTarget(EruptModel eruptModel, Object data, Object targe
f.set(target, s);
}
} else {
f.set(target, f.get(data));
if (eruptField.edit().type() == EditType.INPUT && eruptField.edit().inputType().autoTrim() && null != f.get(data)) {
f.set(target, f.get(data).toString().trim());
} else {
f.set(target, f.get(data));
}
}
} catch (IllegalAccessException e) {
log.error("erupt data copy error", e);
Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public class EruptDao {

private static final String WHERE = " where ";

public <T> T findById(Class<T> clazz, Object id) {
entityManager.clear();
return entityManager.find(clazz, id);
}

//修改
public <T> T merge(T t) {
return entityManager.merge(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.persistence.UniqueConstraint;
import javax.transaction.Transactional;
import java.lang.reflect.Field;
import java.sql.SQLException;
import java.util.*;

/**
Expand Down Expand Up @@ -114,17 +115,19 @@ private void loadSupport(Object jpaEntity) {

//优化异常提示类
private void handlerException(Exception e, EruptModel eruptModel) {
if (e instanceof DataIntegrityViolationException) {
if (e.getMessage().contains("ConstraintViolationException")) {
throw new EruptWebApiRuntimeException(gcRepeatHint(eruptModel));
} else if (e.getMessage().contains("DataException")) {
throw new EruptWebApiRuntimeException(I18nTranslate.$translate("erupt.data.limit_length"));
} else {
throw new EruptWebApiRuntimeException(e.getMessage());
Throwable throwable = e;
while (null != throwable) {
throwable = throwable.getCause();
if (throwable instanceof SQLException) {
if (throwable.getMessage().contains("Data too long")) {
throw new EruptWebApiRuntimeException(I18nTranslate.$translate("erupt.data.limit_length"));
} else if (throwable.getMessage().contains("Duplicate entry")) {
throw new EruptWebApiRuntimeException(gcRepeatHint(eruptModel));
}
throw new EruptWebApiRuntimeException(throwable.getMessage());
}
} else {
throw new EruptWebApiRuntimeException(e.getMessage());
}
throw new EruptWebApiRuntimeException(e.getMessage());
}

@Transactional
Expand Down
2 changes: 1 addition & 1 deletion erupt-data/erupt-mongodb/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.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-excel/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.9</version>
<version>1.12.10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import xyz.erupt.core.view.Page;
import xyz.erupt.excel.util.ExcelUtil;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;

/**
Expand Down Expand Up @@ -276,7 +278,7 @@ public Workbook createExcelTemplate(EruptModel eruptModel) {
if (edit.show() && !edit.readonly().add() && StringUtils.isNotBlank(edit.title())
&& AnnotationProcess.getEditTypeMapping(edit.type()).excelOperator()) {
Cell cell = headRow.createCell(cellNum);
//256表格一个字节的宽度
//单字节宽度为256
sheet.setColumnWidth(cellNum, (edit.title().length() + 10) * 256);
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
switch (edit.type()) {
Expand Down Expand Up @@ -304,7 +306,9 @@ public Workbook createExcelTemplate(EruptModel eruptModel) {
Integer.toString(edit.sliderType().min()), Integer.toString(edit.sliderType().max()))));
break;
case DATE:
if (fieldModel.getFieldReturnName().equals(Date.class.getSimpleName())) {
if (fieldModel.getFieldReturnName().equals(Date.class.getSimpleName())
|| fieldModel.getFieldReturnName().equals(LocalDate.class.getSimpleName())
|| fieldModel.getFieldReturnName().equals(LocalDateTime.class.getSimpleName())) {
sheet.addValidationData(generateValidation(cellNum, "请选择或输入有效时间!"
, dvHelper.createDateConstraint(DVConstraint.OperatorType.BETWEEN
, "1900-01-01", "2999-12-31", "yyyy-MM-dd")));
Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>xyz.erupt</groupId>
<artifactId>erupt</artifactId>
<version>1.12.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum GeneratorType {
COLOR(EditType.INPUT, "颜色选择", String.class.getSimpleName(), "inputType = @InputType(type = \"color\")"),
NUMBER(EditType.NUMBER, "数值框", Integer.class.getSimpleName(), "numberType = @NumberType"),
SLIDER(EditType.SLIDER, "数字滑块", Integer.class.getSimpleName(), "sliderType = @SliderType(max = 999)"),
RATE(EditType.RATE, "评分", Short.class.getSimpleName(), "rateType = @RateType(count = 10)"),
DATE(EditType.DATE, "日期", Date.class.getSimpleName(), "dateType = @DateType"),
DATE_TIME(EditType.DATE, "日期时间", Date.class.getSimpleName(), "dateType = @DateType(type = DateType.Type.DATE_TIME)"),
TIME(EditType.DATE, "时间", String.class.getSimpleName(), "dateType = @DateType(type = DateType.Type.TIME)"),
Expand Down
2 changes: 1 addition & 1 deletion erupt-extra/erupt-job/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.9</version>
<version>1.12.10</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ public class EruptJob extends MetaModelUpdateVo {
trueText = "启用", falseText = "禁用"
), notNull = true, search = @Search)
)
private Boolean status;
private Boolean status = true;

@EruptField(
views = @View(title = "记录日志"),
edit = @Edit(title = "记录日志", boolType = @BoolType(
trueText = "是", falseText = "否"
), notNull = true, search = @Search)
)
private Boolean recordLog = true;

@Column(length = AnnotationConst.REMARK_LENGTH)
@EruptField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public class EruptJobDataProxy implements DataProxy<EruptJob>, OperationHandler<
@Resource
private EruptJobService eruptJobService;

@Override
public void addBehavior(EruptJob eruptJob) {
eruptJob.setStatus(true);
}

@Override
public void beforeAdd(EruptJob eruptJob) {
if (null == eruptJob.getCode()) {
Expand Down
Loading
Loading