气象预警查询修改,历史气象预警统计修改
parent
6131cd2168
commit
7b52312207
|
|
@ -81,7 +81,7 @@ public class OrganizationController {
|
|||
.setName(o.getAdnm())
|
||||
.setAdlevel(o.getAdlevel())
|
||||
.setType("4");
|
||||
fcCommVo.setAdinfo(findAdcdTree(o.getAdcdChildren()));
|
||||
fcCommVo.setAdinfo(findAdcdTree(o.getChildren()));
|
||||
list.add(fcCommVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,8 +186,8 @@ public class WarningController {
|
|||
|
||||
|
||||
apiDto.setFilter(filter);
|
||||
// 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));
|
||||
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));
|
||||
JSONObject json = JSON.parseObject(str);
|
||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||
List<WarningData> data = json.getJSONArray("data").toJavaList(WarningData.class);
|
||||
|
|
@ -248,12 +248,21 @@ public class WarningController {
|
|||
|
||||
List<WarningData.Warning> warnList = typeList.getWarnList();
|
||||
|
||||
// 类型分组
|
||||
Map<String, List<WarningData.Warning>> types = warnList.stream()
|
||||
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalType, Collectors.toList()));
|
||||
// 地区分组
|
||||
Map<String, List<WarningData.Warning>> area = warnList.stream()
|
||||
.collect(Collectors.groupingBy(WarningData.Warning::getEffectArea, Collectors.toList()));
|
||||
|
||||
types.forEach((k, v) -> {
|
||||
area.forEach((areaStr, areaV) -> {
|
||||
List<WarningHistoryListVo> countyChild = Lists.newArrayList();
|
||||
WarningHistoryListVo childVo = new WarningHistoryListVo();
|
||||
childVo.setWarnSignalType("全部");
|
||||
childVo.setEffectArea(areaStr);
|
||||
|
||||
// 类型分组
|
||||
Map<String, List<WarningData.Warning>> types = area.get(areaStr).stream()
|
||||
.collect(Collectors.groupingBy(WarningData.Warning::getEffectArea, Collectors.toList()));
|
||||
types.forEach((k, v) -> {
|
||||
WarningHistoryListVo county = new WarningHistoryListVo();
|
||||
// 等级分组
|
||||
Map<String, Long> levels = v.stream()
|
||||
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalLevel, Collectors.counting()));
|
||||
|
|
@ -261,29 +270,38 @@ public class WarningController {
|
|||
levels.forEach((k1, v1) -> {
|
||||
switch (k1) {
|
||||
case "红色":
|
||||
childVo.setRedCount(v1.intValue());
|
||||
county.setRedCount(v1.intValue());
|
||||
childVo.setRedCount(v1.intValue() + childVo.getRedCount());
|
||||
vo.setRedCount(v1.intValue() + vo.getRedCount());
|
||||
break;
|
||||
case "橙色":
|
||||
childVo.setOraCount(v1.intValue());
|
||||
county.setOraCount(v1.intValue());
|
||||
childVo.setOraCount(v1.intValue() + childVo.getOraCount());
|
||||
vo.setOraCount(v1.intValue() + vo.getOraCount());
|
||||
break;
|
||||
case "黄色":
|
||||
childVo.setYelCount(v1.intValue());
|
||||
county.setYelCount(v1.intValue());
|
||||
childVo.setYelCount(v1.intValue() + childVo.getYelCount());
|
||||
vo.setYelCount(v1.intValue() + vo.getYelCount());
|
||||
break;
|
||||
case "蓝色":
|
||||
childVo.setBluCount(v1.intValue());
|
||||
county.setBluCount(v1.intValue());
|
||||
childVo.setBluCount(v1.intValue() + childVo.getBluCount());
|
||||
vo.setBluCount(v1.intValue() + vo.getBluCount());
|
||||
break;
|
||||
default:
|
||||
throw new MyException("当前预警等级不存在: " + k1);
|
||||
}
|
||||
});
|
||||
county.setWarnSignalType(k);
|
||||
county.setSumCount(levels.size());
|
||||
countyChild.add(county);
|
||||
});
|
||||
|
||||
childVo.setSumCount(areaV.size());
|
||||
childVo.setChild(countyChild);
|
||||
vo.setSumCount(vo.getSumCount() + areaV.size());
|
||||
|
||||
childVo.setSumCount(v.size());
|
||||
vo.setSumCount(vo.getSumCount() + v.size());
|
||||
childVo.setWarnSignalType(k);
|
||||
child.add(childVo);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class AdcdTree {
|
|||
private Integer adlevel;
|
||||
|
||||
@ApiModelProperty("下属行政区")
|
||||
private List<AdcdTree> adcdChildren;
|
||||
private List<AdcdTree> children;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
|
|||
for (Adinfo adinfo : list) {
|
||||
String ad = adinfo.getAdcd();
|
||||
String nm = adinfo.getAdnm();
|
||||
AdcdTree adcdTree = new AdcdTree().setAdcd(ad).setAdnm(nm).setAdcdChildren(new ArrayList<>());
|
||||
AdcdTree adcdTree = new AdcdTree().setAdcd(ad).setAdnm(nm).setChildren(new ArrayList<>());
|
||||
|
||||
// 判断行政区划编码
|
||||
String provinceStr = ad.substring(0, 2);
|
||||
|
|
@ -86,8 +86,10 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
|
|||
List<AdcdTree> adcdChildren = county.get(cityStr);
|
||||
AdcdTree adcdTree1 = new AdcdTree();
|
||||
BeanUtils.copyProperties(adcdTree,adcdTree1);
|
||||
if (CollectionUtils.isNotEmpty(adcdChildren)){
|
||||
adcdChildren.add(0,adcdTree1);
|
||||
adcdTree.setAdcdChildren(adcdChildren);
|
||||
}
|
||||
adcdTree.setChildren(adcdChildren);
|
||||
addTree(city, provinceStr, adcdTree);
|
||||
tree.add(adcdTree);
|
||||
|
||||
|
|
@ -133,7 +135,7 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
|
|||
sorteds = tree.stream().sorted(Comparator.comparing(AdcdTree::getAdcd)
|
||||
).collect(Collectors.toList());
|
||||
sorteds.forEach(o->{
|
||||
o.setAdcdChildren(sorted(o.getAdcdChildren()));
|
||||
o.setChildren(sorted(o.getChildren()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue