气象预警查询修改,历史气象预警统计修改
parent
6131cd2168
commit
7b52312207
|
|
@ -81,7 +81,7 @@ public class OrganizationController {
|
||||||
.setName(o.getAdnm())
|
.setName(o.getAdnm())
|
||||||
.setAdlevel(o.getAdlevel())
|
.setAdlevel(o.getAdlevel())
|
||||||
.setType("4");
|
.setType("4");
|
||||||
fcCommVo.setAdinfo(findAdcdTree(o.getAdcdChildren()));
|
fcCommVo.setAdinfo(findAdcdTree(o.getChildren()));
|
||||||
list.add(fcCommVo);
|
list.add(fcCommVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,45 +66,45 @@ public class WarningController {
|
||||||
String publishUnit = dto.getPublishUnit();
|
String publishUnit = dto.getPublishUnit();
|
||||||
if (StringUtils.isNotBlank(publishUnit)) {
|
if (StringUtils.isNotBlank(publishUnit)) {
|
||||||
String[] split = publishUnit.split(",");
|
String[] split = publishUnit.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String warnSignalLevel = dto.getWarnSignalLevel();
|
String warnSignalLevel = dto.getWarnSignalLevel();
|
||||||
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
||||||
String[] split = warnSignalLevel.split(",");
|
String[] split = warnSignalLevel.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String warnSignalType = dto.getWarnSignalType();
|
String warnSignalType = dto.getWarnSignalType();
|
||||||
if (StringUtils.isNotBlank(warnSignalType)) {
|
if (StringUtils.isNotBlank(warnSignalType)) {
|
||||||
String[] split = warnSignalType.split(",");
|
String[] split = warnSignalType.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,53 +141,53 @@ public class WarningController {
|
||||||
String publishUnit = dto.getPublishUnit();
|
String publishUnit = dto.getPublishUnit();
|
||||||
if (StringUtils.isNotBlank(publishUnit)) {
|
if (StringUtils.isNotBlank(publishUnit)) {
|
||||||
String[] split = publishUnit.split(",");
|
String[] split = publishUnit.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
filter.add(new ApiDto.Filter("publishUnit", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
filter.add(new ApiDto.Filter("publishUnit", "like", String.format("%s%s%s", "%", publishUnit, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String warnSignalLevel = dto.getWarnSignalLevel();
|
String warnSignalLevel = dto.getWarnSignalLevel();
|
||||||
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
if (StringUtils.isNotBlank(warnSignalLevel)) {
|
||||||
String[] split = warnSignalLevel.split(",");
|
String[] split = warnSignalLevel.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
filter.add(new ApiDto.Filter("warnSignalLevel", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
filter.add(new ApiDto.Filter("warnSignalLevel", "like", String.format("%s%s%s", "%", warnSignalLevel, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String warnSignalType = dto.getWarnSignalType();
|
String warnSignalType = dto.getWarnSignalType();
|
||||||
if (StringUtils.isNotBlank(warnSignalType)) {
|
if (StringUtils.isNotBlank(warnSignalType)) {
|
||||||
String[] split = warnSignalType.split(",");
|
String[] split = warnSignalType.split(",");
|
||||||
if (split.length > 1){
|
if (split.length > 1) {
|
||||||
String str = "(";
|
String str = "(";
|
||||||
for (String s : split) {
|
for (String s : split) {
|
||||||
str += s +",";
|
str += s + ",";
|
||||||
}
|
}
|
||||||
str = str.substring(0,str.length()-1) + ")";
|
str = str.substring(0, str.length() - 1) + ")";
|
||||||
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
filter.add(new ApiDto.Filter("warnSignalType", "in " + str, ""));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
filter.add(new ApiDto.Filter("warnSignalType", "like", String.format("%s%s%s", "%", warnSignalType, "%")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
apiDto.setFilter(filter);
|
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://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://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(apiDto));
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
if (json != null && json.getInteger("code") == HttpStatus.SC_OK) {
|
||||||
List<WarningData> data = json.getJSONArray("data").toJavaList(WarningData.class);
|
List<WarningData> data = json.getJSONArray("data").toJavaList(WarningData.class);
|
||||||
|
|
@ -248,12 +248,21 @@ public class WarningController {
|
||||||
|
|
||||||
List<WarningData.Warning> warnList = typeList.getWarnList();
|
List<WarningData.Warning> warnList = typeList.getWarnList();
|
||||||
|
|
||||||
// 类型分组
|
// 地区分组
|
||||||
Map<String, List<WarningData.Warning>> types = warnList.stream()
|
Map<String, List<WarningData.Warning>> area = warnList.stream()
|
||||||
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalType, Collectors.toList()));
|
.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();
|
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()
|
Map<String, Long> levels = v.stream()
|
||||||
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalLevel, Collectors.counting()));
|
.collect(Collectors.groupingBy(WarningData.Warning::getWarnSignalLevel, Collectors.counting()));
|
||||||
|
|
@ -261,29 +270,38 @@ public class WarningController {
|
||||||
levels.forEach((k1, v1) -> {
|
levels.forEach((k1, v1) -> {
|
||||||
switch (k1) {
|
switch (k1) {
|
||||||
case "红色":
|
case "红色":
|
||||||
childVo.setRedCount(v1.intValue());
|
county.setRedCount(v1.intValue());
|
||||||
|
childVo.setRedCount(v1.intValue() + childVo.getRedCount());
|
||||||
vo.setRedCount(v1.intValue() + vo.getRedCount());
|
vo.setRedCount(v1.intValue() + vo.getRedCount());
|
||||||
break;
|
break;
|
||||||
case "橙色":
|
case "橙色":
|
||||||
childVo.setOraCount(v1.intValue());
|
county.setOraCount(v1.intValue());
|
||||||
|
childVo.setOraCount(v1.intValue() + childVo.getOraCount());
|
||||||
vo.setOraCount(v1.intValue() + vo.getOraCount());
|
vo.setOraCount(v1.intValue() + vo.getOraCount());
|
||||||
break;
|
break;
|
||||||
case "黄色":
|
case "黄色":
|
||||||
childVo.setYelCount(v1.intValue());
|
county.setYelCount(v1.intValue());
|
||||||
|
childVo.setYelCount(v1.intValue() + childVo.getYelCount());
|
||||||
vo.setYelCount(v1.intValue() + vo.getYelCount());
|
vo.setYelCount(v1.intValue() + vo.getYelCount());
|
||||||
break;
|
break;
|
||||||
case "蓝色":
|
case "蓝色":
|
||||||
childVo.setBluCount(v1.intValue());
|
county.setBluCount(v1.intValue());
|
||||||
|
childVo.setBluCount(v1.intValue() + childVo.getBluCount());
|
||||||
vo.setBluCount(v1.intValue() + vo.getBluCount());
|
vo.setBluCount(v1.intValue() + vo.getBluCount());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new MyException("当前预警等级不存在: " + k1);
|
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);
|
child.add(childVo);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class AdcdTree {
|
||||||
private Integer adlevel;
|
private Integer adlevel;
|
||||||
|
|
||||||
@ApiModelProperty("下属行政区")
|
@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) {
|
for (Adinfo adinfo : list) {
|
||||||
String ad = adinfo.getAdcd();
|
String ad = adinfo.getAdcd();
|
||||||
String nm = adinfo.getAdnm();
|
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);
|
String provinceStr = ad.substring(0, 2);
|
||||||
|
|
@ -86,8 +86,10 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
|
||||||
List<AdcdTree> adcdChildren = county.get(cityStr);
|
List<AdcdTree> adcdChildren = county.get(cityStr);
|
||||||
AdcdTree adcdTree1 = new AdcdTree();
|
AdcdTree adcdTree1 = new AdcdTree();
|
||||||
BeanUtils.copyProperties(adcdTree,adcdTree1);
|
BeanUtils.copyProperties(adcdTree,adcdTree1);
|
||||||
|
if (CollectionUtils.isNotEmpty(adcdChildren)){
|
||||||
adcdChildren.add(0,adcdTree1);
|
adcdChildren.add(0,adcdTree1);
|
||||||
adcdTree.setAdcdChildren(adcdChildren);
|
}
|
||||||
|
adcdTree.setChildren(adcdChildren);
|
||||||
addTree(city, provinceStr, adcdTree);
|
addTree(city, provinceStr, adcdTree);
|
||||||
tree.add(adcdTree);
|
tree.add(adcdTree);
|
||||||
|
|
||||||
|
|
@ -133,7 +135,7 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
|
||||||
sorteds = tree.stream().sorted(Comparator.comparing(AdcdTree::getAdcd)
|
sorteds = tree.stream().sorted(Comparator.comparing(AdcdTree::getAdcd)
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
sorteds.forEach(o->{
|
sorteds.forEach(o->{
|
||||||
o.setAdcdChildren(sorted(o.getAdcdChildren()));
|
o.setChildren(sorted(o.getChildren()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue