国家查询优化
This commit is contained in:
parent
7d7c0dafd1
commit
448aa856e9
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -45,9 +45,9 @@ public interface ESNOImpactMapper {
|
||||
* @param country
|
||||
* @return
|
||||
*/
|
||||
ESNOImpactCountryVaiVo countryVai(@Param("type") String type,
|
||||
List<ESNOImpactCountryVaiVo> countryVai(@Param("type") String type,
|
||||
@Param("year") String year,
|
||||
@Param("country") String country);
|
||||
@Param("country") List<String> country);
|
||||
|
||||
/**
|
||||
* 各地理亚区时间VAI
|
||||
|
@ -46,8 +46,8 @@ public interface MonitorMapper {
|
||||
* @param country
|
||||
* @return
|
||||
*/
|
||||
MonitorEQICountryEntity eqiCountry(@Param("year") String year,
|
||||
@Param("country") String country);
|
||||
List<MonitorEQICountryEntity> eqiCountry(@Param("year") String year,
|
||||
@Param("country") List<String>country);
|
||||
|
||||
/**
|
||||
* 各地理亚区平均KEQI分布
|
||||
@ -71,7 +71,7 @@ public interface MonitorMapper {
|
||||
* @param country 国家
|
||||
* @return
|
||||
*/
|
||||
MonitorKEQICountryRateEntity keqiCountryRate(@Param("country") String country);
|
||||
List<MonitorKEQICountryRateEntity> keqiCountryRate(@Param("country") List<String> country);
|
||||
|
||||
/**
|
||||
* 各地理亚区平均EQI分布折线图
|
||||
|
@ -51,6 +51,7 @@ public interface MonitorService {
|
||||
*/
|
||||
PmKeyValueEnVo eqiCountry(String year, String region, String type);
|
||||
|
||||
|
||||
/**
|
||||
* 各地理亚区平均KEQI分布
|
||||
*
|
||||
|
@ -46,13 +46,16 @@ public class ESNOImpactImpl implements ESNOImpactService {
|
||||
@Override
|
||||
public PmKeyValueEnVo countryVai(String type, String year, String region) {
|
||||
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
|
||||
List<String> country = new ArrayList<>();
|
||||
list.forEach(v->country.add(v.getCountry()));
|
||||
List<String> key = new ArrayList<>();
|
||||
List<String> keyEn = new ArrayList<>();
|
||||
List<Double> value = new ArrayList<>();
|
||||
list.forEach(v->{
|
||||
List<ESNOImpactCountryVaiVo> 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);
|
||||
}
|
||||
|
@ -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<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())));
|
||||
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<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
|
||||
List<String> country = new ArrayList<>();
|
||||
list.forEach(v->country.add(v.getCountry()));
|
||||
List<String> key = new ArrayList<>();
|
||||
List<String> keyEn = new ArrayList<>();
|
||||
List<Double> 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<MonitorEQICountryEntity> 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<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
|
||||
List<String> country = new ArrayList<>();
|
||||
list.forEach(v->country.add(v.getCountry()));
|
||||
List<String> key = new ArrayList<>();
|
||||
List<String> keyEn = new ArrayList<>();
|
||||
List<Double> value = new ArrayList<>();
|
||||
for (MonitorCountryCorrespondingEntity monitorCountryCorrespondingEntity : list) {
|
||||
String country = monitorCountryCorrespondingEntity.getCountry();
|
||||
key.add(monitorMapper.keqiCountryRate(country).getCountry());
|
||||
keyEn.add(monitorMapper.keqiCountryRate(country).getCountryEn());
|
||||
List<MonitorKEQICountryRateEntity> 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:
|
||||
}
|
||||
|
@ -49,7 +49,10 @@
|
||||
from esno_impact_country
|
||||
where type = #{type}
|
||||
and year = #{year}
|
||||
and country = #{country}
|
||||
and country in
|
||||
<foreach collection="country" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="subzoneVaiLine" resultMap="ESNO_Impact_Subzone_Line">
|
||||
|
@ -150,7 +150,10 @@
|
||||
mec.mountain_pixel
|
||||
from monitor_eqi_country mec
|
||||
where mec.year = #{year}
|
||||
and mec.country = #{country}
|
||||
and mec.country in
|
||||
<foreach collection="country" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="keqi" resultMap="Monitor_KEQI">
|
||||
@ -192,7 +195,10 @@
|
||||
cast((cast(mkcr.farmland as decimal)*100) as decimal(10,2)) as farmland,
|
||||
cast((cast(mkcr.mountain as decimal)*100) as decimal(10,2)) as mountain
|
||||
from monitor_keqi_country_rate mkcr
|
||||
where mkcr.country = #{country}
|
||||
where mkcr.country in
|
||||
<foreach collection="country" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="eqiAsiaLine" resultMap="Monitor_EQI_Asia">
|
||||
|
Loading…
Reference in New Issue
Block a user