|
|
@ -1,6 +1,7 @@ |
|
|
|
package org.dromara.business.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.collection.ListUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
@ -317,71 +318,56 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String,Object>> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
|
|
|
|
|
public Map<String,Object> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
//生成近一周开始时间、结束时间
|
|
|
|
List<String> dayList = getLastSixDays(); |
|
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
|
String endTime = dayList.get(0); |
|
|
|
|
|
|
|
result.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
//查看的是总览的预警信息
|
|
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
result.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
result.put("list",this.baseMapper.listAlert(businessAlertBo,startTime,endTime)); |
|
|
|
|
|
|
|
resultList.add(result); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
//不是空的话查看是对应各局的
|
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
|
|
|
|
|
postVoList.forEach(postVo -> { |
|
|
|
Map<String,Object> labelResult = new HashMap<>(); |
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(List.of(postVo.getLabelEn())); |
|
|
|
businessAlertBo.setAiLabelEnList(List.of(businessAlertBo.getLabelEn())); |
|
|
|
|
|
|
|
Map<String,Object> handlerMap = new HashMap<>(); |
|
|
|
Map<String,Object> handlerMap = new HashMap<>(); |
|
|
|
|
|
|
|
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); |
|
|
|
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); |
|
|
|
|
|
|
|
handlerMap.put("total",alertList.size()); |
|
|
|
handlerMap.put("finishCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count()); |
|
|
|
handlerMap.put("todoCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count()); |
|
|
|
handlerMap.put("cancelCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.CANCEL.getStatus())).count()); |
|
|
|
handlerMap.put("total",alertList.size()); |
|
|
|
handlerMap.put("finishCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count()); |
|
|
|
handlerMap.put("todoCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count()); |
|
|
|
handlerMap.put("cancelCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.CANCEL.getStatus())).count()); |
|
|
|
|
|
|
|
result.put("panel",handlerMap); |
|
|
|
result.put("panel",handlerMap); |
|
|
|
|
|
|
|
result.put("list",alertList); |
|
|
|
result.put("list",alertList); |
|
|
|
|
|
|
|
result.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
labelResult.put(postVo.getLabelCn(),result); |
|
|
|
|
|
|
|
resultList.add(labelResult); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return resultList; |
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, Object>> cityListAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
|
public Map<String, Object> cityListAlert(BusinessAlertBo businessAlertBo) { |
|
|
|
if (ObjectUtil.hasEmpty(businessAlertBo.getPostCode(),businessAlertBo.getAiName())) { |
|
|
|
throw new ServiceException("参数为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String,Object> infoMap = new HashMap<>(); |
|
|
|
|
|
|
|
//生成近一周开始时间、结束时间
|
|
|
|
List<String> dayList = getLastSixDays(); |
|
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
|
String endTime = dayList.get(0); |
|
|
|
|
|
|
|
infoMap.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
//不是空的话查看是对应各局的
|
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
@ -389,36 +375,30 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(postVoList)){ |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
infoMap.put("panel",Map.of()); |
|
|
|
|
|
|
|
aiNameMap.keySet().forEach(key -> { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
infoMap.put("list", ListUtil.empty()); |
|
|
|
|
|
|
|
Map<String,Object> infoMap = new HashMap<>(); |
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); |
|
|
|
return infoMap; |
|
|
|
} |
|
|
|
|
|
|
|
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); |
|
|
|
|
|
|
|
Map<String, Integer> labelCnMap = alertList.stream() |
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
BusinessAlert::getLabelCn, |
|
|
|
Collectors.summingInt(e -> 1) |
|
|
|
)); |
|
|
|
businessAlertBo.setAiLabelEnList(aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); |
|
|
|
|
|
|
|
infoMap.put("panel",labelCnMap); |
|
|
|
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); |
|
|
|
|
|
|
|
infoMap.put("list",alertList); |
|
|
|
Map<String, Integer> labelCnMap = alertList.stream() |
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
BusinessAlert::getLabelEn, |
|
|
|
Collectors.summingInt(e -> 1) |
|
|
|
)); |
|
|
|
|
|
|
|
infoMap.put("date", startTime + "~" + endTime); |
|
|
|
infoMap.put("panel",labelCnMap); |
|
|
|
|
|
|
|
result.put(key,infoMap); |
|
|
|
infoMap.put("list",alertList); |
|
|
|
|
|
|
|
resultList.add(result); |
|
|
|
}); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
return infoMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|