From 52c8d04a768563d8948053b74d673d79ae3d86fa Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 24 Oct 2023 10:57:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ReadLineUtil=E5=88=A0=E9=99=A4=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/common/util/ReadLineUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java index 6b39656f..26a27197 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/common/util/ReadLineUtil.java @@ -44,6 +44,7 @@ public class ReadLineUtil { throw new RuntimeException("ftp连接失败!"); } InputStream iStream = null; + File file = null; try { ftpClient.enterLocalPassiveMode(); String fileName = filePath.substring(filePath.lastIndexOf(StringPool.SLASH) + 1); @@ -63,7 +64,7 @@ public class ReadLineUtil { //读取ftp文件的输入流 iStream=ftpClient.retrieveFileStream(ftpFile.getName()); //声明一个临时文件 - File file = File.createTempFile("betaGamma", null); + file = File.createTempFile("betaGamma", null); //将ftp文件的输入流复制给临时文件 FileUtils.copyInputStreamToFile(iStream, file); List allLines = FileUtils.readLines(file, encoding); @@ -93,6 +94,9 @@ public class ReadLineUtil { if (Objects.nonNull(iStream)){ iStream.close(); } + if (Objects.nonNull(file)) { + file.delete(); + } } catch (IOException e) { throw new RuntimeException(e); } From 1a897868e58e837a4ebf94a487d51e80f6b8c0fc Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Tue, 24 Oct 2023 17:08:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=97=B6=EF=BC=8C=E6=B4=BB=E6=97=B6=E9=97=B4=E4=BF=9D?= =?UTF-8?q?=E7=95=996=E4=BD=8D=E6=9C=89=E6=95=88=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/NameStandUtil.java | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java index dd4e9302..b8fd9511 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.DecimalFormat; import java.text.ParseException; import java.util.HashMap; import java.util.LinkedList; @@ -86,34 +87,19 @@ public class NameStandUtil { public String GetSuffix(String dataType, String Fulltype, String LT) { String rData = ""; - BigDecimal bd = new BigDecimal(LT); + DecimalFormat df = new DecimalFormat("#.##########"); //AUX09_003-20151226_1855 _S_FULL_40184.8.PHD - //将acquisition_live_time保留一位小数 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位 - String scale = bd.setScale(1, RoundingMode.HALF_UP).toString(); + //将acquisition_live_time保留六位有效数字 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位 + String numberCal = NumberFormatUtil.numberCal(LT); + numberCal = df.format(Double.valueOf(numberCal)); if(dataType.contains(DataType.SAMPLEPHD.getType())) { - 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"; + rData = "_S_"+Fulltype+"_"+numberCal+".PHD"; } else if(dataType.contains(DataType.GASBKPHD.getType())){ - 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"; + rData = "_G_"+Fulltype+"_"+numberCal+".PHD"; }else if(dataType.contains(DataType.DETBKPHD.getType())){ - bd = bd.setScale(0, RoundingMode.HALF_UP); - rData = "_D_"+Fulltype+"_"+bd+".PHD"; + rData = "_D_"+Fulltype+"_"+numberCal+".PHD"; }else if(dataType.contains(DataType.QCPHD.getType())){ - 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"; + rData = "_Q_"+Fulltype+"_"+numberCal+".PHD"; } return rData; }