From b4e0bd30e79cb19a032baa9f2668adb07f371e85 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 12 Sep 2023 09:22:47 +0800 Subject: [PATCH] =?UTF-8?q?NameStandUtil=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E7=9A=84=E5=B0=8F?= =?UTF-8?q?=E6=95=B0=E9=83=A8=E5=88=86=E8=A7=84=E5=88=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/NameStandUtil.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java index 86613560..711c2320 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java @@ -87,21 +87,31 @@ public class NameStandUtil { public String GetSuffix(String dataType,String sysType,String Fulltype,String LT) { String rData = ""; BigDecimal bd = new BigDecimal(LT); + //将acquisition_live_time保留一位小数 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位 + String scale = bd.setScale(1, RoundingMode.HALF_UP).toString(); if(dataType.contains(DataType.SAMPLEPHD.getType())) { - if (LT.indexOf(".0") > 0) { + if (scale.indexOf(".0") > 0) { bd = bd.setScale(0, RoundingMode.HALF_UP); } else { bd = bd.setScale(1, RoundingMode.HALF_UP); } rData = "_S_"+Fulltype+"_"+bd+".PHD"; } else if(dataType.contains(DataType.GASBKPHD.getType())){ - bd = bd.setScale(1, RoundingMode.HALF_UP); + if (scale.indexOf(".0") > 0) { + bd = bd.setScale(0, RoundingMode.HALF_UP); + } else { + bd = bd.setScale(1, RoundingMode.HALF_UP); + } rData = "_G_"+Fulltype+"_"+bd+".PHD"; }else if(dataType.contains(DataType.DETBKPHD.getType())){ bd = bd.setScale(0, RoundingMode.HALF_UP); rData = "_D_"+Fulltype+"_"+bd+".PHD"; }else if(dataType.contains(DataType.QCPHD.getType())){ - bd = bd.setScale(2, RoundingMode.HALF_UP); + if (scale.indexOf(".0") > 0) { + bd = bd.setScale(0, RoundingMode.HALF_UP); + } else { + bd = bd.setScale(2, RoundingMode.HALF_UP); + } rData = "_Q_"+Fulltype+"_"+bd+".PHD"; } return rData;