综合监测模块字段修改

This commit is contained in:
machao 2022-11-09 15:25:03 +08:00
parent 53b00a7d28
commit 96f4881285
8 changed files with 345 additions and 113 deletions

View File

@ -2,6 +2,8 @@ package com.ruoyi.web.controller.yada;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_yada.entity.*; import com.ruoyi.system.domain_yada.entity.*;
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
import com.ruoyi.system.domain_yada.vo.PmKeyValueVo;
import com.ruoyi.system.domain_yada.vo.PmYearConcentrationRatioVo; import com.ruoyi.system.domain_yada.vo.PmYearConcentrationRatioVo;
import com.ruoyi.system.service_yada.MonitorService; import com.ruoyi.system.service_yada.MonitorService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -42,61 +44,62 @@ public class MonitorController {
@RequestMapping(value = "/eqiGrading", method = {RequestMethod.GET}) @RequestMapping(value = "/eqiGrading", method = {RequestMethod.GET})
@ApiOperation(value = "亚大区域地理亚区EQI分级", httpMethod = "GET") @ApiOperation(value = "亚大区域地理亚区EQI分级", httpMethod = "GET")
public AjaxResult eqiGrading(@RequestParam(value = "year") String year, public AjaxResult eqiGrading(@RequestParam(value = "year") String year,
@RequestParam(value = "type") String type,
@RequestParam(value = "region") String region) { @RequestParam(value = "region") String region) {
List<MonitorEQIGradingEntity> list = monitorService.eqiGrading(year, region); MonitorEQIGradingEntity monitorEQIGradingEntity = monitorService.eqiGrading(year, type, region);
if (list.isEmpty()) { return AjaxResult.success(monitorEQIGradingEntity);
return AjaxResult.error("未查找到信息");
}
return AjaxResult.success(list);
} }
@RequestMapping(value = "/eqiAsia", method = {RequestMethod.GET}) @RequestMapping(value = "/eqiAsia", method = {RequestMethod.GET})
@ApiOperation(value = "地理亚区平均EQI分布", httpMethod = "GET") @ApiOperation(value = "地理亚区平均EQI分布", httpMethod = "GET")
public AjaxResult eqiAsia(@RequestParam(value = "year") String year) { public AjaxResult eqiAsia(@RequestParam(value = "year") String year,
List<MonitorEQIAsiaEntity> list = monitorService.eqiAsia(year); @RequestParam(value = "type") String type) {
if (list.isEmpty()) { PmKeyValueEnVo pmKeyValueEnVo = monitorService.eqiAsia(year, type);
return AjaxResult.error("未查找到信息"); return AjaxResult.success(pmKeyValueEnVo);
}
return AjaxResult.success(list);
} }
@RequestMapping(value = "/eqiCountry", method = {RequestMethod.GET}) @RequestMapping(value = "/eqiCountry", method = {RequestMethod.GET})
@ApiOperation(value = "各国家平均EQI分布", httpMethod = "GET") @ApiOperation(value = "各国家平均EQI分布", httpMethod = "GET")
public AjaxResult eqiCountry(@RequestParam(value = "year") String year, public AjaxResult eqiCountry(@RequestParam(value = "year") String year,
@RequestParam(value = "region") String region) { @RequestParam(value = "region") String region,
List<MonitorEQICountryEntity> list = monitorService.eqiCountry(year, region); @RequestParam(value = "type") String type) {
if (list.isEmpty()) { PmKeyValueEnVo pmKeyValueEnVo = monitorService.eqiCountry(year, region, type);
return AjaxResult.error("未查找到信息");
} return AjaxResult.success(pmKeyValueEnVo);
return AjaxResult.success(list);
} }
@RequestMapping(value = "/keqi", method = {RequestMethod.GET}) @RequestMapping(value = "/keqi", method = {RequestMethod.GET})
@ApiOperation(value = "各地理亚区平均KEQI分布", httpMethod = "GET") @ApiOperation(value = "各地理亚区平均KEQI分布", httpMethod = "GET")
public AjaxResult keqi(@RequestParam(value = "region") String region) { public AjaxResult keqi(@RequestParam(value = "region") String region,
List<MonitorKEQIEntity> list = monitorService.keqi(region); @RequestParam(value = "type") String type) {
if (list.isEmpty()) { MonitorKEQIEntity keqi = monitorService.keqi(type, region);
return AjaxResult.error("未查找到信息"); return AjaxResult.success(keqi);
}
return AjaxResult.success(list);
} }
@RequestMapping(value = "/keqiAsiaRate", method = {RequestMethod.GET}) @RequestMapping(value = "/keqiAsiaRate", method = {RequestMethod.GET})
@ApiOperation(value = "各地理亚区平均KEQI变化率", httpMethod = "GET") @ApiOperation(value = "各地理亚区平均KEQI变化率", httpMethod = "GET")
public AjaxResult keqiAsiaRate() { public AjaxResult keqiAsiaRate(@RequestParam(value = "type") String type) {
List<MonitorKEQIAsiaRateEntity> list = monitorService.keqiAsiaRate(); PmKeyValueEnVo pmKeyValueEnVo = monitorService.keqiAsiaRate(type);
if (list.isEmpty()) { return AjaxResult.success(pmKeyValueEnVo);
return AjaxResult.error("未查找到信息");
}
return AjaxResult.success(list);
} }
@RequestMapping(value = "/keqiCountryRate", method = {RequestMethod.GET}) @RequestMapping(value = "/keqiCountryRate", method = {RequestMethod.GET})
@ApiOperation(value = "各国平均KEQI变化率", httpMethod = "GET") @ApiOperation(value = "各国平均KEQI变化率", httpMethod = "GET")
public AjaxResult keqiCountryRate(@RequestParam(value = "region") String region) { public AjaxResult keqiCountryRate(@RequestParam(value = "region") String region,
List<MonitorKEQICountryRateEntity> list = monitorService.keqiCountryRate(region); @RequestParam(value = "type") String type) {
if (list.isEmpty()) { PmKeyValueEnVo pmKeyValueEnVo = monitorService.keqiCountryRate(region, type);
return AjaxResult.error("未查找到信息"); return AjaxResult.success(pmKeyValueEnVo);
} }
return AjaxResult.success(list);
@RequestMapping(value = "/eqiAsiaLine", method = {RequestMethod.GET})
@ApiOperation(value = "各地理亚区平均EQI分布折线图", httpMethod = "GET")
public AjaxResult eqiAsiaLine(@RequestParam(value = "region") String region,
@RequestParam(value = "type") String type,
@RequestParam(value = "start") String start,
@RequestParam(value = "end") String end) {
PmKeyValueVo pmKeyValueVo = monitorService.eqiAsiaLine(region, type, start, end);
return AjaxResult.success(pmKeyValueVo);
} }
} }

