Commit 5f6296e8 authored by suhuiguang's avatar suhuiguang

1.左右屏中区域只统计到县区(例如横坐标为区域的柱状图),地图为县区时,柱状图只显示自身一个(不要显示到镇、街道),新增tgl接口调整

parent b189f718
......@@ -116,7 +116,7 @@ public class YJDPStatisticsServiceImpl {
List<Object> complaint = new ArrayList<>();
List<Object> fault = new ArrayList<>();
List<Map<String, Object>> maps = new ArrayList<>();
if(orgCode != null){
if (orgCode != null) {
maps = alertCalledMapper.queryNearlyList(beginDate, endDate, orgCode);
}
List<Map<String, Object>> finalMaps = maps;
......@@ -148,9 +148,9 @@ public class YJDPStatisticsServiceImpl {
List<Long> ydata = new ArrayList<>();
regionList.forEach(x -> {
String orgCode = stCommonService.getAndSetOrgCode(x.getRegionCode().toString());
if(!ValidationUtil.isEmpty(orgCode)) {
if (!ValidationUtil.isEmpty(orgCode)) {
ydata.add(elevatorCountByES(orgCode));
}else{
} else {
ydata.add(0L);
}
});
......@@ -168,19 +168,19 @@ public class YJDPStatisticsServiceImpl {
List<Object> xdata = dataDictionaries.stream().map(DataDictionary::getName).collect(Collectors.toList());
List<Object> ydata;
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if(orgCode == null){
ydata = dataDictionaries.stream().map(d-> 0L).collect(Collectors.toList());
if (orgCode == null) {
ydata = dataDictionaries.stream().map(d -> 0L).collect(Collectors.toList());
} else {
List<CountDto> maps = alertCalledMapper.queryListByLocation(orgCode, dpFilterParamDto);
Map<String, Long> addressNumMap = maps.stream().collect(Collectors.toMap(CountDto::getKeyStr,CountDto::getLongValue));
ydata = dataDictionaries.stream().map(d-> {
Map<String, Long> addressNumMap = maps.stream().collect(Collectors.toMap(CountDto::getKeyStr, CountDto::getLongValue));
ydata = dataDictionaries.stream().map(d -> {
Long num = 0L;
// 目前USE_PLACE字段存放字典的id
if(addressNumMap.get(d.getSequenceNbr().toString()) != null){
if (addressNumMap.get(d.getSequenceNbr().toString()) != null) {
num = addressNumMap.get(d.getSequenceNbr().toString());
}
// 数据库中老数据历史问题存放字典的name,兼容对老数据的统计
if(addressNumMap.get(d.getName()) != null){
if (addressNumMap.get(d.getName()) != null) {
num = num + addressNumMap.get(d.getName());
}
return num;
......@@ -195,7 +195,7 @@ public class YJDPStatisticsServiceImpl {
public JSONObject faultCauseRatio(DPFilterParamDto dpFilterParamDto) {
JSONObject jsonObject = new JSONObject();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if(orgCode == null){
if (orgCode == null) {
return jsonObject;
}
List<Map<String, Object>> maps = alertCalledMapper.faultCauseRatio(orgCode);
......@@ -309,7 +309,7 @@ public class YJDPStatisticsServiceImpl {
public List<Map<String, Object>> rankUnitByRescueTime(DPFilterParamDto dpFilterParamDto) {
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto);
if(orgCode == null){
if (orgCode == null) {
return new ArrayList<>();
}
List<Map<String, Object>> maps = dispatchTaskMapper.rankUnitByRescueTime(orgCode);
......@@ -337,9 +337,12 @@ public class YJDPStatisticsServiceImpl {
}
public JSONObject regionEventRank(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> childRegion = stCommonService.setRegionIfRootParent(dpFilterParamDto);
JSONObject jsonObject = new JSONObject();
String orgCodeR = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (orgCodeR == null) {
return jsonObject;
}
List<RegionModel> childRegion = stCommonService.setRegionIfRootParentAndNoAccessIf3Level(dpFilterParamDto);
Map<String, Long> map = new HashMap<>();
childRegion.forEach(x -> {
String orgCode = stCommonService.getAndSetOrgCode(x.getRegionCode().toString());
......@@ -350,14 +353,10 @@ public class YJDPStatisticsServiceImpl {
map.put(x.getRegionName(), num);
}
});
List<String> xdata = new ArrayList<>(map.keySet());
List<Long> ydata = new ArrayList<>();
xdata.sort(Comparator.comparingLong(map::get).reversed());
xdata.stream().forEach(x -> {
ydata.add(map.get(x));
});
xdata.forEach(x -> ydata.add(map.get(x)));
jsonObject.put("xdata", xdata);
jsonObject.put("ydata", ydata);
return jsonObject;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment