Skip to content

Commit

Permalink
Fix 3.9.4 (#865)
Browse files Browse the repository at this point in the history
* 小数精度问题

* fix: 记录转换时的明细导入

* 3.9.4

* fix: Gitee#IBLGYQ

* be:默认排序优化

* fixed #866

* be

* fix:__isSameValue38

---------

Co-authored-by: devezhao <[email protected]>
  • Loading branch information
getrebuild and devezhao authored Feb 13, 2025
1 parent f0af100 commit 4cf7100
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.9.3</version>
<version>3.9.4</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rebuild/core/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "3.9.3";
public static final String VER = "3.9.4";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3090308;
public static final int BUILD = 3090409;

static {
// Driver for DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public Object exprDefaultValue() {
public Object wrapValue(Object value) {
String format = StringUtils.defaultIfBlank(
getExtraAttr(EasyFieldConfigProps.DECIMAL_FORMAT), getDisplayType().getDefaultFormat());
// fix:3.9.4 进位模式
value = fixedDecimalScale(value, this);
String n = new DecimalFormat(format).format(value);

// 0, %, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class EasyFieldConfigProps {
*/
public static final String NUMBER_CALCFORMULA = "calcFormula";
/**
* 表单公式
* 表单公式后端计算
*/
public static final String NUMBER_CALCFORMULABACKEND = "calcFormulaBackend";
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package com.rebuild.core.service.dashboard.charts;

import cn.devezhao.commons.ReflectUtils;
import cn.devezhao.persist4j.Entity;
import cn.devezhao.persist4j.engine.ID;
import com.alibaba.fastjson.JSONObject;
Expand Down Expand Up @@ -93,7 +94,8 @@ public static ChartData create(JSONObject config, ID user) throws ChartsExceptio
} else {
for (BuiltinChart ch : getBuiltinCharts()) {
if (ch.getChartType().equalsIgnoreCase(type)) {
return (ChartData) ((ChartData) ch).setUser(user);
ChartData c = (ChartData) ReflectUtils.newObject(ch.getClass().getName());
return (ChartData) c.setUser(user);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public JSON preview(ID sourceRecordId, ID specMainId, ID targetExistsRecordId) {
TransformerPreview37.fillLabelOfReference(tansTargetRecord);

JSON formModel = UseFormsBuilder.buildFormWithRecord(targetEntity, tansTargetRecord, specMainId, getUser(), false);
// fix:3.9.4 明细导入
if (targetEntity.getDetailEntity() != null) {
((JSONObject) formModel).put("detailImports", buildDetailImports39(targetEntity));
}

if (fieldsMappingDetails == null || fieldsMappingDetails.isEmpty()) return formModel;

// 有明细
Expand Down Expand Up @@ -180,11 +185,6 @@ public JSON preview(ID sourceRecordId, ID specMainId, ID targetExistsRecordId) {

((JSONObject) formModel).put(GeneralEntityService.HAS_DETAILS, formModelDetailsMap);

// 明细导入
if (targetEntity.getDetailEntity() != null) {
((JSONObject) formModel).put("detailImports", buildDetailImports39(targetEntity));
}

return formModel;
}

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/com/rebuild/core/support/general/QueryParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ private void doParseIfNeed() {

String sortNode = queryExpr.getString("sort");
String sortSql = null;
if (StringUtils.isNotBlank(sortNode)) {
sortSql = parseSort(sortNode);
} else if (entity.containsField(EntityHelper.ModifiedOn)) {
sortSql = EntityHelper.ModifiedOn + " desc";
} else if (entity.containsField(EntityHelper.CreatedOn)) {
sortSql = EntityHelper.CreatedOn + " desc";
if (StringUtils.isNotBlank(sortNode)) sortSql = parseSort(sortNode);
// 默认排序
if (sortSql == null) {
if (entity.containsField(EntityHelper.ModifiedOn)) {
sortSql = EntityHelper.ModifiedOn + (":asc".equals(sortNode) ? " asc" : " desc");
} else if (entity.containsField(EntityHelper.CreatedOn)) {
sortSql = EntityHelper.CreatedOn + (":asc".equals(sortNode) ? " asc" : " desc");
}
}
if (StringUtils.isNotBlank(sortSql)) fullSql.append(" order by ").append(sortSql);

Expand All @@ -256,7 +258,7 @@ private String parseSort(String sort) {
if (sort.length() < 5) return null;

StringBuilder sb = new StringBuilder();
String[] sorts = sort.split("[,;]");
String[] sorts = sort.split("[,;]"); // 支持多个: xx:asc;xxx:desc
for (String s : sorts) {
String[] split = s.split(":");
if (StringUtils.isBlank(split[0])) return null;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/rebuild/web/admin/AdminCli3.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.rebuild.core.support.task.TaskExecutors;
import com.rebuild.utils.AES;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;

import java.io.File;
Expand Down Expand Up @@ -188,7 +189,8 @@ protected String execSyscfg() {
else {
String value = commands[2];
if (item == ConfigurationItem.SN) {
String usql = String.format("update system_config set `VALUE` = '%s' where `ITEM` = 'SN'", value);
String usql = String.format("update system_config set `VALUE` = '%s' where `ITEM` = 'SN'",
StringEscapeUtils.escapeSql(value));
Application.getSqlExecutor().execute(usql);
// reset: RB NEED RESTART
Application.getCommonsCache().evict(ConfigurationItem.SN.name());
Expand Down
20 changes: 15 additions & 5 deletions src/main/resources/web/assets/js/general/rb-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class RbFormModal extends React.Component {
_handleMaximize() {
this.setState({ _maximize: !this.state._maximize }, () => {
$storage.set(this.__maximizeKey, this.state._maximize)

// be:3.9.4
setTimeout(() => {
const $form = this.getFormComp()._$form
$form && $($form).parent().find('.protable').perfectScrollbar('update')
}, 200)
})
}

Expand Down Expand Up @@ -3331,10 +3337,14 @@ const __calcFormula = function (fieldComp) {
}
function __isSameValue38(a, b) {
if ($same(a, b)) return true
try {
// eslint-disable-next-line eqeqeq
return parseFloat(a) == parseFloat(b)
} catch (err) {
// ignored
// fix: 3.9.4
if ($regex.isDecimal(a) && $regex.isDecimal(b)) {
try {
// eslint-disable-next-line eqeqeq
return parseFloat(a) == parseFloat(b)
} catch (err) {
// ignored
}
}
return false
}
2 changes: 1 addition & 1 deletion src/main/resources/web/signup/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
<div class="splash-footer">
<div class="copyright link">
&copy;
<th:block th:utext="${commercial < 20 ? bundle.L('[REBUILD](https://getrebuild.com/) 技术支持') : appName}" />
<th:block th:utext="${commercial > 10 ? appName : bundle.L('[REBUILD](https://getrebuild.com/) 技术支持')}" />
</div>
</div>
</div>
Expand Down

0 comments on commit 4cf7100

Please sign in to comment.