2024-05-24 14:02:15 +08:00
|
|
|
package com.whdc.controller;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
2024-05-28 09:31:20 +08:00
|
|
|
import com.google.common.collect.Sets;
|
2024-05-24 14:02:15 +08:00
|
|
|
import com.whdc.exception.MyException;
|
|
|
|
|
import com.whdc.model.dto.ApiDto;
|
|
|
|
|
import com.whdc.model.dto.GroupWarningDto;
|
2024-05-28 09:31:20 +08:00
|
|
|
import com.whdc.model.vo.AdcdTree;
|
2024-05-24 14:02:15 +08:00
|
|
|
import com.whdc.model.vo.WarningData;
|
|
|
|
|
import com.whdc.model.vo.WarningHistoryListVo;
|
|
|
|
|
import com.whdc.model.vo.WarningListVo;
|
|
|
|
|
import com.whdc.service.IAddressBookService;
|
2024-05-28 09:31:20 +08:00
|
|
|
import com.whdc.service.IAdinfoService;
|
2024-05-24 14:02:15 +08:00
|
|
|
import com.whdc.utils.HttpUtil;
|
|
|
|
|
import com.whdc.utils.ResultJson;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2024-05-28 09:31:20 +08:00
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
2024-05-24 14:02:15 +08:00
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.http.HttpStatus;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
2024-05-28 13:45:56 +08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
2024-05-24 14:02:15 +08:00
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Description:
|
|
|
|
|
* Created by XuSan on 2024/5/23.
|
|
|
|
|
*
|
|
|
|
|
* @author XuSan
|
|
|
|
|
* @version 1.0
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Api(tags = "预警 - Controller")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/warning")
|
|
|
|
|
public class WarningController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IAddressBookService addressBookService;
|
|
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
@Autowired
|
|
|
|
|
private IAdinfoService adinfoService;
|
|
|
|
|
|
2024-05-24 14:02:15 +08:00
|
|
|
/**
|
|
|
|
|
* 气象预警
|
|
|
|
|
*
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "气象预警")
|
|
|
|
|
@PostMapping("/getGroupWarning")
|
|
|
|
|
public ResultJson<List<WarningListVo>> getGroupWarning(
|
|
|
|
|
@RequestBody GroupWarningDto dto) {
|
|
|
|
|
|
|
|
|
|
ApiDto apiDto = new ApiDto();
|
|
|
|
|
apiDto.setStartTime(dto.getStartTime());
|
|
|
|
|
apiDto.setEndTime(dto.getEndTime());
|
|
|
|
|
apiDto.setPageNumber(dto.getPageNumber());
|
|
|
|
|
apiDto.setPageSize(dto.getPageSize());
|
|
|
|
|
ArrayList<ApiDto.Filter> filter = Lists.newArrayList();
|
|
|
|
|
|
2024-05-27 10:10:37 +08:00
|
|
|
String publishUnit = dto.getPublishUnit();
|
|
|
|
|
if (StringUtils.isNotBlank(publishUnit)) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String[] split = publishUnit.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
2024-05-27 10:10:37 +08:00
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
2024-05-27 10:10:37 +08:00
|
|
|
String warnSignalLevel = dto.getWarnSignalLevel();
|
|
|
|
|
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String[] split = warnSignalLevel.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
2024-05-27 10:10:37 +08:00
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
2024-05-27 10:10:37 +08:00
|
|
|
String warnSignalType = dto.getWarnSignalType();
|
|
|
|
|
if (StringUtils.isNotBlank(warnSignalType)) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String[] split = warnSignalType.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
2024-05-27 10:10:37 +08:00
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apiDto.setFilter(filter);
|
2024-05-27 17:00:03 +08:00
|
|
|
// String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
|
|
|
|
String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
2024-05-24 14:02:15 +08:00
|
|
|
JSONObject json = JSON.parseObject(str);
|
|
|
|
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
|
|
|
|
List<WarningData> data = json.getJSONArray("data").toJavaList(WarningData.class);
|
|
|
|
|
return ResultJson.ok(getList(data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultJson.ok(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-24 15:12:16 +08:00
|
|
|
* 历史气象预警统计
|
2024-05-24 14:02:15 +08:00
|
|
|
*
|
|
|
|
|
* @param dto
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2024-05-24 15:12:16 +08:00
|
|
|
@ApiOperation(value = "历史气象预警统计")
|
2024-05-24 14:02:15 +08:00
|
|
|
@PostMapping("/getHistoryGroupWarning")
|
2024-05-28 10:41:40 +08:00
|
|
|
public ResultJson<List<WarningHistoryListVo>> getHistoryGroupWarning(@RequestBody GroupWarningDto dto) {
|
2024-05-24 14:02:15 +08:00
|
|
|
|
|
|
|
|
ApiDto apiDto = new ApiDto();
|
|
|
|
|
apiDto.setStartTime(dto.getStartTime());
|
|
|
|
|
apiDto.setEndTime(dto.getEndTime());
|
|
|
|
|
apiDto.setPageNumber(dto.getPageNumber());
|
|
|
|
|
apiDto.setPageSize(dto.getPageSize());
|
|
|
|
|
ArrayList<ApiDto.Filter> filter = Lists.newArrayList();
|
|
|
|
|
|
2024-05-27 10:41:58 +08:00
|
|
|
String publishUnit = dto.getPublishUnit();
|
|
|
|
|
if (StringUtils.isNotBlank(publishUnit)) {
|
|
|
|
|
String[] split = publishUnit.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
|
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
2024-05-27 10:41:58 +08:00
|
|
|
String warnSignalLevel = dto.getWarnSignalLevel();
|
|
|
|
|
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
|
|
|
|
String[] split = warnSignalLevel.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
|
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
2024-05-27 10:41:58 +08:00
|
|
|
String warnSignalType = dto.getWarnSignalType();
|
|
|
|
|
if (StringUtils.isNotBlank(warnSignalType)) {
|
|
|
|
|
String[] split = warnSignalType.split(",");
|
2024-05-27 14:50:18 +08:00
|
|
|
if (split.length > 1) {
|
2024-05-27 10:41:58 +08:00
|
|
|
String str = "(";
|
|
|
|
|
for (String s : split) {
|
2024-05-27 14:50:18 +08:00
|
|
|
str += s + ",";
|
2024-05-27 10:41:58 +08:00
|
|
|
}
|
2024-05-27 14:50:18 +08:00
|
|
|
str = str.substring(0, str.length() - 1) + ")";
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
|
|
|
|
|
2024-05-27 14:50:18 +08:00
|
|
|
} else {
|
2024-05-27 10:41:58 +08:00
|
|
|
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
|
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
|
|
|
|
|
2024-05-27 10:41:58 +08:00
|
|
|
|
2024-05-24 14:02:15 +08:00
|
|
|
apiDto.setFilter(filter);
|
2024-05-28 09:31:20 +08:00
|
|
|
String str = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
|
|
|
|
// String str = HttpUtil.sendPost("http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
2024-05-24 14:02:15 +08:00
|
|
|
JSONObject json = JSON.parseObject(str);
|
|
|
|
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
|
|
|
|
List<WarningData> data = json.getJSONArray("data").toJavaList(WarningData.class);
|
|
|
|
|
return ResultJson.ok(getCount(data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultJson.ok(json);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 正在生效预警
|
|
|
|
|
*
|
|
|
|
|
* @param data
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<WarningListVo> getList(List<WarningData> data) {
|
|
|
|
|
|
|
|
|
|
List<WarningListVo> respList = Lists.newArrayList();
|
|
|
|
|
for (WarningData datum : data) {
|
|
|
|
|
for (WarningData.TypeList typeList : datum.getTypeList()) {
|
|
|
|
|
// 预警类型
|
|
|
|
|
String type = typeList.getType();
|
|
|
|
|
for (WarningData.Warning warning : typeList.getWarnList()) {
|
|
|
|
|
WarningListVo vo = new WarningListVo();
|
|
|
|
|
String publishUnit = warning.getPublishUnit();
|
2024-05-27 17:00:03 +08:00
|
|
|
vo.setTitle(publishUnit + "发布" + type + "预警");
|
2024-05-24 14:02:15 +08:00
|
|
|
vo.setPublishTime(warning.getPublishTime());
|
|
|
|
|
vo.setContent(warning.getContent());
|
|
|
|
|
vo.setWarnSignalType(warning.getWarnSignalType());
|
|
|
|
|
vo.setWarnSignalLevel(warning.getWarnSignalLevel());
|
|
|
|
|
vo.setAddressBooks(addressBookService.getListByAdnm(publishUnit.replace("气象台", "")));
|
|
|
|
|
respList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return respList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 正在生效预警
|
|
|
|
|
*
|
|
|
|
|
* @param data
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<WarningHistoryListVo> getCount(List<WarningData> data) {
|
|
|
|
|
|
2024-05-27 17:00:03 +08:00
|
|
|
List<WarningData.Warning> warnList = Lists.newArrayList();
|
2024-05-24 14:02:15 +08:00
|
|
|
for (WarningData datum : data) {
|
|
|
|
|
WarningHistoryListVo vo = new WarningHistoryListVo();
|
|
|
|
|
vo.setWarnSignalType("全部");
|
|
|
|
|
|
|
|
|
|
for (WarningData.TypeList typeList : datum.getTypeList()) {
|
2024-05-27 17:00:03 +08:00
|
|
|
warnList.addAll(typeList.getWarnList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, List<WarningData.Warning>> warnMap = warnList.stream()
|
|
|
|
|
.collect(Collectors
|
|
|
|
|
.groupingBy(WarningData.Warning::getPublishUnit, Collectors.toList()));
|
|
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
List<WarningHistoryListVo> voList = Lists.newArrayList();
|
2024-05-24 14:02:15 +08:00
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
warnMap.forEach((k, v) -> {
|
2024-05-27 17:00:03 +08:00
|
|
|
WarningHistoryListVo vo = new WarningHistoryListVo();
|
|
|
|
|
vo.setEffectArea(k.split("气象")[0]);
|
2024-05-28 09:31:20 +08:00
|
|
|
vo.setWarnSignalType("全部");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WarningHistoryListVo> typeList = Lists.newArrayList();
|
2024-05-27 17:00:03 +08:00
|
|
|
|
|
|
|
|
// 类型
|
|
|
|
|
Map<String, List<WarningData.Warning>> types = v.stream()
|
|
|
|
|
.collect(Collectors
|
|
|
|
|
.groupingBy(WarningData.Warning::getWarnSignalType, Collectors.toList()));
|
2024-05-28 09:31:20 +08:00
|
|
|
|
|
|
|
|
Set<String> warnSignalType = Sets.newHashSet("雷电", "暴雨", "大风", "冰雹", "雷雨大风");
|
|
|
|
|
types.forEach((kt, vt) -> {
|
|
|
|
|
|
2024-05-27 17:00:03 +08:00
|
|
|
WarningHistoryListVo voType = new WarningHistoryListVo();
|
|
|
|
|
voType.setWarnSignalType(kt);
|
2024-05-28 09:31:20 +08:00
|
|
|
warnSignalType.remove(kt);
|
2024-05-27 17:00:03 +08:00
|
|
|
// 等级分组
|
|
|
|
|
Map<String, Long> levels = vt.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalLevel, Collectors.counting()));
|
|
|
|
|
|
|
|
|
|
levels.forEach((k1, v1) -> {
|
|
|
|
|
switch (k1) {
|
|
|
|
|
case "红色":
|
|
|
|
|
voType.setRedCount(v1.intValue());
|
|
|
|
|
vo.setRedCount(v1.intValue() + vo.getRedCount());
|
|
|
|
|
break;
|
|
|
|
|
case "橙色":
|
|
|
|
|
voType.setOraCount(v1.intValue());
|
|
|
|
|
vo.setOraCount(v1.intValue() + vo.getOraCount());
|
|
|
|
|
break;
|
|
|
|
|
case "黄色":
|
|
|
|
|
voType.setYelCount(v1.intValue());
|
|
|
|
|
vo.setYelCount(v1.intValue() + vo.getYelCount());
|
|
|
|
|
break;
|
|
|
|
|
case "蓝色":
|
|
|
|
|
voType.setBluCount(v1.intValue());
|
|
|
|
|
vo.setBluCount(v1.intValue() + vo.getBluCount());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new MyException("当前预警等级不存在: " + k1);
|
|
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
});
|
2024-05-28 09:31:20 +08:00
|
|
|
voType.setSumCount(vt.size());
|
|
|
|
|
typeList.add(voType);
|
2024-05-24 14:02:15 +08:00
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
});
|
2024-05-24 14:02:15 +08:00
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
// 保证完整数据
|
|
|
|
|
warnSignalType.forEach(kt ->{
|
|
|
|
|
WarningHistoryListVo voType = new WarningHistoryListVo();
|
|
|
|
|
voType.setWarnSignalType(kt);
|
|
|
|
|
typeList.add(voType);
|
2024-05-27 17:00:03 +08:00
|
|
|
});
|
2024-05-28 09:31:20 +08:00
|
|
|
|
|
|
|
|
vo.setChild(typeList);
|
2024-05-27 17:00:03 +08:00
|
|
|
vo.setSumCount(v.size());
|
2024-05-28 09:31:20 +08:00
|
|
|
voList.add(vo);
|
2024-05-27 17:00:03 +08:00
|
|
|
});
|
2024-05-24 14:02:15 +08:00
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
|
|
|
|
|
// 进行行政区划匹配
|
|
|
|
|
if (CollectionUtils.isNotEmpty(voList)) {
|
|
|
|
|
List<AdcdTree> tree = adinfoService.tree(null, null);
|
|
|
|
|
Map<String, List<WarningHistoryListVo>> areaMap = voList.stream()
|
|
|
|
|
.collect(Collectors
|
|
|
|
|
.groupingBy(WarningHistoryListVo::getEffectArea, Collectors.toList()));
|
|
|
|
|
|
2024-05-28 13:45:56 +08:00
|
|
|
return setAll(getAdcdByWhlVo(tree, areaMap));
|
2024-05-28 09:31:20 +08:00
|
|
|
}
|
|
|
|
|
|
2024-05-28 13:45:56 +08:00
|
|
|
return setAll(voList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<WarningHistoryListVo> setAll( List<WarningHistoryListVo> vos){
|
|
|
|
|
if (CollectionUtils.isNotEmpty(vos)){
|
|
|
|
|
WarningHistoryListVo vo = new WarningHistoryListVo();
|
2024-05-28 13:50:58 +08:00
|
|
|
vo.setWarnSignalType("全部");
|
|
|
|
|
vo.setEffectArea("总计");
|
2024-05-28 13:45:56 +08:00
|
|
|
int oraSum = vos.stream().mapToInt(WarningHistoryListVo::getOraCount).sum();
|
|
|
|
|
vo.setOraCount(oraSum);
|
|
|
|
|
int redSum = vos.stream().mapToInt(WarningHistoryListVo::getRedCount).sum();
|
|
|
|
|
vo.setRedCount(redSum);
|
|
|
|
|
int bluSum = vos.stream().mapToInt(WarningHistoryListVo::getBluCount).sum();
|
|
|
|
|
vo.setBluCount(bluSum);
|
|
|
|
|
int yelSum = vos.stream().mapToInt(WarningHistoryListVo::getYelCount).sum();
|
|
|
|
|
vo.setYelCount(yelSum);
|
|
|
|
|
vo.setSumCount(oraSum + redSum + bluSum + yelSum);
|
|
|
|
|
vos.add(0,vo);
|
|
|
|
|
}
|
|
|
|
|
return vos;
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|
2024-05-27 17:00:03 +08:00
|
|
|
|
2024-05-28 09:31:20 +08:00
|
|
|
private List<WarningHistoryListVo> getAdcdByWhlVo(List<AdcdTree> tree, Map<String, List<WarningHistoryListVo>> areaMap) {
|
|
|
|
|
List<WarningHistoryListVo> respList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
for (AdcdTree adcdTree : tree) {
|
|
|
|
|
String adnm = adcdTree.getAdnm();
|
|
|
|
|
List<AdcdTree> children = adcdTree.getChildren();
|
|
|
|
|
|
|
|
|
|
List<WarningHistoryListVo> vos = areaMap.get(adnm);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(vos)) {
|
|
|
|
|
WarningHistoryListVo vo = vos.get(0);
|
|
|
|
|
List<WarningHistoryListVo> childList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(children)) {
|
|
|
|
|
// 第一个是市级单位
|
|
|
|
|
for (int i = 1; i < children.size(); i++) {
|
|
|
|
|
AdcdTree t = children.get(i);
|
|
|
|
|
String adnm1 = t.getAdnm();
|
|
|
|
|
List<WarningHistoryListVo> vos1 = areaMap.get(adnm1);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(vos1)) {
|
|
|
|
|
childList.addAll(vos1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-28 10:41:40 +08:00
|
|
|
vo.setAreaChild(childList);
|
2024-05-28 09:31:20 +08:00
|
|
|
respList.add(vo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return respList;
|
|
|
|
|
}
|
2024-05-24 14:02:15 +08:00
|
|
|
}
|