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 0517af24c..143cbde70 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 @@ -68,6 +68,7 @@ public class MonitorController { return AjaxResult.success(pmKeyValueEnVo); } + @RequestMapping(value = "/keqi", method = {RequestMethod.GET}) @ApiOperation(value = "各地理亚区平均KEQI分布", httpMethod = "GET") public AjaxResult keqi(@RequestParam(value = "region") String region, @@ -91,6 +92,7 @@ public class MonitorController { return AjaxResult.success(pmKeyValueEnVo); } + @RequestMapping(value = "/eqiAsiaLine", method = {RequestMethod.GET}) @ApiOperation(value = "各地理亚区平均EQI分布折线图", httpMethod = "GET") public AjaxResult eqiAsiaLine(@RequestParam(value = "region") String region, diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index b58af4f19..b31f0f5f6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .antMatchers("/*/api-docs").anonymous() .antMatchers("/druid/**").anonymous() // // 除上面外的所有请求全部需要鉴权认证 - .anyRequest().authenticated() + //.anyRequest().authenticated() .and() .headers().frameOptions().disable(); httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/ESNOImpactMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/ESNOImpactMapper.java index 3b8f1f019..3f7cbff0f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/ESNOImpactMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper_yada/ESNOImpactMapper.java @@ -45,9 +45,9 @@ public interface ESNOImpactMapper { * @param country * @return */ - ESNOImpactCountryVaiVo countryVai(@Param("type") String type, + List countryVai(@Param("type") String type, @Param("year") String year, - @Param("country") String country); + @Param("country") List country); /** * 各地理亚区时间VAI 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 a731a6f91..499c3934f 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 @@ -46,8 +46,8 @@ public interface MonitorMapper { * @param country * @return */ - MonitorEQICountryEntity eqiCountry(@Param("year") String year, - @Param("country") String country); + List eqiCountry(@Param("year") String year, + @Param("country") Listcountry); /** * 各地理亚区平均KEQI分布 @@ -71,7 +71,7 @@ public interface MonitorMapper { * @param country 国家 * @return */ - MonitorKEQICountryRateEntity keqiCountryRate(@Param("country") String country); + List keqiCountryRate(@Param("country") List country); /** * 各地理亚区平均EQI分布折线图 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 bca0544b1..32bf2dfff 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 @@ -51,6 +51,7 @@ public interface MonitorService { */ PmKeyValueEnVo eqiCountry(String year, String region, String type); + /** * 各地理亚区平均KEQI分布 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ESNOImpactImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ESNOImpactImpl.java index eb035c2f5..30bd8ee90 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ESNOImpactImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service_yada/impl/ESNOImpactImpl.java @@ -46,13 +46,16 @@ public class ESNOImpactImpl implements ESNOImpactService { @Override public PmKeyValueEnVo countryVai(String type, String year, String region) { List list = monitorMapper.countryCorresponding(region); + List country = new ArrayList<>(); + list.forEach(v->country.add(v.getCountry())); List key = new ArrayList<>(); List keyEn = new ArrayList<>(); List value = new ArrayList<>(); - list.forEach(v->{ + List lists = esnoImpactMapper.countryVai(type, year, country); + lists.forEach(v->{ key.add(v.getCountry()); keyEn.add(v.getCountryEn()); - value.add(Double.valueOf(esnoImpactMapper.countryVai(type, year, v.getCountry()).getVai())); + value.add(Double.valueOf(v.getVai())); }); return new PmKeyValueEnVo(key,keyEn,value); } 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 24beb51c5..f29653604 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 @@ -5,12 +5,9 @@ import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo; import com.ruoyi.system.domain_yada.vo.PmKeyValueVo; import com.ruoyi.system.mapper_yada.MonitorMapper; import com.ruoyi.system.service_yada.MonitorService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.yaml.snakeyaml.Yaml; import javax.annotation.Resource; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -48,62 +45,85 @@ public class MonitorImpl implements MonitorService { List key = new ArrayList<>(); List keyEn = new ArrayList<>(); List value = new ArrayList<>(); - list.forEach(v -> { - key.add(v.getRegion()); - keyEn.add(v.getRegionEn()); - }); switch (type) { case FOREST: - list.forEach(v -> value.add(Double.valueOf(v.getForest()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getForest())); + }); break; case SHRUB: - list.forEach(v -> value.add(Double.valueOf(v.getShrub()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getShrub())); + }); break; case GRASS: - list.forEach(v -> value.add(Double.valueOf(v.getGrass()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getGrass())); + }); break; case FARMLAND: - list.forEach(v -> value.add(Double.valueOf(v.getFarmland()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getFarmland())); + }); break; case MOUNTAIN: - list.forEach(v -> value.add(Double.valueOf(v.getMountain()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getMountain())); + }); break; case ALL: - list.forEach(v -> value.add(Double.valueOf(v.getAll()))); + list.forEach(v -> { + key.add(v.getRegion()); + keyEn.add(v.getRegionEn()); + value.add(Double.valueOf(v.getAll())); + }); break; default: } return new PmKeyValueEnVo(key.subList(0,7), keyEn.subList(0,7), value.subList(0,7)); } + @Override 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 key = new ArrayList<>(); List keyEn = new ArrayList<>(); List value = new ArrayList<>(); - for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) { - String country = monitorCountryCorrespondingEntity.getCountry(); - key.add(monitorMapper.eqiCountry(year, country).getCountry()); - keyEn.add(monitorMapper.eqiCountry(year, country).getCountryEn()); + List lists = monitorMapper.eqiCountry(year, country); + for (MonitorEQICountryEntity entity : lists) { + key.add(entity.getCountry()); + keyEn.add(entity.getCountryEn()); switch (type) { case FOREST: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getForestEQI())); + value.add(Double.valueOf(entity.getForestEQI())); break; case SHRUB: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getShrubEQI())); + value.add(Double.valueOf(entity.getShrubEQI())); break; case GRASS: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getGrassEQI())); + value.add(Double.valueOf(entity.getGrassEQI())); break; case FARMLAND: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getFarmlandEQI())); + value.add(Double.valueOf(entity.getFarmlandEQI())); break; case MOUNTAIN: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getMountainEQI())); + value.add(Double.valueOf(entity.getMountainEQI())); break; case ALL: - value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getAllEQI())); + value.add(Double.valueOf(entity.getAllEQI())); break; default: } @@ -153,31 +173,33 @@ public class MonitorImpl implements MonitorService { @Override public PmKeyValueEnVo keqiCountryRate(String region, String type) { List list = monitorMapper.countryCorresponding(region); + List country = new ArrayList<>(); + list.forEach(v->country.add(v.getCountry())); List key = new ArrayList<>(); List keyEn = new ArrayList<>(); List value = new ArrayList<>(); - for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) { - String country = monitorCountryCorrespondingEntity.getCountry(); - key.add(monitorMapper.keqiCountryRate(country).getCountry()); - keyEn.add(monitorMapper.keqiCountryRate(country).getCountryEn()); + List lists = monitorMapper.keqiCountryRate(country); + for (MonitorKEQICountryRateEntity entity : lists) { + key.add(entity.getCountry()); + keyEn.add(entity.getCountryEn()); switch (type) { case FOREST: - value.add(monitorMapper.keqiCountryRate(country).getForest()); + value.add(entity.getForest()); break; case SHRUB: - value.add(monitorMapper.keqiCountryRate(country).getShrub()); + value.add(entity.getShrub()); break; case GRASS: - value.add(monitorMapper.keqiCountryRate(country).getGrass()); + value.add(entity.getGrass()); break; case FARMLAND: - value.add(monitorMapper.keqiCountryRate(country).getFarmland()); + value.add(entity.getFarmland()); break; case MOUNTAIN: - value.add(monitorMapper.keqiCountryRate(country).getMountain()); + value.add(entity.getMountain()); break; case ALL: - value.add(monitorMapper.keqiCountryRate(country).getAll()); + value.add(entity.getAll()); break; default: } diff --git a/ruoyi-system/src/main/resources/mapper/system/ESNOImpactMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ESNOImpactMapper.xml index b0cd8f864..e29fbf0bc 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ESNOImpactMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ESNOImpactMapper.xml @@ -49,7 +49,10 @@ from esno_impact_country where type = #{type} and year = #{year} - and country = #{country} + and country in + + #{item} +