各国、各省省平均EQI分布折线图

This commit is contained in:
machao 2023-03-15 17:57:54 +08:00
parent 9158979599
commit f2bf70cf2a
6 changed files with 284 additions and 99 deletions

View File

@ -163,4 +163,20 @@ public class MonitorController {
PmKeyValueEnVo pmKeyValueEnVo = monitorService.eqiProvince(country, year, type); PmKeyValueEnVo pmKeyValueEnVo = monitorService.eqiProvince(country, year, type);
return AjaxResult.success(pmKeyValueEnVo); return AjaxResult.success(pmKeyValueEnVo);
} }
@RequestMapping(value = "/eqiCountryLine", method = {RequestMethod.GET})
@ApiOperation(value = "各地理亚区平均EQI分布折线图", httpMethod = "GET")
public AjaxResult eqiCountryLine(@RequestParam(value = "country") String country,
@RequestParam(value = "type") String type) {
PmKeyValueVo pmKeyValueVo = monitorService.eqiCountryLine(country, type);
return AjaxResult.success(pmKeyValueVo);
}
@RequestMapping(value = "/eqiProvinceLine", method = {RequestMethod.GET})
@ApiOperation(value = "各省平均EQI分布折线图", httpMethod = "GET")
public AjaxResult eqiProvinceLine(@RequestParam(value = "province") String province,
@RequestParam(value = "type") String type) {
PmKeyValueVo pmKeyValueVo = monitorService.eqiProvinceLine(province, type);
return AjaxResult.success(pmKeyValueVo);
}
} }

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper_yada;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain_yada.entity.*; import com.ruoyi.system.domain_yada.entity.*;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -23,6 +24,7 @@ public interface MonitorMapper {
/** /**
* 国家与省份对应关系 * 国家与省份对应关系
*
* @param country * @param country
* @return * @return
*/ */
@ -115,6 +117,7 @@ public interface MonitorMapper {
/** /**
* 柬埔寨KEQI分布 * 柬埔寨KEQI分布
*
* @param type * @param type
* @param province * @param province
* @return * @return
@ -124,6 +127,7 @@ public interface MonitorMapper {
/** /**
* 柬埔寨各省EQI分级 * 柬埔寨各省EQI分级
*
* @param year * @param year
* @param type * @param type
* @param province * @param province
@ -135,6 +139,7 @@ public interface MonitorMapper {
/** /**
* 各省KEQI变化率 * 各省KEQI变化率
*
* @param country * @param country
* @return * @return
*/ */
@ -142,11 +147,28 @@ public interface MonitorMapper {
/** /**
* 各省平均EQI分布 * 各省平均EQI分布
*
* @param country * @param country
* @param year * @param year
* @return * @return
*/ */
List<MonitorEQIProvinceEntity> eqiProvince(@Param("country") String country, List<MonitorEQIProvinceEntity> eqiProvince(@Param("country") String country,
@Param("year") String year); @Param("year") String year);
/**
* 各国平均EQI分布折线图
* @param country
* @return
*/
List<MonitorEQICountryEntity> eqiCountryLine(@Param("country") String country);
/**
* 各国省平均EQI分布折线图
*
* @param province
* @return
*/
List<MonitorEQIProvinceEntity> eqiProvinceLine(String province);
} }

View File

@ -143,4 +143,22 @@ public interface MonitorService {
* @return * @return
*/ */
PmKeyValueEnVo eqiProvince(String country,String year,String type); PmKeyValueEnVo eqiProvince(String country,String year,String type);
/**
* 各国平均EQI分布折线图
*
* @param country
* @param type
* @return
*/
PmKeyValueVo eqiCountryLine(String country, String type);
/**
* 各国省平均EQI分布折线图
*
* @param province
* @param type
* @return
*/
PmKeyValueVo eqiProvinceLine(String province, String type);
} }

View File

