ENSO修改
This commit is contained in:
parent
d6a411e858
commit
9158979599
@ -2,10 +2,7 @@ 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.ENSOEventAnalysisEntity;
|
import com.ruoyi.system.domain_yada.entity.*;
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOEventRateEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOMonthEventEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOYearUnusualRateEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.vo.ENSOEventAnalysisVo;
|
import com.ruoyi.system.domain_yada.vo.ENSOEventAnalysisVo;
|
||||||
import com.ruoyi.system.domain_yada.vo.ESNOImpactSubzoneVo;
|
import com.ruoyi.system.domain_yada.vo.ESNOImpactSubzoneVo;
|
||||||
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
|
import com.ruoyi.system.domain_yada.vo.PmKeyValueEnVo;
|
||||||
@ -71,6 +68,12 @@ public class ENSOImpactController {
|
|||||||
return AjaxResult.success(pmKeyValueVo);
|
return AjaxResult.success(pmKeyValueVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/ensoYearEventCorresponding", method = {RequestMethod.GET})
|
||||||
|
@ApiOperation(value = "年份与ENSO事件对应关系", httpMethod = "GET")
|
||||||
|
public AjaxResult ensoYearEventCorresponding(@RequestParam(value = "year") String year) {
|
||||||
|
ENSOYearEventCorrespondingEntity ensoYearEventCorrespondingEntity = ensoImpactService.ensoYearEventCorresponding(year);
|
||||||
|
return AjaxResult.success(ensoYearEventCorrespondingEntity);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/ensoEventRate", method = {RequestMethod.GET})
|
@RequestMapping(value = "/ensoEventRate", method = {RequestMethod.GET})
|
||||||
@ApiOperation(value = "四类ENSO事件空间分布统计", httpMethod = "GET")
|
@ApiOperation(value = "四类ENSO事件空间分布统计", httpMethod = "GET")
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.ruoyi.system.service_yada;
|
package com.ruoyi.system.service_yada;
|
||||||
|
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOEventAnalysisEntity;
|
import com.ruoyi.system.domain_yada.entity.*;
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOEventRateEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOMonthEventEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.entity.ENSOYearUnusualRateEntity;
|
|
||||||
import com.ruoyi.system.domain_yada.vo.*;
|
import com.ruoyi.system.domain_yada.vo.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -52,6 +49,13 @@ public interface ENSOImpactService {
|
|||||||
*/
|
*/
|
||||||
PmKeyValueVo subzoneVaiLine(String type,String region,String start,String end);
|
PmKeyValueVo subzoneVaiLine(String type,String region,String start,String end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年份与ENSO事件对应关系
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ENSOYearEventCorrespondingEntity ensoYearEventCorresponding(String year);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 四类ENSO事件空间分布统计
|
* 四类ENSO事件空间分布统计
|
||||||
* @param type
|
* @param type
|
||||||
|
@ -5,7 +5,6 @@ import com.ruoyi.system.domain_yada.vo.*;
|
|||||||
import com.ruoyi.system.mapper_yada.ENSOImpactMapper;
|
import com.ruoyi.system.mapper_yada.ENSOImpactMapper;
|
||||||
import com.ruoyi.system.mapper_yada.MonitorMapper;
|
import com.ruoyi.system.mapper_yada.MonitorMapper;
|
||||||
import com.ruoyi.system.service_yada.ENSOImpactService;
|
import com.ruoyi.system.service_yada.ENSOImpactService;
|
||||||
import org.apache.ibatis.ognl.ASTList;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -17,6 +16,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ENSO事件影响监测
|
* ENSO事件影响监测
|
||||||
|
*
|
||||||
* @author Mr.C
|
* @author Mr.C
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@ -26,10 +26,9 @@ public class ENSOImpactImpl implements ENSOImpactService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MonitorMapper monitorMapper;
|
private MonitorMapper monitorMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ESNOImpactSubzoneVo subzonePie(String type, String year, String region) {
|
public ESNOImpactSubzoneVo subzonePie(String type, String year, String region) {
|
||||||
return ensoImpactMapper.subzonePie(type,year,region);
|
return ensoImpactMapper.subzonePie(type, year, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,42 +37,47 @@ public class ENSOImpactImpl implements ENSOImpactService {
|
|||||||
List<String> key = new ArrayList<>();
|
List<String> key = new ArrayList<>();
|
||||||
List<String> keyEn = new ArrayList<>();
|
List<String> keyEn = new ArrayList<>();
|
||||||
List<Double> value = new ArrayList<>();
|
List<Double> value = new ArrayList<>();
|
||||||
list.forEach(v->{
|
list.forEach(v -> {
|
||||||
key.add(v.getRegion());
|
key.add(v.getRegion());
|
||||||
keyEn.add(v.getRegionEn());
|
keyEn.add(v.getRegionEn());
|
||||||
value.add(Double.valueOf(v.getVai()));
|
value.add(Double.valueOf(v.getVai()));
|
||||||
});
|
});
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PmKeyValueEnVo countryVai(String type, String year, String region) {
|
public PmKeyValueEnVo countryVai(String type, String year, String region) {
|
||||||
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
|
List<MonitorCountryCorrespondingEntity> list = monitorMapper.countryCorresponding(region);
|
||||||
List<String> country = new ArrayList<>();
|
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> key = new ArrayList<>();
|
||||||
List<String> keyEn = new ArrayList<>();
|
List<String> keyEn = new ArrayList<>();
|
||||||
List<Double> value = new ArrayList<>();
|
List<Double> value = new ArrayList<>();
|
||||||
List<ESNOImpactCountryVaiVo> lists = ensoImpactMapper.countryVai(type, year, country);
|
List<ESNOImpactCountryVaiVo> lists = ensoImpactMapper.countryVai(type, year, country);
|
||||||
lists.forEach(v->{
|
lists.forEach(v -> {
|
||||||
key.add(v.getCountry());
|
key.add(v.getCountry());
|
||||||
keyEn.add(v.getCountryEn());
|
keyEn.add(v.getCountryEn());
|
||||||
value.add(Double.valueOf(v.getVai()));
|
value.add(Double.valueOf(v.getVai()));
|
||||||
});
|
});
|
||||||
return new PmKeyValueEnVo(key,keyEn,value);
|
return new PmKeyValueEnVo(key, keyEn, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PmKeyValueVo subzoneVaiLine(String type,String region, String start, String end) {
|
public PmKeyValueVo subzoneVaiLine(String type, String region, String start, String end) {
|
||||||
List<ESNOImpactSubzoneLineVo> list = ensoImpactMapper.subzoneVaiLine(type, region,start, end);
|
List<ESNOImpactSubzoneLineVo> list = ensoImpactMapper.subzoneVaiLine(type, region, start, end);
|
||||||
list.sort(Comparator.comparing(ESNOImpactSubzoneLineVo::getYear));
|
list.sort(Comparator.comparing(ESNOImpactSubzoneLineVo::getYear));
|
||||||
List<String> key = new ArrayList<>();
|
List<String> key = new ArrayList<>();
|
||||||
List<Double> value = new ArrayList<>();
|
List<Double> value = new ArrayList<>();
|
||||||
list.forEach(v->{
|
list.forEach(v -> {
|
||||||
key.add(v.getYear());
|
key.add(v.getYear());
|
||||||
value.add(Double.valueOf(v.getVai()));
|
value.add(Double.valueOf(v.getVai()));
|
||||||
});
|
});
|
||||||
return new PmKeyValueVo(key,value);
|
return new PmKeyValueVo(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ENSOYearEventCorrespondingEntity ensoYearEventCorresponding(String year) {
|
||||||
|
return ensoImpactMapper.ensoYearEventCorresponding(year);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,38 +95,48 @@ public class ENSOImpactImpl implements ENSOImpactService {
|
|||||||
public PmKeyValueVo ensoMonthEvent(String type, String zone) {
|
public PmKeyValueVo ensoMonthEvent(String type, String zone) {
|
||||||
List<ENSOMonthEventEntity> list = ensoImpactMapper.ensoMonthEvent(type, zone);
|
List<ENSOMonthEventEntity> list = ensoImpactMapper.ensoMonthEvent(type, zone);
|
||||||
List<ENSOMonthEventEntity> collect = list.stream()
|
List<ENSOMonthEventEntity> collect = list.stream()
|
||||||
.sorted(Comparator.comparing((ENSOMonthEventEntity e)-> Integer.valueOf(e.getYear()))
|
.sorted(Comparator.comparing((ENSOMonthEventEntity e) -> Integer.valueOf(e.getYear()))
|
||||||
.thenComparing((ENSOMonthEventEntity e)-> Integer.valueOf(e.getMonth())))
|
.thenComparing((ENSOMonthEventEntity e) -> Integer.valueOf(e.getMonth())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<String> key = new ArrayList<>();
|
List<String> key = new ArrayList<>();
|
||||||
List<Double> value = new ArrayList<>();
|
List<Double> value = new ArrayList<>();
|
||||||
collect.forEach(v->{
|
collect.forEach(v -> {
|
||||||
if("1".equals(v.getMonth())){
|
if ("1".equals(v.getMonth())) {
|
||||||
key.add(v.getYear()+"-"+v.getMonth());
|
key.add(v.getYear() + "-" + v.getMonth());
|
||||||
}else {
|
} else {
|
||||||
key.add(v.getMonth());
|
key.add(v.getMonth());
|
||||||
}
|
}
|
||||||
value.add(Double.valueOf(v.getValue()));
|
value.add(Double.valueOf(v.getValue()));
|
||||||
});
|
});
|
||||||
return new PmKeyValueVo(key,value);
|
return new PmKeyValueVo(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ENSOEventAnalysisVo ensoEventAnalysis(String type, String zone) {
|
public ENSOEventAnalysisVo ensoEventAnalysis(String type, String zone) {
|
||||||
List<String> events = Arrays.asList("厄尔尼诺东部型","厄尔尼诺中部型","拉尼娜东部型","拉尼娜中部型");
|
//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");
|
||||||
|
List<String> yearLCP = Arrays.asList("1983", "1998", "2010");
|
||||||
|
List<List<String>> year = new ArrayList<>() {{
|
||||||
|
add(yearEEP);
|
||||||
|
add(yearECP);
|
||||||
|
add(yearLEP);
|
||||||
|
add(yearLCP);
|
||||||
|
}};
|
||||||
List<PmKeyValueVo> vo = new ArrayList<>();
|
List<PmKeyValueVo> vo = new ArrayList<>();
|
||||||
events.forEach(v->{
|
year.forEach(v -> {
|
||||||
List<ENSOYearEventCorrespondingEntity> list = ensoImpactMapper.ensoEventYearCorresponding(v);
|
//List<ENSOYearEventCorrespondingEntity> list = ensoImpactMapper.ensoEventYearCorresponding(v);
|
||||||
List<String> year = new ArrayList<>();
|
//List<String> year = new ArrayList<>();
|
||||||
list.forEach(e-> year.add(e.getYear()));
|
|
||||||
List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, year);
|
|
||||||
List<String> key = new ArrayList<>();
|
List<String> key = new ArrayList<>();
|
||||||
List<Double> value = new ArrayList<>();
|
List<Double> value = new ArrayList<>();
|
||||||
ensoEventAnalysisEntities.forEach(k->{
|
//list.forEach(e-> year.add(e.getYear()));
|
||||||
|
List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v);
|
||||||
|
ensoEventAnalysisEntities.forEach(k -> {
|
||||||
key.add(k.getYear());
|
key.add(k.getYear());
|
||||||
value.add(Double.valueOf(k.getValue()));
|
value.add(Double.valueOf(k.getValue()));
|
||||||
});
|
});
|
||||||
vo.add(new PmKeyValueVo(key,value));
|
vo.add(new PmKeyValueVo(key, value));
|
||||||
});
|
});
|
||||||
ENSOEventAnalysisVo ensoEventAnalysisVo = new ENSOEventAnalysisVo();
|
ENSOEventAnalysisVo ensoEventAnalysisVo = new ENSOEventAnalysisVo();
|
||||||
ensoEventAnalysisVo.setElninoEp(vo.get(0));
|
ensoEventAnalysisVo.setElninoEp(vo.get(0));
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="ensoEventRate" resultMap="ENSO_Event_Rate">
|
<select id="ensoEventRate" resultMap="ENSO_Event_Rate">
|
||||||
select id,
|
select id,
|
||||||
type,
|
type,
|
||||||
zone,
|
zone,
|
||||||
event,
|
event,
|
||||||
event_en,
|
event_en,
|
||||||
@ -176,12 +176,11 @@
|
|||||||
<select id="ensoEventAnalysis" resultMap="ENSO_Event_Analysis">
|
<select id="ensoEventAnalysis" resultMap="ENSO_Event_Analysis">
|
||||||
select id, year, type, zone, value
|
select id, year, type, zone, value
|
||||||
from enso_event_analysis
|
from enso_event_analysis
|
||||||
where year in
|
where type = #{type}
|
||||||
|
and zone =#{zone}
|
||||||
|
and year in
|
||||||
<foreach collection="year" item="item" index="index" separator="," open="(" close=")">
|
<foreach collection="year" item="item" index="index" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
and type = #{type}
|
|
||||||
and zone =#{zone}
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user