From 84d6c4a5a2c99a0d84b9c6edce90876a5c194556 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Mon, 15 Jan 2024 10:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86SOH,MET?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=AD=98=E5=82=A8=E5=86=85=E5=AE=B9=E4=B8=AD?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=98=AF=E5=8D=A0=E4=BD=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?-999999=E5=AD=98=E5=82=A8=E6=97=B6=E6=95=B0=E6=8D=AE=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=B6=85=E5=87=BA=E7=B2=BE=E5=BA=A6=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/util/NumberFormatUtil.java | 28 +++++++++++++++++++ .../service/impl/MetSpectrumServiceImpl.java | 14 ++++++---- .../service/impl/SOHSpectrumServiceImpl.java | 8 ++++-- .../impl/GardsStationsServiceImpl.java | 6 ---- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java index 36e1043e..94b60649 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NumberFormatUtil.java @@ -6,6 +6,8 @@ import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.math.MathContext; +import java.util.Arrays; +import java.util.List; @Component public class NumberFormatUtil { @@ -115,4 +117,30 @@ public class NumberFormatUtil { return value; } + public Double DoubleLimit(double data) { + BigDecimal number = new BigDecimal(data); + String limit = number.toPlainString(); + double rData=DoubleLimit(limit); + return rData; + } + + public double DoubleLimit(String data) { + double rData = Double.parseDouble(data); + String first = data; + List lstTemp = Arrays.asList(data.split("\\.")); + if(lstTemp.size()>1) { + first = lstTemp.get(0); + } + if(first.length()>3) { + StringBuffer temp= new StringBuffer("-"); + for(int pos=1;pos implements IMetSpectrumService { private final GardsStationsService stationsService; + private final NumberFormatUtil numberFormatUtil; /** * 保存气象谱数据 @@ -54,12 +56,12 @@ public class MetSpectrumServiceImpl extends ServiceImpl getGardsStations() { - if (redisUtil.hasKey("stationMap")){ - redisUtil.del("stationMap"); - } - if (redisUtil.hasKey("stationInfoMap")) { - redisUtil.del("stationInfoMap"); - } List gardsStations = this.baseMapper.selectList(new LambdaQueryWrapper<>()); Map stationMap = gardsStations.stream().collect(Collectors.toMap(GardsStations::getStationId, GardsStations::getStationCode)).entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey().toString(), Map.Entry::getValue));;