From 67943bfb9d9b0a2bbb267f4ad79953ba421e8566 Mon Sep 17 00:00:00 2001 From: devezhao Date: Tue, 11 Apr 2023 19:56:01 +0800 Subject: [PATCH] Fix 3.2.4 (#607) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 小数字段-格式 * enh: trim meta-name * fix: value of bslider * fix: file copy * fix: useValueOfVarRecord --------- Co-authored-by: RB --- pom.xml | 2 +- .../java/com/rebuild/core/Application.java | 4 ++-- .../core/metadata/impl/Entity2Schema.java | 3 +++ .../core/metadata/impl/Field2Schema.java | 3 +++ .../core/service/query/AdvFilterParser.java | 5 ++++- .../java/com/rebuild/utils/CompressUtils.java | 20 +++++++++---------- .../web/admin/metadata/field-edit.html | 2 +- .../resources/web/assets/css/meta-edit.css | 10 ++++++++++ .../web/assets/js/metadata/field-edit.js | 9 ++++----- 9 files changed, 38 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 7b3b00032..473029786 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.rebuild rebuild - 3.2.3 + 3.2.4 rebuild Building your business-systems freely! diff --git a/src/main/java/com/rebuild/core/Application.java b/src/main/java/com/rebuild/core/Application.java index 1df97b65b..b5779f68b 100644 --- a/src/main/java/com/rebuild/core/Application.java +++ b/src/main/java/com/rebuild/core/Application.java @@ -67,11 +67,11 @@ public class Application implements ApplicationListener /** * Rebuild Version */ - public static final String VER = "3.2.3"; + public static final String VER = "3.2.4"; /** * Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2} */ - public static final int BUILD = 3020308; + public static final int BUILD = 3020409; static { // Driver for DB diff --git a/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java b/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java index e0fe0b5d8..863ac4bab 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java @@ -56,6 +56,9 @@ public class Entity2Schema extends Field2Schema { * @return Returns 实体名称 */ public String createEntity(String entityName, String entityLabel, String comments, String mainEntity, boolean haveNameField, boolean haveSeriesField) { + entityName = StringUtils.trim(entityName); + entityLabel = StringUtils.trim(entityLabel); + if (!License.isCommercial() && MetadataHelper.getEntities().length >= 100) { throw new NeedRbvException("实体数量超出免费版限制"); } diff --git a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java index ec3c9c6e8..7cbb15978 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java @@ -98,6 +98,9 @@ public class Field2Schema extends SetUser { * @return */ public String createField(Entity entity, String fieldLabel, String fieldName, DisplayType type, String comments, String refEntity, JSON extConfig) { + fieldLabel = StringUtils.trim(fieldLabel); + fieldName = StringUtils.trim(fieldName); + if (StringUtils.length(fieldName) < 4) fieldName = toPinyinName(fieldLabel); for (int i = 0; i < 6; i++) { diff --git a/src/main/java/com/rebuild/core/service/query/AdvFilterParser.java b/src/main/java/com/rebuild/core/service/query/AdvFilterParser.java index 076f0c0e1..c96de3629 100644 --- a/src/main/java/com/rebuild/core/service/query/AdvFilterParser.java +++ b/src/main/java/com/rebuild/core/service/query/AdvFilterParser.java @@ -36,6 +36,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.springframework.util.Assert; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; @@ -401,7 +402,7 @@ public class AdvFilterParser extends SetUser { for (String s : value.split("\\|")) { maskValue += ObjectUtils.toLong(s); } - value = maskValue + ""; + value = String.valueOf(maskValue); } } @@ -659,6 +660,8 @@ public class AdvFilterParser extends SetUser { if (v instanceof Date) { v = CalendarUtils.getUTCDateFormat().format(v); + } else if (v instanceof BigDecimal) { + v = String.valueOf(((BigDecimal) v).doubleValue()); } else { v = String.valueOf(v); } diff --git a/src/main/java/com/rebuild/utils/CompressUtils.java b/src/main/java/com/rebuild/utils/CompressUtils.java index 6ca72df61..f72e57a10 100644 --- a/src/main/java/com/rebuild/utils/CompressUtils.java +++ b/src/main/java/com/rebuild/utils/CompressUtils.java @@ -13,7 +13,14 @@ import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import java.io.*; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; import java.nio.file.Files; /** @@ -99,17 +106,10 @@ public class CompressUtils { * @param source * @param dest * @throws IOException + * @see FileUtils#copyFile(File, File) Bad on unix! * @see IOUtils#copyLarge(Reader, Writer) */ public static void copy(File source, File dest) throws IOException { - FileReader fr = new FileReader(source); - FileWriter fw = new FileWriter(dest); - - try { - IOUtils.copyLarge(fr, fw); - } finally { - IOUtils.closeQuietly(fr); - IOUtils.closeQuietly(fw); - } + FileUtils.copyFile(source, dest); } } diff --git a/src/main/resources/web/admin/metadata/field-edit.html b/src/main/resources/web/admin/metadata/field-edit.html index e668c66ec..5e27d574a 100644 --- a/src/main/resources/web/admin/metadata/field-edit.html +++ b/src/main/resources/web/admin/metadata/field-edit.html @@ -190,7 +190,7 @@
- +
diff --git a/src/main/resources/web/assets/css/meta-edit.css b/src/main/resources/web/assets/css/meta-edit.css index 6390e7c56..27f728cb9 100644 --- a/src/main/resources/web/assets/css/meta-edit.css +++ b/src/main/resources/web/assets/css/meta-edit.css @@ -250,3 +250,13 @@ select.underline-sm { select.underline-sm:focus { border-color: #4285f4; } + +.bslider.form-control { + border: 0 none; + padding: 0; + max-height: 24px; +} + +.form-text.J_minmax > b { + color: #222; +} \ No newline at end of file diff --git a/src/main/resources/web/assets/js/metadata/field-edit.js b/src/main/resources/web/assets/js/metadata/field-edit.js index b4e77f4a0..be591ec87 100644 --- a/src/main/resources/web/assets/js/metadata/field-edit.js +++ b/src/main/resources/web/assets/js/metadata/field-edit.js @@ -90,6 +90,7 @@ $(document).ready(function () { } const extConfigNew = { ...extConfig, ...__gExtConfig } + // 不同类型的配置 $(`.J_for-${dt} .form-control, .J_for-${dt} .custom-control-input`).each(function () { const k = $(this).attr('id') @@ -141,7 +142,7 @@ $(document).ready(function () { }) extConfigNew['tagList'] = items } - // 小数 + // 小数-货币 if (dt === 'DECIMAL' && extConfigNew['decimalType'] === '¥') { extConfigNew['decimalType'] = $val('.J_decimalTypeFlag') || '¥' } @@ -248,10 +249,8 @@ $(document).ready(function () { _handleNumber(extConfig.calcFormula) if (dt === 'DECIMAL') { - if (extConfig.decimalType === '%') { - // 百分比 - } else if (!extConfig.decimalType || extConfig.decimalType === 0) { - // 数字 + if (!extConfig.decimalType || extConfig.decimalType === 0 || extConfig.decimalType === '0' || extConfig.decimalType === '%') { + // 数字、百分比 } else { $('input[name="decimalType"]:eq(2)').attr('checked', true) $('.J_decimalTypeFlag').val(extConfig.decimalType)