View File

@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
.antMatchers("/*/api-docs").anonymous() .antMatchers("/*/api-docs").anonymous()
.antMatchers("/druid/**").anonymous() .antMatchers("/druid/**").anonymous()
// // 除上面外的所有请求全部需要鉴权认证 // // 除上面外的所有请求全部需要鉴权认证
//.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()
.headers().frameOptions().disable(); .headers().frameOptions().disable();
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);

View File

@ -14,23 +14,23 @@ public class MonitorKEQIAsiaRateEntity {
private String regionEn; private String regionEn;
private BigDecimal vegetation; private Double vegetation;
private BigDecimal forest; private Double forest;
private BigDecimal shrub; private Double shrub;
private BigDecimal grass; private Double grass;
private BigDecimal farmland; private Double farmland;
private BigDecimal mountain; private Double mountain;
public MonitorKEQIAsiaRateEntity() { public MonitorKEQIAsiaRateEntity() {
} }
public MonitorKEQIAsiaRateEntity(Integer id, String region, String regionEn, BigDecimal vegetation, BigDecimal forest, BigDecimal shrub, BigDecimal grass, BigDecimal farmland, BigDecimal mountain) { public MonitorKEQIAsiaRateEntity(Integer id, String region, String regionEn, Double vegetation, Double forest, Double shrub, Double grass, Double farmland, Double mountain) {
this.id = id; this.id = id;
this.region = region; this.region = region;
this.regionEn = regionEn; this.regionEn = regionEn;
@ -94,7 +94,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return vegetation * @return vegetation
*/ */
public BigDecimal getVegetation() { public Double getVegetation() {
return vegetation; return vegetation;
} }
@ -102,7 +102,7 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param vegetation * @param vegetation
*/ */
public void setVegetation(BigDecimal vegetation) { public void setVegetation(Double vegetation) {
this.vegetation = vegetation; this.vegetation = vegetation;
} }
@ -110,7 +110,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return forest * @return forest
*/ */
public BigDecimal getForest() { public Double getForest() {
return forest; return forest;
} }
@ -118,7 +118,7 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param forest * @param forest
*/ */
public void setForest(BigDecimal forest) { public void setForest(Double forest) {
this.forest = forest; this.forest = forest;
} }
@ -126,7 +126,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return shrub * @return shrub
*/ */
public BigDecimal getShrub() { public Double getShrub() {
return shrub; return shrub;
} }
@ -134,7 +134,7 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param shrub * @param shrub
*/ */
public void setShrub(BigDecimal shrub) { public void setShrub(Double shrub) {
this.shrub = shrub; this.shrub = shrub;
} }
@ -142,7 +142,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return grass * @return grass
*/ */
public BigDecimal getGrass() { public Double getGrass() {
return grass; return grass;
} }
@ -150,7 +150,7 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param grass * @param grass
*/ */
public void setGrass(BigDecimal grass) { public void setGrass(Double grass) {
this.grass = grass; this.grass = grass;
} }
@ -158,7 +158,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return farmland * @return farmland
*/ */
public BigDecimal getFarmland() { public Double getFarmland() {
return farmland; return farmland;
} }
@ -166,7 +166,7 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param farmland * @param farmland
*/ */
public void setFarmland(BigDecimal farmland) { public void setFarmland(Double farmland) {
this.farmland = farmland; this.farmland = farmland;
} }
@ -174,7 +174,7 @@ public class MonitorKEQIAsiaRateEntity {
* 获取 * 获取
* @return mountain * @return mountain
*/ */
public BigDecimal getMountain() { public Double getMountain() {
return mountain; return mountain;
} }
@ -182,11 +182,10 @@ public class MonitorKEQIAsiaRateEntity {
* 设置 * 设置
* @param mountain * @param mountain
*/ */
public void setMountain(BigDecimal mountain) { public void setMountain(Double mountain) {
this.mountain = mountain; this.mountain = mountain;
} }
@Override
public String toString() { public String toString() {
return "MonitorKEQIAsiaRateEntity{id = " + id + ", region = " + region + ", regionEn = " + regionEn + ", vegetation = " + vegetation + ", forest = " + forest + ", shrub = " + shrub + ", grass = " + grass + ", farmland = " + farmland + ", mountain = " + mountain + "}"; return "MonitorKEQIAsiaRateEntity{id = " + id + ", region = " + region + ", regionEn = " + regionEn + ", vegetation = " + vegetation + ", forest = " + forest + ", shrub = " + shrub + ", grass = " + grass + ", farmland = " + farmland + ", mountain = " + mountain + "}";
} }

View File

@ -13,23 +13,23 @@ public class MonitorKEQICountryRateEntity {
private String countryEn; private String countryEn;
private BigDecimal all; private Double all;
private BigDecimal forest; private Double forest;
private BigDecimal shrub; private Double shrub;
private BigDecimal grass; private Double grass;
private BigDecimal farmland; private Double farmland;
private BigDecimal mountain; private Double mountain;
public MonitorKEQICountryRateEntity() { public MonitorKEQICountryRateEntity() {
} }
public MonitorKEQICountryRateEntity(Integer id, String country, String countryEn, BigDecimal all, BigDecimal forest, BigDecimal shrub, BigDecimal grass, BigDecimal farmland, BigDecimal mountain) { public MonitorKEQICountryRateEntity(Integer id, String country, String countryEn, Double all, Double forest, Double shrub, Double grass, Double farmland, Double mountain) {
this.id = id; this.id = id;
this.country = country; this.country = country;
this.countryEn = countryEn; this.countryEn = countryEn;
@ -93,7 +93,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return all * @return all
*/ */
public BigDecimal getAll() { public Double getAll() {
return all; return all;
} }
@ -101,7 +101,7 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param all * @param all
*/ */
public void setAll(BigDecimal all) { public void setAll(Double all) {
this.all = all; this.all = all;
} }
@ -109,7 +109,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return forest * @return forest
*/ */
public BigDecimal getForest() { public Double getForest() {
return forest; return forest;
} }
@ -117,7 +117,7 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param forest * @param forest
*/ */
public void setForest(BigDecimal forest) { public void setForest(Double forest) {
this.forest = forest; this.forest = forest;
} }
@ -125,7 +125,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return shrub * @return shrub
*/ */
public BigDecimal getShrub() { public Double getShrub() {
return shrub; return shrub;
} }
@ -133,7 +133,7 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param shrub * @param shrub
*/ */
public void setShrub(BigDecimal shrub) { public void setShrub(Double shrub) {
this.shrub = shrub; this.shrub = shrub;
} }
@ -141,7 +141,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return grass * @return grass
*/ */
public BigDecimal getGrass() { public Double getGrass() {
return grass; return grass;
} }
@ -149,7 +149,7 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param grass * @param grass
*/ */
public void setGrass(BigDecimal grass) { public void setGrass(Double grass) {
this.grass = grass; this.grass = grass;
} }
@ -157,7 +157,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return farmland * @return farmland
*/ */
public BigDecimal getFarmland() { public Double getFarmland() {
return farmland; return farmland;
} }
@ -165,7 +165,7 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param farmland * @param farmland
*/ */
public void setFarmland(BigDecimal farmland) { public void setFarmland(Double farmland) {
this.farmland = farmland; this.farmland = farmland;
} }
@ -173,7 +173,7 @@ public class MonitorKEQICountryRateEntity {
* 获取 * 获取
* @return mountain * @return mountain
*/ */
public BigDecimal getMountain() { public Double getMountain() {
return mountain; return mountain;
} }
@ -181,11 +181,10 @@ public class MonitorKEQICountryRateEntity {
* 设置 * 设置
* @param mountain * @param mountain
*/ */
public void setMountain(BigDecimal mountain) { public void setMountain(Double mountain) {
this.mountain = mountain; this.mountain = mountain;
} }
@Override
public String toString() { public String toString() {
return "MonitorKEQICountryRateEntity{id = " + id + ", country = " + country + ", countryEn = " + countryEn + ", all = " + all + ", forest = " + forest + ", shrub = " + shrub + ", grass = " + grass + ", farmland = " + farmland + ", mountain = " + mountain + "}"; return "MonitorKEQICountryRateEntity{id = " + id + ", country = " + country + ", countryEn = " + countryEn + ", all = " + all + ", forest = " + forest + ", shrub = " + shrub + ", grass = " + grass + ", farmland = " + farmland + ", mountain = " + mountain + "}";
} }

View File

@ -22,15 +22,18 @@ public interface MonitorMapper {
/** /**
* 亚大区域地理亚区EQI分级 * 亚大区域地理亚区EQI分级
*
* @param year 年份 * @param year 年份
* @param region 区域 * @param region 区域
* @return * @return
*/ */
List<MonitorEQIGradingEntity> eqiGrading(@Param("year") String year, MonitorEQIGradingEntity eqiGrading(@Param("year") String year,
@Param("type") String type,
@Param("region") String region); @Param("region") String region);
/** /**
* 各地理亚区平均EQI分布 * 各地理亚区平均EQI分布
*
* @param year * @param year
* @return * @return
*/ */
@ -38,6 +41,7 @@ public interface MonitorMapper {
/** /**
* 各国家平均EQI分布 * 各国家平均EQI分布
*
* @param year * @param year
* @param country * @param country
* @return * @return
@ -47,22 +51,35 @@ public interface MonitorMapper {
/** /**
* 各地理亚区平均KEQI分布 * 各地理亚区平均KEQI分布
*
* @param region * @param region
* @return * @return
*/ */
List<MonitorKEQIEntity> keqi(@Param("region") String region); MonitorKEQIEntity keqi(@Param("type") String type,
@Param("region") String region);
/** /**
* 各地理亚区平均KEQI变化率 * 各地理亚区平均KEQI变化率
*
* @return * @return
*/ */
List<MonitorKEQIAsiaRateEntity> keqiAsiaRate(); List<MonitorKEQIAsiaRateEntity> keqiAsiaRate();
/** /**
* 各国平均KEQI变化率 * 各国平均KEQI变化率
*
* @param country 国家 * @param country 国家
* @return * @return
*/ */
MonitorKEQICountryRateEntity keqiCountryRate(@Param("country") String country); MonitorKEQICountryRateEntity keqiCountryRate(@Param("country") String country);
/**
* 各地理亚区平均EQI分布折线图
* @param region
* @return
*/
List<MonitorEQIAsiaEntity> eqiAsiaLine(@Param("region") String region,
@Param("start") String start,
@Param("end") String end);
} }

View File

@ -1,12 +1,15 @@
package com.ruoyi.system.service_yada; package com.ruoyi.system.service_yada;
import com.ruoyi.system.domain_yada.entity.*; import com.ruoyi.system.domain_yada.entity.*;
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
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;
/** /**
* 亚大综合监测 * 亚大综合监测
*
* @author Mr.C * @author Mr.C
*/ */
public interface MonitorService { public interface MonitorService {
@ -14,6 +17,7 @@ public interface MonitorService {
/** /**
* 亚大区域地理亚区与国家对应关系 * 亚大区域地理亚区与国家对应关系
*
* @param region 区域 * @param region 区域
* @return * @return
*/ */
@ -21,44 +25,63 @@ public interface MonitorService {
/** /**
* 亚大区域地理亚区EQI分级 * 亚大区域地理亚区EQI分级
*
* @param year 年份 * @param year 年份
* @param region 区域 * @param region 区域
* @return * @return
*/ */
List<MonitorEQIGradingEntity> eqiGrading(String year,String region); MonitorEQIGradingEntity eqiGrading(String year, String type, String region);
/** /**
* 各地理亚区平均EQI分布 * 各地理亚区平均EQI分布
*
* @param year 年份 * @param year 年份
* @param type 植被类型
* @return * @return
*/ */
List<MonitorEQIAsiaEntity> eqiAsia(String year); PmKeyValueEnVo eqiAsia(String year, String type);
/** /**
* 各国家平均EQI分布 * 各国家平均EQI分布
*
* @param year 年份 * @param year 年份
* @param region 区域 * @param region 区域
* @param type 植被类型
* @return * @return
*/ */
List<MonitorEQICountryEntity> eqiCountry(String year ,String region); PmKeyValueEnVo eqiCountry(String year, String region, String type);
/** /**
* 各地理亚区平均KEQI分布 * 各地理亚区平均KEQI分布
*
* @param region 区域 * @param region 区域
* @return * @return
*/ */
List<MonitorKEQIEntity> keqi(@Param("region") String region); MonitorKEQIEntity keqi(String type, String region);
/** /**
* 各地理亚区平均KEQI变化率 * 各地理亚区平均KEQI变化率
*
* @return * @return
*/ */
List<MonitorKEQIAsiaRateEntity> keqiAsiaRate(); PmKeyValueEnVo keqiAsiaRate(String type);
/** /**
* 各国平均KEQI变化率 * 各国平均KEQI变化率
*
* @param region 区域 * @param region 区域
* @return * @return
*/ */
List<MonitorKEQICountryRateEntity> keqiCountryRate(@Param("region") String region); PmKeyValueEnVo keqiCountryRate(String region, String type);
/**
* 各地理亚区平均EQI分布折线图
*
* @param region
* @param type
* @param start
* @param end
* @return
*/
PmKeyValueVo eqiAsiaLine(String region, String type, String start, String end);
} }

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.service_yada.impl; package com.ruoyi.system.service_yada.impl;
import com.ruoyi.system.domain_yada.entity.*; import com.ruoyi.system.domain_yada.entity.*;
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.mapper_yada.MonitorMapper;
import com.ruoyi.system.service_yada.MonitorService; import com.ruoyi.system.service_yada.MonitorService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -8,15 +10,25 @@ import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.Yaml;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
* 亚大综合监测 * 亚大综合监测
*
* @author Mr.C * @author Mr.C
*/ */
@Service @Service
public class MonitorImpl implements MonitorService { public class MonitorImpl implements MonitorService {
private static final String FOREST = "forest";
private static final String SHRUB = "shrub";
private static final String GRASS = "grass";
private static final String FARMLAND = "farmland";
private static final String MOUNTAIN = "mountain";
private static final String ALL = "all";
@Resource @Resource
private MonitorMapper monitorMapper; private MonitorMapper monitorMapper;
@ -26,44 +38,199 @@ public class MonitorImpl implements MonitorService {
} }
@Override @Override
public List<MonitorEQIGradingEntity> eqiGrading(String year, String region) { public MonitorEQIGradingEntity eqiGrading(String year, String type, String region) {
return monitorMapper.eqiGrading(year, region); return monitorMapper.eqiGrading(year, type, region);
} }
@Override @Override
public List<MonitorEQIAsiaEntity> eqiAsia(String year) { public PmKeyValueEnVo eqiAsia(String year, String type) {
return monitorMapper.eqiAsia(year); List<MonitorEQIAsiaEntity> list = monitorMapper.eqiAsia(year);
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> 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())));
break;
case SHRUB:
list.forEach(v -> value.add(Double.valueOf(v.getShrub())));
break;
case GRASS:
list.forEach(v -> value.add(Double.valueOf(v.getGrass())));
break;
case FARMLAND:
list.forEach(v -> value.add(Double.valueOf(v.getFarmland())));
break;
case MOUNTAIN:
list.forEach(v -> value.add(Double.valueOf(v.getMountain())));
break;
case ALL:
list.forEach(v -> value.add(Double.valueOf(v.getAll())));
break;
default:
}
return new PmKeyValueEnVo(key, keyEn, value);
} }
@Override @Override
public List<MonitorEQICountryEntity> eqiCountry(String year, String region) { public PmKeyValueEnVo eqiCountry(String year, String region, String type) {
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region); List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
List<MonitorEQICountryEntity> lists = new ArrayList<>(); List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) { for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) {
String country = monitorCountryCorrespondingEntity.getCountry(); String country = monitorCountryCorrespondingEntity.getCountry();
lists.add(monitorMapper.eqiCountry(year, country)); key.add(monitorMapper.eqiCountry(year, country).getCountry());
keyEn.add(monitorMapper.eqiCountry(year, country).getCountryEn());
switch (type) {
case FOREST:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getForestEQI()));
break;
case SHRUB:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getShrubEQI()));
break;
case GRASS:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getGrassEQI()));
break;
case FARMLAND:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getFarmlandEQI()));
break;
case MOUNTAIN:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getMountainEQI()));
break;
case ALL:
value.add(Double.valueOf(monitorMapper.eqiCountry(year, country).getAllEQI()));
break;
default:
} }
return lists; }
return new PmKeyValueEnVo(key, keyEn, value);
} }
@Override @Override
public List<MonitorKEQIEntity> keqi(String region) { public MonitorKEQIEntity keqi(String type, String region) {
return monitorMapper.keqi(region); return monitorMapper.keqi(type, region);
} }
@Override @Override
public List<MonitorKEQIAsiaRateEntity> keqiAsiaRate() { public PmKeyValueEnVo keqiAsiaRate(String type) {
return monitorMapper.keqiAsiaRate(); List<MonitorKEQIAsiaRateEntity> list = monitorMapper.keqiAsiaRate();
List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
list.forEach(v -> {
key.add(v.getRegion());
keyEn.add(v.getRegionEn());
});
switch (type) {
case FOREST:
list.forEach(v -> value.add(v.getForest()));
break;
case SHRUB:
list.forEach(v -> value.add(v.getShrub()));
break;
case GRASS:
list.forEach(v -> value.add(v.getGrass()));
break;
case FARMLAND:
list.forEach(v -> value.add(v.getFarmland()));
break;
case MOUNTAIN:
list.forEach(v -> value.add(v.getMountain()));
break;
case ALL:
list.forEach(v -> value.add(v.getVegetation()));
break;
default:
}
return new PmKeyValueEnVo(key, keyEn, value);
} }
@Override @Override
public List<MonitorKEQICountryRateEntity> keqiCountryRate(String region) { public PmKeyValueEnVo keqiCountryRate(String region, String type) {
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region); List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
List<MonitorKEQICountryRateEntity> lists = new ArrayList<>(); List<String> key = new ArrayList<>();
List<String> keyEn = new ArrayList<>();
List<Double> value = new ArrayList<>();
for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) { for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) {
lists.add(monitorMapper.keqiCountryRate(monitorCountryCorrespondingEntity.getCountry())); String country = monitorCountryCorrespondingEntity.getCountry();
key.add(monitorMapper.keqiCountryRate(country).getCountry());
keyEn.add(monitorMapper.keqiCountryRate(country).getCountryEn());
switch (type) {
case FOREST:
value.add(monitorMapper.keqiCountryRate(country).getForest());
break;
case SHRUB:
value.add(monitorMapper.keqiCountryRate(country).getShrub());
break;
case GRASS:
value.add(monitorMapper.keqiCountryRate(country).getGrass());
break;
case FARMLAND:
value.add(monitorMapper.keqiCountryRate(country).getFarmland());
break;
case MOUNTAIN:
value.add(monitorMapper.keqiCountryRate(country).getMountain());
break;
case ALL:
value.add(monitorMapper.keqiCountryRate(country).getAll());
break;
default:
} }
return lists; }
return new PmKeyValueEnVo(key, keyEn, value);
}
@Override
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<>();
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

