添加功能
This commit is contained in:
@@ -164,7 +164,9 @@ public class ModelEmploymentMonitorCompositeServiceImpl implements ModelEmployme
|
|||||||
|
|
||||||
List<BigDecimal> compositeList = ModelIndicatorUtil.calculateComposite(result);
|
List<BigDecimal> compositeList = ModelIndicatorUtil.calculateComposite(result);
|
||||||
vo.setCompositeValueList(compositeList);
|
vo.setCompositeValueList(compositeList);
|
||||||
vo.setCurrentValue(compositeList.get(compositeList.size() - 1));
|
if (CollectionUtils.isNotEmpty(compositeList)) {
|
||||||
|
vo.setCurrentValue(compositeList.get(compositeList.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,7 +198,9 @@ public class ModelUnemploymentWarningDiffusionServiceImpl implements ModelUnempl
|
|||||||
|
|
||||||
List<BigDecimal> diffusionList = ModelIndicatorUtil.calculateDiffusion(result);
|
List<BigDecimal> diffusionList = ModelIndicatorUtil.calculateDiffusion(result);
|
||||||
vo.setDiffusionValueList(diffusionList);
|
vo.setDiffusionValueList(diffusionList);
|
||||||
vo.setCurrentValue(diffusionList.get(diffusionList.size() - 1));
|
if (CollectionUtils.isNotEmpty(dataList)) {
|
||||||
|
vo.setCurrentValue(diffusionList.get(diffusionList.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +142,7 @@ public class ModelIndicatorUtil {
|
|||||||
}
|
}
|
||||||
List<ModelResultDataVo> dataList = indicatorData.getDataList();
|
List<ModelResultDataVo> dataList = indicatorData.getDataList();
|
||||||
for (ModelResultDataVo dataVo : dataList) {
|
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();
|
List<String> timeList = resultList.getT1();
|
||||||
BigDecimal[] sums = new BigDecimal[timeList.size()];
|
BigDecimal[] sums = new BigDecimal[timeList.size()];
|
||||||
|
Arrays.fill(sums, BigDecimal.ZERO);
|
||||||
for (List<ModelResultDataVo> innerList : dataList) {
|
for (List<ModelResultDataVo> innerList : dataList) {
|
||||||
if (CollectionUtils.isEmpty(innerList)) {
|
if (CollectionUtils.isEmpty(innerList)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -195,8 +197,8 @@ public class ModelIndicatorUtil {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BigDecimal value;
|
BigDecimal value;
|
||||||
BigDecimal currentValue = dataVo.getValue();
|
BigDecimal currentValue = Optional.ofNullable(dataVo.getValue()).orElse(BigDecimal.ZERO);
|
||||||
BigDecimal previousValue = dataList.get(i - 1).getValue();
|
BigDecimal previousValue = Optional.ofNullable(dataList.get(i - 1).getValue()).orElse(BigDecimal.ZERO);
|
||||||
if (1 == indicatorData.getIndicatorType()) {
|
if (1 == indicatorData.getIndicatorType()) {
|
||||||
// 正向指标
|
// 正向指标
|
||||||
value = currentValue.compareTo(previousValue) > 0 ? BigDecimal.ONE :
|
value = currentValue.compareTo(previousValue) > 0 ? BigDecimal.ONE :
|
||||||
@@ -221,7 +223,7 @@ public class ModelIndicatorUtil {
|
|||||||
dataVo.setValue(null);
|
dataVo.setValue(null);
|
||||||
continue;
|
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);
|
dataVo.setValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,6 +235,7 @@ public class ModelIndicatorUtil {
|
|||||||
}
|
}
|
||||||
List<String> timeList = resultList.getT1();
|
List<String> timeList = resultList.getT1();
|
||||||
BigDecimal[] sums = new BigDecimal[timeList.size() - maxLeadPeriod];
|
BigDecimal[] sums = new BigDecimal[timeList.size() - maxLeadPeriod];
|
||||||
|
Arrays.fill(sums, BigDecimal.ZERO);
|
||||||
for (List<ModelResultDataVo> innerList : dataList) {
|
for (List<ModelResultDataVo> innerList : dataList) {
|
||||||
if (CollectionUtils.isEmpty(innerList)) {
|
if (CollectionUtils.isEmpty(innerList)) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
FROM model_warning_indicator_data a
|
FROM model_warning_indicator_data a
|
||||||
INNER JOIN model_unemployment_rate_monitor b ON a.indicator_code = b.indicator_code
|
INNER JOIN model_unemployment_rate_monitor b ON a.indicator_code = b.indicator_code
|
||||||
WHERE a.region_code = #{regionCode}
|
WHERE a.region_code = #{regionCode}
|
||||||
|
group by a.year,a.month
|
||||||
),
|
),
|
||||||
year_month AS (
|
year_month AS (
|
||||||
SELECT
|
SELECT
|
||||||
@@ -157,6 +158,7 @@
|
|||||||
FROM model_warning_indicator_data a
|
FROM model_warning_indicator_data a
|
||||||
INNER JOIN model_employment_monitor_composite b ON a.indicator_code = b.indicator_code
|
INNER JOIN model_employment_monitor_composite b ON a.indicator_code = b.indicator_code
|
||||||
WHERE a.region_code = #{regionCode}
|
WHERE a.region_code = #{regionCode}
|
||||||
|
group by a.year,a.month
|
||||||
),
|
),
|
||||||
year_month AS (
|
year_month AS (
|
||||||
SELECT
|
SELECT
|
||||||
@@ -197,6 +199,7 @@
|
|||||||
FROM model_warning_indicator_data a
|
FROM model_warning_indicator_data a
|
||||||
INNER JOIN model_unemployment_warning_diffusion b ON a.indicator_code = b.indicator_code
|
INNER JOIN model_unemployment_warning_diffusion b ON a.indicator_code = b.indicator_code
|
||||||
WHERE a.region_code = #{regionCode}
|
WHERE a.region_code = #{regionCode}
|
||||||
|
group by a.year,a.month
|
||||||
),
|
),
|
||||||
year_month AS (
|
year_month AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
Reference in New Issue
Block a user