各国、各省省平均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);
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.system.domain_yada.entity.*;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -23,6 +24,7 @@ public interface MonitorMapper {
/**
* 国家与省份对应关系
*
* @param country
* @return
*/
@ -115,6 +117,7 @@ public interface MonitorMapper {
/**
* 柬埔寨KEQI分布
*
* @param type
* @param province
* @return
@ -124,6 +127,7 @@ public interface MonitorMapper {
/**
* 柬埔寨各省EQI分级
*
* @param year
* @param type
* @param province
@ -135,6 +139,7 @@ public interface MonitorMapper {
/**
* 各省KEQI变化率
*
* @param country
* @return
*/
@ -142,11 +147,28 @@ public interface MonitorMapper {
/**
* 各省平均EQI分布
*
* @param country
* @param year
* @return
*/
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
*/
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
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> yearECP = Arrays.asList("1994", "2004", "2009", "2018");
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<>();
year.forEach(v -> {
//List<ENSOYearEventCorrespondingEntity> list = ensoImpactMapper.ensoEventYearCorresponding(v);
//List<String> year = new ArrayList<>();
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
//list.forEach(e-> year.add(e.getYear()));
List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v);
ensoEventAnalysisEntities.forEach(k -> {
key.add(k.getYear());

View File

@ -11,6 +11,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 亚大综合监测
@ -95,7 +96,7 @@ public class MonitorImpl implements MonitorService {
break;
default:
}
return new PmKeyValueEnVo(key.subList(0,7), keyEn.subList(0,7), value.subList(0,7));
return new PmKeyValueEnVo(key.subList(0, 7), keyEn.subList(0, 7), value.subList(0, 7));
}
@ -103,7 +104,7 @@ public class MonitorImpl implements MonitorService {
public PmKeyValueEnVo eqiCountry(String year, String region, String type) {
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
List<String> country = new ArrayList<>();
list.forEach(v->country.add(v.getCountry()));
list.forEach(v -> country.add(v.getCountry()));
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
@ -179,7 +180,7 @@ public class MonitorImpl implements MonitorService {
public PmKeyValueEnVo keqiCountryRate(String region, String type) {
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
List<String> country = new ArrayList<>();
list.forEach(v->country.add(v.getCountry()));
list.forEach(v -> country.add(v.getCountry()));
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
@ -213,8 +214,8 @@ public class MonitorImpl implements MonitorService {
}
@Override
public PmKeyValueVo eqiAsiaLine(String region, String type,String start ,String end) {
List<MonitorEQIAsiaEntity> list = monitorMapper.eqiAsiaLine(region,start,end);
public PmKeyValueVo eqiAsiaLine(String region, String type, String start, String end) {
List<MonitorEQIAsiaEntity> list = monitorMapper.eqiAsiaLine(region, start, end);
list.sort(Comparator.comparing(MonitorEQIAsiaEntity::getYear));
List<String> key = new ArrayList<>();
List<Double> value = new ArrayList<>();
@ -257,95 +258,191 @@ public class MonitorImpl implements MonitorService {
break;
default:
}
return new PmKeyValueVo(key, value);
}
@Override
public MonitorEQICountryGradingEntity eqiCountryGrading(String year, String country, String type) {
return monitorMapper.eqiCountryGrading(year, country, type);
}
@Override
public MonitorKEQICountryEntity keqiCountry(String type, String country) {
return monitorMapper.keqiCountry(type, country);
}
@Override
public MonitorKEQICambodiaEntity keqiCambodia(String type, String province) {
return monitorMapper.keqiCambodia(type, province);
}
@Override
public MonitorEQICambodiaGradingEntity eqiCambodiaGrading(String year, String province, String type) {
return monitorMapper.eqiCambodiaGrading(year, province, type);
}
@Override
public PmKeyValueEnVo keqiProvinceRate(String country, String type) {
List<MonitorKEQIProvinceRateEntity> list = monitorMapper.keqiProvinceRate(country);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorKEQIProvinceRateEntity entity : list) {
key.add(entity.getProvince());
keyEn.add(entity.getProvinceEn());
switch (type) {
case FOREST:
value.add(entity.getForest());
break;
case SHRUB:
value.add(entity.getShrub());
break;
case GRASS:
value.add(entity.getGrass());
break;
case FARMLAND:
value.add(entity.getFarmland());
break;
case MOUNTAIN:
value.add(entity.getMountain());
break;
case ALL:
value.add(entity.getAll());
break;
default:
}
}
return new PmKeyValueEnVo(key, keyEn, value);
}
@Override
public PmKeyValueEnVo eqiProvince(String country, String year, String type) {
List<MonitorEQIProvinceEntity> list = monitorMapper.eqiProvince(country, year);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorEQIProvinceEntity entity : list) {
key.add(entity.getProvince());
keyEn.add(entity.getProvinceEn());
switch (type) {
case FOREST:
value.add(Double.valueOf(entity.getForest()));
break;
case SHRUB:
value.add(Double.valueOf(entity.getShrub()));
break;
case GRASS:
value.add(Double.valueOf(entity.getGrass()));
break;
case FARMLAND:
value.add(Double.valueOf(entity.getFarmland()));
break;
case MOUNTAIN:
value.add(Double.valueOf(entity.getMountain()));
break;
case ALL:
value.add(Double.valueOf(entity.getAll()));
break;
default:
}
}
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);
}
@Override
public MonitorEQICountryGradingEntity eqiCountryGrading(String year, String country, String type) {
return monitorMapper.eqiCountryGrading(year, country, type);
}
@Override
public MonitorKEQICountryEntity keqiCountry(String type, String country) {
return monitorMapper.keqiCountry(type, country);
}
@Override
public MonitorKEQICambodiaEntity keqiCambodia(String type, String province) {
return monitorMapper.keqiCambodia(type,province);
}
@Override
public MonitorEQICambodiaGradingEntity eqiCambodiaGrading(String year, String province, String type) {
return monitorMapper.eqiCambodiaGrading(year,province,type);
}
@Override
public PmKeyValueEnVo keqiProvinceRate(String country, String type) {
List<MonitorKEQIProvinceRateEntity> list = monitorMapper.keqiProvinceRate(country);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorKEQIProvinceRateEntity entity : list) {
key.add(entity.getProvince());
keyEn.add(entity.getProvinceEn());
switch (type) {
case FOREST:
value.add(entity.getForest());
break;
case SHRUB:
value.add(entity.getShrub());
break;
case GRASS:
value.add(entity.getGrass());
break;
case FARMLAND:
value.add(entity.getFarmland());
break;
case MOUNTAIN:
value.add(entity.getMountain());
break;
case ALL:
value.add(entity.getAll());
break;
default:
}
}
return new PmKeyValueEnVo(key,keyEn,value);
}
@Override
public PmKeyValueEnVo eqiProvince(String country, String year, String type) {
List<MonitorEQIProvinceEntity> list = monitorMapper.eqiProvince(country, year);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorEQIProvinceEntity entity : list) {
key.add(entity.getProvince());
keyEn.add(entity.getProvinceEn());
switch (type) {
case FOREST:
value.add(Double.valueOf(entity.getForest()));
break;
case SHRUB:
value.add(Double.valueOf(entity.getShrub()));
break;
case GRASS:
value.add(Double.valueOf(entity.getGrass()));
break;
case FARMLAND:
value.add(Double.valueOf(entity.getFarmland()));
break;
case MOUNTAIN:
value.add(Double.valueOf(entity.getMountain()));
break;
case ALL:
value.add(Double.valueOf(entity.getAll()));
break;
default:
}
}
return new PmKeyValueEnVo(key,keyEn,value);
}
}

View File

@ -192,7 +192,7 @@
</resultMap>
<select id="provinceCorresponding" resultMap="Province_Corresponding">
select id, country, province,province_en
select id, country, province, province_en
from province_corresponding
where country = #{country}
</select>
@ -396,4 +396,40 @@
where mep.year = #{year}
and mep.country = #{country}
</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>