From b2b55a475130dba5c86c629e0335c108a398c27e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?REBUILD=20=E4=BC=81=E4=B8=9A=E7=AE=A1=E7=90=86=E7=B3=BB?=
=?UTF-8?q?=E7=BB=9F?= <42044143+getrebuild@users.noreply.github.com>
Date: Thu, 16 Jan 2025 21:56:26 +0800
Subject: [PATCH] Fix 3.9.2 (#859)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fix: 字段聚合分组匹配回显问题
* fix: 明细导入无效
* fix: 表单公式:当前日期无效
* 3.9.2
* be: DbInfo
---
@rbv | 2 +-
pom.xml | 2 +-
.../java/com/rebuild/core/Application.java | 4 ++--
.../rebuild/core/metadata/MetadataHelper.java | 20 -------------------
.../support/general/CalcFormulaSupport.java | 3 ++-
.../support/general/ContentWithFieldVars.java | 2 +-
.../rebuild/core/support/setup/DbInfo.java | 13 ++++++++++--
.../rebuild/core/support/setup/Installer.java | 4 ++--
.../admin/metadata/MetaEntityController.java | 11 +++++++++-
.../web/assets/js/general/rb-forms.js | 4 ++++
.../js/trigger/trigger.FIELDAGGREGATION.js | 4 +++-
11 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/@rbv b/@rbv
index 9a6c91abe2..e118f286f0 160000
--- a/@rbv
+++ b/@rbv
@@ -1 +1 @@
-Subproject commit 9a6c91abe293077d0ef39b7b22834ba9bd22add8
+Subproject commit e118f286f0688d3c83bfcd497ffcd1920d4b1f97
diff --git a/pom.xml b/pom.xml
index 96b6c75508..7b5dd34c4f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
com.rebuild
rebuild
- 3.9.1
+ 3.9.2
rebuild
Building your business-systems freely!
https://getrebuild.com/
diff --git a/src/main/java/com/rebuild/core/Application.java b/src/main/java/com/rebuild/core/Application.java
index de6396687c..3523df0be7 100644
--- a/src/main/java/com/rebuild/core/Application.java
+++ b/src/main/java/com/rebuild/core/Application.java
@@ -74,11 +74,11 @@ public class Application implements ApplicationListener
/**
* Rebuild Version
*/
- public static final String VER = "3.9.1";
+ public static final String VER = "3.9.2";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
- public static final int BUILD = 3090106;
+ public static final int BUILD = 3090207;
static {
// Driver for DB
diff --git a/src/main/java/com/rebuild/core/metadata/MetadataHelper.java b/src/main/java/com/rebuild/core/metadata/MetadataHelper.java
index 71243fd2e9..83fc228232 100644
--- a/src/main/java/com/rebuild/core/metadata/MetadataHelper.java
+++ b/src/main/java/com/rebuild/core/metadata/MetadataHelper.java
@@ -17,7 +17,6 @@
import com.rebuild.core.Application;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.metadata.impl.DynamicMetadataFactory;
-import com.rebuild.core.metadata.impl.EasyEntityConfigProps;
import com.rebuild.core.metadata.impl.GhostEntity;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.CommonsUtils;
@@ -27,10 +26,7 @@
import org.springframework.util.Assert;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
/**
* 实体元数据
@@ -427,22 +423,6 @@ public static boolean checkAndWarnField(String entityName, String fieldName) {
return checkAndWarnField(getEntity(entityName), fieldName);
}
- /**
- * 实体分类标签
- *
- * @return
- */
- public static Set getEntityTags() {
- Set set = new TreeSet<>();
- for (Entity entity : getEntities()) {
- String tags = EasyMetaFactory.valueOf(entity).getExtraAttr(EasyEntityConfigProps.TAGS);
- if (StringUtils.isNotBlank(tags)) {
- Collections.addAll(set, tags.split(","));
- }
- }
- return set;
- }
-
/**
* @param idtext
* @param entityCode
diff --git a/src/main/java/com/rebuild/core/support/general/CalcFormulaSupport.java b/src/main/java/com/rebuild/core/support/general/CalcFormulaSupport.java
index 1bb3787b0e..1977dc6055 100644
--- a/src/main/java/com/rebuild/core/support/general/CalcFormulaSupport.java
+++ b/src/main/java/com/rebuild/core/support/general/CalcFormulaSupport.java
@@ -107,7 +107,8 @@ public static int calcFormulaBackend(Record record) {
public static Object evalCalcFormula(Field targetField, Map varsInFormula) {
final Entity entity = targetField.getOwnEntity();
final EasyField easyField = EasyMetaFactory.valueOf(targetField);
- final String formula = easyField.getExtraAttr(EasyFieldConfigProps.NUMBER_CALCFORMULA);
+ String formula = easyField.getExtraAttr(EasyFieldConfigProps.NUMBER_CALCFORMULA);
+ formula = formula.replace("{{NOW}}", EasyDateTime.VAR_NOW);
boolean calcReady = true;
Set fieldVars = ContentWithFieldVars.matchsVars(formula);
diff --git a/src/main/java/com/rebuild/core/support/general/ContentWithFieldVars.java b/src/main/java/com/rebuild/core/support/general/ContentWithFieldVars.java
index d26ebb4994..5fbcec80e7 100644
--- a/src/main/java/com/rebuild/core/support/general/ContentWithFieldVars.java
+++ b/src/main/java/com/rebuild/core/support/general/ContentWithFieldVars.java
@@ -41,7 +41,7 @@ public class ContentWithFieldVars {
/**
* 通过 `{}` 包裹的变量或字段
*/
- public static final Pattern PATT_VAR = Pattern.compile("\\{([0-9a-zA-Z._$]{4,})}");
+ public static final Pattern PATT_VAR = Pattern.compile("\\{([0-9a-zA-Z._$]{3,})}");
/**
* 替换文本中的字段变量
diff --git a/src/main/java/com/rebuild/core/support/setup/DbInfo.java b/src/main/java/com/rebuild/core/support/setup/DbInfo.java
index a877860ac5..14942ed899 100644
--- a/src/main/java/com/rebuild/core/support/setup/DbInfo.java
+++ b/src/main/java/com/rebuild/core/support/setup/DbInfo.java
@@ -32,9 +32,18 @@ public boolean isMySQL56() {
return desc.contains("5.6.");
}
- public boolean isMySQL80() {
+ public boolean isMySQL8x() {
if (isOceanBase()) return false;
- return desc.contains("8.0.") || desc.contains("8.1.");
+ return desc.startsWith("8.");
+ }
+
+ public boolean isMySQL9x() {
+ if (isOceanBase()) return false;
+ return desc.startsWith("9.");
+ }
+
+ public String getDesc() {
+ return desc;
}
/**
diff --git a/src/main/java/com/rebuild/core/support/setup/Installer.java b/src/main/java/com/rebuild/core/support/setup/Installer.java
index 8a2a6e3b28..89b457f71a 100644
--- a/src/main/java/com/rebuild/core/support/setup/Installer.java
+++ b/src/main/java/com/rebuild/core/support/setup/Installer.java
@@ -114,7 +114,7 @@ public void install() throws Exception {
if (dbInfo.isOceanBase()) {
installProps.put("db.type", "OceanBase");
- } else if (dbInfo.isMySQL80()) {
+ } else if (dbInfo.isMySQL8x() || dbInfo.isMySQL9x()) {
// https://www.cnblogs.com/lusaisai/p/13372763.html
String dbUrl8 = installProps.getProperty("db.url");
if (!dbUrl8.contains("allowPublicKeyRetrieval")) dbUrl8 += "&allowPublicKeyRetrieval=true";
@@ -355,7 +355,7 @@ public DbInfo getDbInfo() {
try (Connection conn = getConnection("mysql")) {
try (Statement stmt = conn.createStatement()) {
- try (ResultSet rs = stmt.executeQuery("select version()")) {
+ try (ResultSet rs = stmt.executeQuery("SELECT VERSION()")) {
if (rs.next()) return new DbInfo(rs.getString(1));
}
}
diff --git a/src/main/java/com/rebuild/web/admin/metadata/MetaEntityController.java b/src/main/java/com/rebuild/web/admin/metadata/MetaEntityController.java
index 7156382eab..a447ddff70 100644
--- a/src/main/java/com/rebuild/web/admin/metadata/MetaEntityController.java
+++ b/src/main/java/com/rebuild/web/admin/metadata/MetaEntityController.java
@@ -59,11 +59,13 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
/**
* @author Zixin (RB)
@@ -324,7 +326,14 @@ public RespBody entityCopy(HttpServletRequest request) {
@GetMapping("entity/entity-tags")
public RespBody entityTags() {
- return RespBody.ok(MetadataHelper.getEntityTags());
+ Set set = new TreeSet<>();
+ for (Entity entity : MetadataHelper.getEntities()) {
+ String tags = EasyMetaFactory.valueOf(entity).getExtraAttr(EasyEntityConfigProps.TAGS);
+ if (StringUtils.isNotBlank(tags)) {
+ Collections.addAll(set, tags.split(","));
+ }
+ }
+ return RespBody.ok(set);
}
@GetMapping("entities/sheet")
diff --git a/src/main/resources/web/assets/js/general/rb-forms.js b/src/main/resources/web/assets/js/general/rb-forms.js
index 830e6d7836..2c47dc13b6 100644
--- a/src/main/resources/web/assets/js/general/rb-forms.js
+++ b/src/main/resources/web/assets/js/general/rb-forms.js
@@ -3137,6 +3137,10 @@ class RbFormRefform extends React.Component {
this.setState({ formComponent: VFORM })
})
}
+
+ // for comp
+ getValue() {}
+ setValue() {}
}
// 确定元素类型
diff --git a/src/main/resources/web/assets/js/trigger/trigger.FIELDAGGREGATION.js b/src/main/resources/web/assets/js/trigger/trigger.FIELDAGGREGATION.js
index c3962deb6d..5a12e613bc 100644
--- a/src/main/resources/web/assets/js/trigger/trigger.FIELDAGGREGATION.js
+++ b/src/main/resources/web/assets/js/trigger/trigger.FIELDAGGREGATION.js
@@ -360,7 +360,9 @@ class ContentFieldAggregation extends ActionContentSpec {
if (content) {
this.setState({ items: content.items || [] })
if (content.targetEntityMatchFields) {
- this._MatchFields && this._MatchFields.setState({ groupFields: content.targetEntityMatchFields })
+ setTimeout(() => {
+ this._MatchFields && this._MatchFields.setState({ groupFields: content.targetEntityMatchFields })
+ }, 200)
}
$(this._$fillbackField)
.val(content.fillbackField || null)