diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/MonitorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/MonitorController.java index 05b1e3a9e..0a43da565 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/MonitorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/yada/MonitorController.java @@ -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); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/MonitorMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/MonitorMapper.java index bbe3b09a8..a0af19b6a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/MonitorMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/MonitorMapper.java @@ -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 eqiProvince(@Param("country") String country, - @Param("year")String year); + @Param("year") String year); + + + /** + * 各国平均EQI分布折线图 + * @param country + * @return + */ + List eqiCountryLine(@Param("country") String country); + + /** + * 各国省平均EQI分布折线图 + * + * @param province + * @return + */ + List eqiProvinceLine(String province); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/MonitorService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/MonitorService.java index 6996e9cf1..13d830169 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/MonitorService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/MonitorService.java @@ -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); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ENSOImpactImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ENSOImpactImpl.java index ca886d5af..7c1e150e7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ENSOImpactImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ENSOImpactImpl.java @@ -113,7 +113,6 @@ public class ENSOImpactImpl implements ENSOImpactService { @Override public ENSOEventAnalysisVo ensoEventAnalysis(String type, String zone) { - //List events = Arrays.asList("厄尔尼诺东部型","厄尔尼诺中部型","拉尼娜东部型","拉尼娜中部型"); List yearEEP = Arrays.asList("1982", "1986", "1991", "1997", "2002", "2006", "2014"); List yearECP = Arrays.asList("1994", "2004", "2009", "2018"); List yearLEP = Arrays.asList("1984", "1988", "1995", "2007", "2017", "2020"); @@ -126,11 +125,8 @@ public class ENSOImpactImpl implements ENSOImpactService { }}; List vo = new ArrayList<>(); year.forEach(v -> { - //List list = ensoImpactMapper.ensoEventYearCorresponding(v); - //List year = new ArrayList<>(); List key = new ArrayList<>(); List value = new ArrayList<>(); - //list.forEach(e-> year.add(e.getYear())); List ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v); ensoEventAnalysisEntities.forEach(k -> { key.add(k.getYear()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/MonitorImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/MonitorImpl.java index a849dc116..24234121b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/MonitorImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/MonitorImpl.java @@ -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 list = monitorMapper.countryCorresponding(region); List country = new ArrayList<>(); - list.forEach(v->country.add(v.getCountry())); + list.forEach(v -> country.add(v.getCountry())); List key = new ArrayList<>(); List keyEn = new ArrayList<>(); List value = new ArrayList<>(); @@ -179,7 +180,7 @@ public class MonitorImpl implements MonitorService { public PmKeyValueEnVo keqiCountryRate(String region, String type) { List list = monitorMapper.countryCorresponding(region); List country = new ArrayList<>(); - list.forEach(v->country.add(v.getCountry())); + list.forEach(v -> country.add(v.getCountry())); List key = new ArrayList<>(); List keyEn = new ArrayList<>(); List 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 list = monitorMapper.eqiAsiaLine(region,start,end); + public PmKeyValueVo eqiAsiaLine(String region, String type, String start, String end) { + List list = monitorMapper.eqiAsiaLine(region, start, end); list.sort(Comparator.comparing(MonitorEQIAsiaEntity::getYear)); List key = new ArrayList<>(); List 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 list = monitorMapper.keqiProvinceRate(country); + List key = new ArrayList<>(); + List keyEn = new ArrayList<>(); + List 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 list = monitorMapper.eqiProvince(country, year); + List key = new ArrayList<>(); + List keyEn = new ArrayList<>(); + List 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 list = monitorMapper.eqiCountryLine(country); + list.sort(Comparator.comparing(MonitorEQICountryEntity::getYear)); + List key = new ArrayList<>(); + List 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 list = monitorMapper.eqiProvinceLine(province); + list.sort(Comparator.comparing(MonitorEQIProvinceEntity::getYear)); + List key = new ArrayList<>(); + List 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 list = monitorMapper.keqiProvinceRate(country); - List key = new ArrayList<>(); - List keyEn = new ArrayList<>(); - List 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 list = monitorMapper.eqiProvince(country, year); - List key = new ArrayList<>(); - List keyEn = new ArrayList<>(); - List 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); - } } diff --git a/ruoyi-system/src/main/resources/mapper/system/MonitorMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MonitorMapper.xml index 7f46ebabe..070e75525 100644 --- a/ruoyi-system/src/main/resources/mapper/system/MonitorMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/MonitorMapper.xml @@ -192,7 +192,7 @@ @@ -396,4 +396,40 @@ where mep.year = #{year} and mep.country = #{country} + + + + \ No newline at end of file