@ -111,6 +111,7 @@
select id, year, type, region, region_en, excellent, good, middle, low, poor select id, year, type, region, region_en, excellent, good, middle, low, poor
from monitor_eqi_grading from monitor_eqi_grading
where year = #{year} where year = #{year}
and type = #{type}
and region = #{region} and region = #{region}
</select> </select>
@ -163,7 +164,8 @@
slight_rise, slight_rise,
significant_rise significant_rise
from monitor_keqi from monitor_keqi
where region = #{region} where type = #{type}
and region = #{region}
</select> </select>
<select id="keqiAsiaRate" resultMap="Monitor_KEQI_Asia_Rate"> <select id="keqiAsiaRate" resultMap="Monitor_KEQI_Asia_Rate">
@ -192,4 +194,26 @@
from monitor_keqi_country_rate mkcr from monitor_keqi_country_rate mkcr
where mkcr.country = #{country} where mkcr.country = #{country}
</select> </select>
<select id="eqiAsiaLine" resultMap="Monitor_EQI_Asia">
select mea.id,
mea.year,
mea.region,
mea.region_en,
mea.all,
mea.forest,
mea.shrub,
mea.grass,
mea.farmland,
mea.mountain
from monitor_eqi_asia mea
where mea.region = #{region}
<if test="start != null and start != ''">
and mea.year >= #{start}
</if>
<if test="end != null and end != ''">
and #{end} >= mea.year
</if>
</select>
</mapper> </mapper>