|
@ -22,6 +22,7 @@ import java.math.BigDecimal; |
|
|
import java.math.RoundingMode; |
|
|
import java.math.RoundingMode; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Pattern; |
|
|
import java.util.regex.Pattern; |
|
@ -61,7 +62,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
businessAlertBo.setDeptIdList(departIdList); |
|
|
businessAlertBo.setDeptIdList(departIdList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
List<Map<String, Object>> mapList = baseMapper.listMonthAlert(businessAlertBo); |
|
|
List<Map<String, Object>> mapList = baseMapper.listMonthAlert(businessAlertBo); |
|
|
|
|
|
|
|
|
return mapList.stream().map(data -> new StatObj(data.get("dateMonth") + "", data.get("total"))).collect(Collectors.toList()); |
|
|
return mapList.stream().map(data -> new StatObj(data.get("dateMonth") + "", data.get("total"))).collect(Collectors.toList()); |
|
@ -71,7 +72,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
@Override |
|
|
@Override |
|
|
public List<StatObj>countDepartAlert(BusinessAlertBo businessAlertBo) { |
|
|
public List<StatObj>countDepartAlert(BusinessAlertBo businessAlertBo) { |
|
|
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId())); |
|
|
businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = baseMapper.listDepartAlert(businessAlertBo); |
|
|
List<Map<String, Object>> mapList = baseMapper.listDepartAlert(businessAlertBo); |
|
|
|
|
|
|
|
@ -80,7 +81,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<StatObj> countMonthAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
public List<StatObj> countMonthAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = baseMapper.listMonthAlertStatus(businessAlertBo); |
|
|
List<Map<String, Object>> mapList = baseMapper.listMonthAlertStatus(businessAlertBo); |
|
|
|
|
|
|
|
@ -100,7 +101,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<StatObj> countDepartAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
public List<StatObj> countDepartAlertStatus(BusinessAlertBo businessAlertBo) { |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = baseMapper.listDepartAlertStatus(businessAlertBo); |
|
|
List<Map<String, Object>> mapList = baseMapper.listDepartAlertStatus(businessAlertBo); |
|
|
|
|
|
|
|
@ -125,7 +126,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<Map<String, Object>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) { |
|
|
public List<Map<String, Object>> countAlertStatusCompare(BusinessAlertBo businessAlertBo) { |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
return baseMapper.countAlertCompare(businessAlertBo); |
|
|
return baseMapper.countAlertCompare(businessAlertBo); |
|
|
} |
|
|
} |
|
@ -146,7 +147,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
businessAlertBo.setCreateTime(today.getYear()+"-"+today.getMonthValue()+"-"+today.getDayOfMonth()); |
|
|
businessAlertBo.setCreateTime(today.getYear()+"-"+today.getMonthValue()+"-"+today.getDayOfMonth()); |
|
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = baseMapper.countPanelAlert(businessAlertBo); |
|
|
List<Map<String, Object>> mapList = baseMapper.countPanelAlert(businessAlertBo); |
|
@ -163,7 +164,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<Map<String, Object>> countAlertTypeCompare(BusinessAlertBo businessAlertBo) { |
|
|
public List<Map<String, Object>> countAlertTypeCompare(BusinessAlertBo businessAlertBo) { |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); |
|
|
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); |
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
businessAlertBo.setDateList(buildDateList(businessAlertBo)); |
|
|
return baseMapper.countAlertTypeCompare(businessAlertBo); |
|
|
return baseMapper.countAlertTypeCompare(businessAlertBo); |
|
|
} |
|
|
} |
|
@ -177,18 +178,18 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
public Map<String,Object> countPanelTotalAlert(BusinessAlertBo businessAlertBo) { |
|
|
public Map<String,Object> countPanelTotalAlert(BusinessAlertBo businessAlertBo) { |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()); |
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
|
result.put("totalFinishCount", 0); |
|
|
result.put("totalFinish", 0); |
|
|
result.put("yearTotal", 0); |
|
|
result.put("yearTotal", 0); |
|
|
result.put("yearFinishCount", 0); |
|
|
result.put("yearFinish", 0); |
|
|
result.put("yearRate", 0); |
|
|
result.put("yearRate", 0); |
|
|
result.put("monthTotal",0); |
|
|
result.put("monthTotal",0); |
|
|
result.put("monthFinishCount", 0); |
|
|
result.put("monthFinish", 0); |
|
|
result.put("monthRate", 0); |
|
|
result.put("monthRate", 0); |
|
|
result.put("dayTotal", 0); |
|
|
result.put("dayTotal", 0); |
|
|
result.put("dayFinishCount", 0); |
|
|
result.put("dayFinish", 0); |
|
|
result.put("dayTodo", 0); |
|
|
result.put("dayTodo", 0); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
@ -198,7 +199,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
// 1、2024一直到当前年份处理预警个数
|
|
|
// 1、2024一直到当前年份处理预警个数
|
|
|
Integer totalFinishCount = baseMapper.countFromOldToCurrent(businessAlertBo); |
|
|
Integer totalFinishCount = baseMapper.countFromOldToCurrent(businessAlertBo); |
|
|
result.put("totalFinishCount", totalFinishCount); |
|
|
result.put("totalFinish", totalFinishCount); |
|
|
//2、今年处理率 今年的预警总数 今年处理个数
|
|
|
//2、今年处理率 今年的预警总数 今年处理个数
|
|
|
Map<String, Object> currentYearMap = baseMapper.countCurrentAlert(businessAlertBo); |
|
|
Map<String, Object> currentYearMap = baseMapper.countCurrentAlert(businessAlertBo); |
|
|
// 四舍五入保留两位小数
|
|
|
// 四舍五入保留两位小数
|
|
@ -207,7 +208,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
BigDecimal currentYearAverage = BigDecimal.valueOf((yearTotal == 0) ? 0.0 : yearFinishCount / yearTotal) |
|
|
BigDecimal currentYearAverage = BigDecimal.valueOf((yearTotal == 0) ? 0.0 : yearFinishCount / yearTotal) |
|
|
.setScale(2, RoundingMode.HALF_UP); |
|
|
.setScale(2, RoundingMode.HALF_UP); |
|
|
result.put("yearTotal", currentYearMap.get("total")); |
|
|
result.put("yearTotal", currentYearMap.get("total")); |
|
|
result.put("yearFinishCount", currentYearMap.get("finishCount")); |
|
|
result.put("yearFinish", currentYearMap.get("finishCount")); |
|
|
result.put("yearRate", currentYearAverage); |
|
|
result.put("yearRate", currentYearAverage); |
|
|
|
|
|
|
|
|
//3、本月处理率 本月预警总数 本月处理个数
|
|
|
//3、本月处理率 本月预警总数 本月处理个数
|
|
@ -220,14 +221,14 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
.setScale(2, RoundingMode.HALF_UP); |
|
|
.setScale(2, RoundingMode.HALF_UP); |
|
|
|
|
|
|
|
|
result.put("monthTotal", monthMap.get("total")); |
|
|
result.put("monthTotal", monthMap.get("total")); |
|
|
result.put("monthFinishCount", monthMap.get("finishCount")); |
|
|
result.put("monthFinish", monthMap.get("finishCount")); |
|
|
result.put("monthRate", currentMonthAverage); |
|
|
result.put("monthRate", currentMonthAverage); |
|
|
|
|
|
|
|
|
//4、今日预警总数 今日处理个数 今日未处理个数
|
|
|
//4、今日预警总数 今日处理个数 今日未处理个数
|
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
|
|
|
|
|
|
result.put("dayTotal", dayMap.get("total")); |
|
|
result.put("dayTotal", dayMap.get("total")); |
|
|
result.put("dayFinishCount", dayMap.get("finishCount")); |
|
|
result.put("dayFinish", dayMap.get("finishCount")); |
|
|
result.put("dayTodo", dayMap.get("todoCount")); |
|
|
result.put("dayTodo", dayMap.get("todoCount")); |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -243,7 +244,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ |
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()); |
|
|
List<String> labelList = getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
|
result.put("dayTotal", 0); |
|
|
result.put("dayTotal", 0); |
|
@ -258,7 +259,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
|
|
|
|
|
|
result.put("dayTotal", dayMap.get("total")); |
|
|
result.put("dayTotal", dayMap.get("total")); |
|
|
result.put("dayFinishCount", dayMap.get("finishCount")); |
|
|
result.put("dayFinish", dayMap.get("finishCount")); |
|
|
result.put("dayTodo", dayMap.get("todoCount")); |
|
|
result.put("dayTodo", dayMap.get("todoCount")); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
@ -279,7 +280,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
postVoList.forEach(postVo -> { |
|
|
postVoList.forEach(postVo -> { |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()); |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
businessAlertBo.setAiLabelEnList(labelList); |
|
|
businessAlertBo.setAiLabelEnList(labelList); |
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
Map<String, Object> dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); |
|
|
result.put(postVo.getPostName(), dayMap.get("total")); |
|
|
result.put(postVo.getPostName(), dayMap.get("total")); |
|
@ -304,12 +305,21 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
return ListUtil.empty(); |
|
|
return ListUtil.empty(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<String> monthList = getLastSixMonths(); |
|
|
String startTime; |
|
|
String startTime = monthList.get(monthList.size() - 1); |
|
|
String endTime; |
|
|
String endTime = monthList.get(0); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getDateType())){ |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(0); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
}else { |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(businessAlertBo.getDateType()); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
postVoList.forEach(postVo -> { |
|
|
postVoList.forEach(postVo -> { |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()); |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
Map<String, Object> dateMap = new HashMap<>(); |
|
|
Map<String, Object> dateMap = new HashMap<>(); |
|
|
if (ObjectUtil.isEmpty(labelList)) { |
|
|
if (ObjectUtil.isEmpty(labelList)) { |
|
|
dateMap.put("todoCount",0); |
|
|
dateMap.put("todoCount",0); |
|
@ -350,7 +360,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
statObj.setStatKey(month); |
|
|
statObj.setStatKey(month); |
|
|
List<StatObj> statObjs = new ArrayList<>(); |
|
|
List<StatObj> statObjs = new ArrayList<>(); |
|
|
postVoList.forEach(postVo -> { |
|
|
postVoList.forEach(postVo -> { |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()); |
|
|
List<String> labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
StatObj statObj1 = new StatObj(); |
|
|
StatObj statObj1 = new StatObj(); |
|
|
statObj1.setStatKey(postVo.getPostName()); |
|
|
statObj1.setStatKey(postVo.getPostName()); |
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
|
if (ObjectUtil.isEmpty(labelList)){ |
|
@ -382,77 +392,106 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
List<String> aiLabelList = getAiLabel(businessAlertBo.getPostCode()); |
|
|
List<RemoteAiLabelPostVo> labelList = getAiLabel(businessAlertBo.getPostCode()); |
|
|
|
|
|
List<String> aiLabelNameList = labelList.stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(aiLabelList)) { |
|
|
if (ObjectUtil.isEmpty(labelList)) { |
|
|
return Map.of(); |
|
|
return Map.of(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(aiLabelList); |
|
|
//-------------------------------------------------------条件构建--------------------------------------------
|
|
|
|
|
|
|
|
|
List<String> monthList = getLastSixMonths(); |
|
|
businessAlertBo.setAiLabelEnList(aiLabelNameList); |
|
|
String startTime = monthList.get(monthList.size() - 1); |
|
|
|
|
|
String endTime = monthList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String startTime = null; |
|
|
|
|
|
String endTime = null; |
|
|
|
|
|
|
|
|
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); |
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getDateType())){ |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(0); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
}else { |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(businessAlertBo.getDateType()); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Map<String,Object> labelMap = new HashMap<>(); |
|
|
|
|
|
labelMapList.forEach(label -> { |
|
|
//-------------------------------------------------------识别类型事件情况--------------------------------------------
|
|
|
labelMap.put(label.get("labelCn")+ "",label.get("total")); |
|
|
|
|
|
}); |
|
|
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); |
|
|
|
|
|
|
|
|
//识别类型存储
|
|
|
//识别类型存储
|
|
|
result.put("label", labelMap); |
|
|
result.put("label", labelMapList); |
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------街道事件高发区Top5--------------------------------------------
|
|
|
//事件高发区
|
|
|
//事件高发区
|
|
|
Long deptId = LoginHelper.getDeptId(); |
|
|
Long deptId = LoginHelper.getDeptId(); |
|
|
//获取街道信息
|
|
|
//获取街道信息
|
|
|
List<RemoteDeptVo> streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); |
|
|
List<RemoteDeptVo> streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); |
|
|
|
|
|
List<Long> deptIdList = streetList.stream().map(RemoteDeptVo::getDeptId).filter(id -> !id.equals(deptId)).distinct().toList(); |
|
|
|
|
|
|
|
|
Map<String,Integer> streeMap = new HashMap<>(); |
|
|
List<Map<String,Object>> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList); |
|
|
streetList.forEach(street -> { |
|
|
|
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
|
|
Integer alertCount = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime); |
|
|
|
|
|
streeMap.put(street.getDeptName(),alertCount); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//降序排序,取前五个
|
|
|
//街道事件高发区前5个
|
|
|
Map<String, Integer> top5Map = streeMap.entrySet().stream() |
|
|
|
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
|
|
|
.limit(5) |
|
|
|
|
|
.collect(Collectors.toMap( |
|
|
|
|
|
Map.Entry::getKey, |
|
|
|
|
|
Map.Entry::getValue, |
|
|
|
|
|
(e1, e2) -> e1, |
|
|
|
|
|
LinkedHashMap::new |
|
|
|
|
|
)); |
|
|
|
|
|
result.put("streetCount", top5Map); |
|
|
result.put("streetCount", top5Map); |
|
|
|
|
|
|
|
|
//处理效率top5
|
|
|
//-------------------------------------------------------街道处理效率Top5--------------------------------------------
|
|
|
Map<String,Integer> streeRateMap = new HashMap<>(); |
|
|
|
|
|
streetList.forEach(street -> { |
|
|
List<Map<String,Object>> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList); |
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
|
|
Integer alertCount = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime); |
|
|
//街道处理效率top5
|
|
|
if (ObjectUtil.isEmpty(alertCount)) { |
|
|
result.put("handlerRate", streetRateTop5Map); |
|
|
streeRateMap.put(street.getDeptName(),0); |
|
|
|
|
|
}else { |
|
|
//-------------------------------------------------------识别类型事件处理情况--------------------------------------------
|
|
|
streeRateMap.put(street.getDeptName(),alertCount); |
|
|
//识别类型事件处理情况
|
|
|
|
|
|
List<Map<String,Object>> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime); |
|
|
|
|
|
result.put("labelRate", labelRateMap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Integer> streeRatetop5Map = streeRateMap.entrySet().stream() |
|
|
private Map<String, String> getStartTimeAndEndTime(Integer dateType) { |
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
Map<String, String> result = new HashMap<>(); |
|
|
.limit(5) |
|
|
|
|
|
.collect(Collectors.toMap( |
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
|
|
Map.Entry::getKey, |
|
|
|
|
|
Map.Entry::getValue, |
|
|
|
|
|
(e1, e2) -> e1, |
|
|
|
|
|
LinkedHashMap::new |
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
result.put("handlerRate", streeRatetop5Map); |
|
|
switch (dateType) { |
|
|
|
|
|
case 0: |
|
|
|
|
|
LocalDate today = LocalDate.now(); |
|
|
|
|
|
LocalDate startDate = today.minusMonths(6) |
|
|
|
|
|
.with(TemporalAdjusters.firstDayOfMonth()); |
|
|
|
|
|
|
|
|
|
|
|
LocalDate endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
|
|
|
|
|
|
|
|
|
|
|
result.put("startTime",startDate.format(formatter)); |
|
|
|
|
|
result.put("endTime",endDate.format(formatter)); |
|
|
|
|
|
break; |
|
|
|
|
|
case 1: // 年
|
|
|
|
|
|
LocalDate currentDate = LocalDate.now(); |
|
|
|
|
|
LocalDate yearStartDate = currentDate.with(TemporalAdjusters.firstDayOfYear()); |
|
|
|
|
|
LocalDate yearEndDate = currentDate.with(TemporalAdjusters.lastDayOfYear()); |
|
|
|
|
|
|
|
|
|
|
|
result.put("startTime", yearStartDate.format(formatter)); |
|
|
|
|
|
result.put("endTime", yearEndDate.format(formatter)); |
|
|
|
|
|
break; |
|
|
|
|
|
case 2: // 月
|
|
|
|
|
|
LocalDate monthStartDate = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()); |
|
|
|
|
|
LocalDate monthEndDate = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()); |
|
|
|
|
|
|
|
|
|
|
|
result.put("startTime", monthStartDate.format(formatter)); |
|
|
|
|
|
result.put("endTime", monthEndDate.format(formatter)); |
|
|
|
|
|
break; |
|
|
|
|
|
case 3: // 日
|
|
|
|
|
|
LocalDate dayStartDate = LocalDate.now(); |
|
|
|
|
|
LocalDate dayEndDate = LocalDate.now(); |
|
|
|
|
|
|
|
|
|
|
|
result.put("startTime", dayStartDate.format(formatter)); |
|
|
|
|
|
result.put("endTime", dayEndDate.format(formatter)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -464,10 +503,19 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------条件构建--------------------------------------------
|
|
|
|
|
|
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLabelPostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
|
|
|
|
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
|
|
|
|
|
|
|
|
|
//事件高发区
|
|
|
|
|
|
Long deptId = LoginHelper.getDeptId(); |
|
|
|
|
|
//获取街道信息
|
|
|
|
|
|
List<RemoteDeptVo> streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); |
|
|
|
|
|
List<Long> deptIdList = streetList.stream().map(RemoteDeptVo::getDeptId).filter(id -> !id.equals(deptId)).distinct().toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(postVoList)) { |
|
|
if (ObjectUtil.isEmpty(postVoList)) { |
|
|
return ListUtil.empty(); |
|
|
return ListUtil.empty(); |
|
|
} |
|
|
} |
|
@ -478,76 +526,52 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
|
|
|
|
|
|
Map<String,Object> keyMap = new HashMap<>(); |
|
|
Map<String,Object> keyMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------事件处理情况--------------------------------------------
|
|
|
|
|
|
|
|
|
List<String> aiLabelList = aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList(); |
|
|
List<String> aiLabelList = aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList(); |
|
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(aiLabelList); |
|
|
businessAlertBo.setAiLabelEnList(aiLabelList); |
|
|
|
|
|
|
|
|
List<String> monthList = getLastSixMonths(); |
|
|
|
|
|
String startTime = monthList.get(monthList.size() - 1); |
|
|
String startTime = null; |
|
|
String endTime = monthList.get(0); |
|
|
String endTime = null; |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getDateType())){ |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(0); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
}else { |
|
|
|
|
|
Map<String,String> dateMap = getStartTimeAndEndTime(businessAlertBo.getDateType()); |
|
|
|
|
|
startTime = dateMap.get("startTime"); |
|
|
|
|
|
endTime = dateMap.get("endTime"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); |
|
|
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); |
|
|
|
|
|
|
|
|
Map<String,Object> labelMap = new HashMap<>(); |
|
|
keyMap.put("handlerStat", labelMapList); |
|
|
labelMapList.forEach(label -> { |
|
|
|
|
|
labelMap.put(label.get("labelCn")+ "",label.get("total")); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
keyMap.put("handlerStat", labelMap); |
|
|
|
|
|
|
|
|
|
|
|
//事件高发区
|
|
|
//-------------------------------------------------------事件高发区--------------------------------------------
|
|
|
Long deptId = LoginHelper.getDeptId(); |
|
|
|
|
|
//获取街道信息
|
|
|
|
|
|
List<RemoteDeptVo> streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Integer> streeMap = new HashMap<>(); |
|
|
//事件高发区top1
|
|
|
streetList.forEach(street -> { |
|
|
Map<String,Object> topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList); |
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
|
|
Integer alertCount = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime); |
|
|
|
|
|
streeMap.put(street.getDeptName(),alertCount); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//降序排序,取前五个
|
|
|
keyMap.put("topAlert",ObjectUtil.isEmpty(topStreet)?null:topStreet.get("deptName")); |
|
|
String topMap = streeMap.entrySet().stream() |
|
|
|
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
|
|
|
.limit(1) |
|
|
|
|
|
.map(Map.Entry::getKey) |
|
|
|
|
|
.findFirst() |
|
|
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
|
|
|
|
keyMap.put("topAlert",topMap); |
|
|
|
|
|
|
|
|
|
|
|
//处理效率top5
|
|
|
|
|
|
Map<String,Integer> streeRateMap = new HashMap<>(); |
|
|
|
|
|
streetList.forEach(street -> { |
|
|
|
|
|
businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); |
|
|
|
|
|
Integer alertCount = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime); |
|
|
|
|
|
if (ObjectUtil.isEmpty(alertCount)) { |
|
|
|
|
|
streeRateMap.put(street.getDeptName(),0); |
|
|
|
|
|
}else { |
|
|
|
|
|
streeRateMap.put(street.getDeptName(),alertCount); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
String topKey = streeRateMap.entrySet().stream() |
|
|
//-------------------------------------------------------处理效率--------------------------------------------
|
|
|
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed()) |
|
|
//处理效率top1
|
|
|
.limit(1) |
|
|
Map<String,Object> topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList); |
|
|
.map(Map.Entry::getKey) |
|
|
|
|
|
.findFirst() |
|
|
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
|
|
|
|
keyMap.put("handlerRate", topKey); |
|
|
keyMap.put("handlerRate", ObjectUtil.isEmpty(topStreetRate)?null:topStreetRate.get("deptName")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//识别类型存储
|
|
|
//-------------------------------------------------------存储结果--------------------------------------------
|
|
|
result.put(key, keyMap); |
|
|
result.put(key, keyMap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resultList.add(result); |
|
|
resultList.add(result); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultList; |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -591,7 +615,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist |
|
|
return resultList; |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private List<String> getAiLabel(String postCode) { |
|
|
private List<RemoteAiLabelPostVo> getAiLabel(String postCode) { |
|
|
return remoteLabelPostService.selectLabelByList(postCode,LoginHelper.getDeptId()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); |
|
|
return remoteLabelPostService.selectLabelByList(postCode,LoginHelper.getDeptId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|