添加功能

This commit is contained in:
马宝龙
2026-07-04 23:16:01 +08:00
parent 39c766bf46
commit c4f44345e2
4 changed files with 16 additions and 6 deletions

View File

@@ -164,7 +164,9 @@ public class ModelEmploymentMonitorCompositeServiceImpl implements ModelEmployme
List<BigDecimal> compositeList = ModelIndicatorUtil.calculateComposite(result);
vo.setCompositeValueList(compositeList);
vo.setCurrentValue(compositeList.get(compositeList.size() - 1));
if (CollectionUtils.isNotEmpty(compositeList)) {
vo.setCurrentValue(compositeList.get(compositeList.size() - 1));
}
return vo;
}

View File

@@ -198,7 +198,9 @@ public class ModelUnemploymentWarningDiffusionServiceImpl implements ModelUnempl
List<BigDecimal> diffusionList = ModelIndicatorUtil.calculateDiffusion(result);
vo.setDiffusionValueList(diffusionList);
vo.setCurrentValue(diffusionList.get(diffusionList.size() - 1));
if (CollectionUtils.isNotEmpty(dataList)) {
vo.setCurrentValue(diffusionList.get(diffusionList.size() - 1));
}
return vo;
}

View File

@@ -17,6 +17,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
@@ -141,7 +142,7 @@ public class ModelIndicatorUtil {
}
List<ModelResultDataVo> dataList = indicatorData.getDataList();
for (ModelResultDataVo dataVo : dataList) {
dataVo.setValue(dataVo.getValue().multiply(indicatorWeight));
dataVo.setValue(dataVo.getValue().multiply(indicatorWeight).setScale(1, RoundingMode.HALF_UP));
}
}
@@ -152,6 +153,7 @@ public class ModelIndicatorUtil {
}
List<String> timeList = resultList.getT1();
BigDecimal[] sums = new BigDecimal[timeList.size()];
Arrays.fill(sums, BigDecimal.ZERO);
for (List<ModelResultDataVo> innerList : dataList) {
if (CollectionUtils.isEmpty(innerList)) {
continue;
@@ -195,8 +197,8 @@ public class ModelIndicatorUtil {
continue;
}
BigDecimal value;
BigDecimal currentValue = dataVo.getValue();
BigDecimal previousValue = dataList.get(i - 1).getValue();
BigDecimal currentValue = Optional.ofNullable(dataVo.getValue()).orElse(BigDecimal.ZERO);
BigDecimal previousValue = Optional.ofNullable(dataList.get(i - 1).getValue()).orElse(BigDecimal.ZERO);
if (1 == indicatorData.getIndicatorType()) {
// 正向指标
value = currentValue.compareTo(previousValue) > 0 ? BigDecimal.ONE :
@@ -221,7 +223,7 @@ public class ModelIndicatorUtil {
dataVo.setValue(null);
continue;
}
BigDecimal value = dataVo.getValue().multiply(weight).setScale(10, RoundingMode.HALF_UP);
BigDecimal value = dataVo.getValue().multiply(weight).setScale(1, RoundingMode.HALF_UP);
dataVo.setValue(value);
}
}
@@ -233,6 +235,7 @@ public class ModelIndicatorUtil {
}
List<String> timeList = resultList.getT1();
BigDecimal[] sums = new BigDecimal[timeList.size() - maxLeadPeriod];
Arrays.fill(sums, BigDecimal.ZERO);
for (List<ModelResultDataVo> innerList : dataList) {
if (CollectionUtils.isEmpty(innerList)) {
continue;

View File

@@ -118,6 +118,7 @@
FROM model_warning_indicator_data a
INNER JOIN model_unemployment_rate_monitor b ON a.indicator_code = b.indicator_code
WHERE a.region_code = #{regionCode}
group by a.year,a.month
),
year_month AS (
SELECT
@@ -157,6 +158,7 @@
FROM model_warning_indicator_data a
INNER JOIN model_employment_monitor_composite b ON a.indicator_code = b.indicator_code
WHERE a.region_code = #{regionCode}
group by a.year,a.month
),
year_month AS (
SELECT
@@ -197,6 +199,7 @@
FROM model_warning_indicator_data a
INNER JOIN model_unemployment_warning_diffusion b ON a.indicator_code = b.indicator_code
WHERE a.region_code = #{regionCode}
group by a.year,a.month
),
year_month AS (
SELECT