ENSO修改

This commit is contained in:
machao 2023-03-06 17:28:31 +08:00
parent d6a411e858
commit 9158979599
4 changed files with 60 additions and 40 deletions

View File

@ -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")

View File

@ -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

View File

@ -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,7 +26,6 @@ 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);
@ -76,6 +75,11 @@ public class ENSOImpactImpl implements ENSOImpactService {
return new PmKeyValueVo(key, value); return new PmKeyValueVo(key, value);
} }
@Override
public ENSOYearEventCorrespondingEntity ensoYearEventCorresponding(String year) {
return ensoImpactMapper.ensoYearEventCorresponding(year);
}
@Override @Override
public ENSOEventRateEntity ensoEventRate(String type, String zone, String year) { public ENSOEventRateEntity ensoEventRate(String type, String zone, String year) {
String event = ensoImpactMapper.ensoYearEventCorresponding(year).getEvent(); String event = ensoImpactMapper.ensoYearEventCorresponding(year).getEvent();
@ -109,15 +113,25 @@ public class ENSOImpactImpl implements ENSOImpactService {
@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<>();
//list.forEach(e-> year.add(e.getYear()));
List<ENSOEventAnalysisEntity> ensoEventAnalysisEntities = ensoImpactMapper.ensoEventAnalysis(type, zone, v);
ensoEventAnalysisEntities.forEach(k -> { ensoEventAnalysisEntities.forEach(k -> {
key.add(k.getYear()); key.add(k.getYear());
value.add(Double.valueOf(k.getValue())); value.add(Double.valueOf(k.getValue()));

View File

@ -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>