@ -113,7 +113,6 @@ public class ENSOImpactImpl implements ENSOImpactService {
@Override @Override
public ENSOEventAnalysisVo ensoEventAnalysis(String type, String zone) { public ENSOEventAnalysisVo ensoEventAnalysis(String type, String zone) {
//List<String> events = Arrays.asList("厄尔尼诺东部型","厄尔尼诺中部型","拉尼娜东部型","拉尼娜中部型");
List<String> yearEEP = Arrays.asList("1982", "1986", "1991", "1997", "2002", "2006", "2014"); List<String> yearEEP = Arrays.asList("1982", "1986", "1991", "1997", "2002", "2006", "2014");
List<String> yearECP = Arrays.asList("1994", "2004", "2009", "2018"); List<String> yearECP = Arrays.asList("1994", "2004", "2009", "2018");
List<String> yearLEP = Arrays.asList("1984", "1988", "1995", "2007", "2017", "2020"); List<String> yearLEP = Arrays.asList("1984", "1988", "1995", "2007", "2017", "2020");
@ -126,11 +125,8 @@ public class ENSOImpactImpl implements ENSOImpactService {
}}; }};
List<PmKeyValueVo> vo = new ArrayList<>(); List<PmKeyValueVo> vo = new ArrayList<>();
year.forEach(v -> { year.forEach(v -> {
//List<ENSOYearEventCorrespondingEntity> list = ensoImpactMapper.ensoEventYearCorresponding(v);
//List<String> year = new ArrayList<>();
List<String> key = new ArrayList<>(); List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>(); List<Double> value = new ArrayList<>();
//list.forEach(e-> year.add(e.getYear()));
List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v); List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v);
ensoEventAnalysisEntities.forEach(k -> { ensoEventAnalysisEntities.forEach(k -> {
key.add(k.getYear()); key.add(k.getYear());

View File

@ -11,6 +11,7 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 亚大综合监测 * 亚大综合监测
@ -347,5 +348,101 @@ public class MonitorImpl implements MonitorService {
} }
return new PmKeyValueEnVo(key, keyEn, value); return new PmKeyValueEnVo(key, keyEn, value);
} }
@Override
public PmKeyValueVo eqiCountryLine(String country, String type) {
List<MonitorEQICountryEntity> list = monitorMapper.eqiCountryLine(country);
list.sort(Comparator.comparing(MonitorEQICountryEntity::getYear));
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
switch (type) {
case FOREST:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getForestEQI()));
});
break;
case SHRUB:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getShrubEQI()));
});
break;
case GRASS:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getGrassEQI()));
});
break;
case FARMLAND:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getFarmlandEQI()));
});
break;
case MOUNTAIN:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getMountainEQI()));
});
break;
case ALL:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getAllEQI()));
});
break;
default:
}
return new PmKeyValueVo(key,value);
}
@Override
public PmKeyValueVo eqiProvinceLine(String province, String type) {
List<MonitorEQIProvinceEntity> list = monitorMapper.eqiProvinceLine(province);
list.sort(Comparator.comparing(MonitorEQIProvinceEntity::getYear));
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
switch (type) {
case FOREST:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getForest()));
});
break;
case SHRUB:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getShrub()));
});
break;
case GRASS:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getGrass()));
});
break;
case FARMLAND:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getFarmland()));
});
break;
case MOUNTAIN:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getMountain()));
});
break;
case ALL:
list.forEach(v -> {
key.add(v.getYear());
value.add(Double.valueOf(v.getAll()));
});
break;
default:
}
return new PmKeyValueVo(key,value);
}
} }

View File

@ -396,4 +396,40 @@
where mep.year = #{year} where mep.year = #{year}
and mep.country = #{country} and mep.country = #{country}
</select> </select>
<select id="eqiCountryLine" resultMap="Monitor_EQI_Country">
select mec.id,
mec.year,
mec.country,
mec.country_en,
mec.all_eqi,
mec.forest_eqi,
mec.shrub_eqi,
mec.grass_eqi,
mec.farmland_eqi,
mec.mountain_eqi,
mec.all_pixel,
mec.forest_pixel,
mec.shrub_pixel,
mec.grass_pixel,
mec.farmland_pixel,
mec.mountain_pixel
from monitor_eqi_country mec
where mec.country = #{country}
</select>
<select id="eqiProvinceLine" resultMap="Monitor_EQI_Province">
select mep.id,
mep.year,
mep.province,
mep.province_en,
mep.all,
mep.forest,
mep.shrub,
mep.grass,
mep.farmland,
mep.mountain
from monitor_eqi_province mep
where mep.province = #{province}
</select>
</mapper> </mapper>