|
@ -1,6 +1,7 @@ |
|
|
package org.dromara.business.service.impl; |
|
|
package org.dromara.business.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import cn.hutool.core.collection.ListUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
@ -26,6 +27,7 @@ import org.dromara.system.api.RemoteLabelPostService; |
|
|
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteUserVo; |
|
|
import org.dromara.system.api.domain.vo.RemoteUserVo; |
|
|
import org.dromara.workflow.api.RemoteWorkflowService; |
|
|
import org.dromara.workflow.api.RemoteWorkflowService; |
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.lang.reflect.Method; |
|
|
import java.lang.reflect.Method; |
|
@ -75,7 +77,15 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList) { |
|
|
public Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList) { |
|
|
List<BusinessAlert> businessAlerts = MapstructUtils.convert(alertVoList, BusinessAlert.class); |
|
|
List<BusinessAlert> businessAlerts = alertVoList.stream().map(alert -> { |
|
|
|
|
|
BusinessAlert businessAlert = new BusinessAlert(); |
|
|
|
|
|
alert.setCreateTime(new Date()); |
|
|
|
|
|
alert.setHandleType(BusinessStatusEnum.VERIFY.getStatus()); |
|
|
|
|
|
BeanUtils.copyProperties(alert, businessAlert); |
|
|
|
|
|
|
|
|
|
|
|
return businessAlert; |
|
|
|
|
|
}).toList(); |
|
|
|
|
|
|
|
|
return this.baseMapper.insertBatch(businessAlerts); |
|
|
return this.baseMapper.insertBatch(businessAlerts); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -318,71 +328,56 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<Map<String,Object>> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
public Map<String,Object> listAlert(BusinessAlertBo businessAlertBo) { |
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
//生成近一周开始时间、结束时间
|
|
|
//生成近一周开始时间、结束时间
|
|
|
List<String> dayList = getLastSixDays(); |
|
|
List<String> dayList = getLastSixDays(); |
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
String endTime = dayList.get(0); |
|
|
String endTime = dayList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
result.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
|
//查看的是总览的预警信息
|
|
|
//查看的是总览的预警信息
|
|
|
if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { |
|
|
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)); |
|
|
result.put("list",this.baseMapper.listAlert(businessAlertBo,startTime,endTime)); |
|
|
|
|
|
|
|
|
resultList.add(result); |
|
|
return result; |
|
|
|
|
|
|
|
|
return resultList; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//不是空的话查看是对应各局的
|
|
|
//不是空的话查看是对应各局的
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
businessAlertBo.setAiLabelEnList(List.of(businessAlertBo.getLabelEn())); |
|
|
|
|
|
|
|
|
postVoList.forEach(postVo -> { |
|
|
|
|
|
Map<String,Object> labelResult = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
businessAlertBo.setAiLabelEnList(List.of(postVo.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()); |
|
|
result.put("panel",handlerMap); |
|
|
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("list",alertList); |
|
|
|
|
|
|
|
|
result.put("list",alertList); |
|
|
return result; |
|
|
|
|
|
|
|
|
result.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
|
|
|
|
labelResult.put(postVo.getLabelCn(),result); |
|
|
|
|
|
|
|
|
|
|
|
resultList.add(labelResult); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultList; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<Map<String, Object>> cityListAlert(BusinessAlertBo businessAlertBo) { |
|
|
public Map<String, Object> cityListAlert(BusinessAlertBo businessAlertBo) { |
|
|
List<Map<String,Object>> resultList = new ArrayList<>(); |
|
|
if (ObjectUtil.hasEmpty(businessAlertBo.getPostCode(),businessAlertBo.getAiName())) { |
|
|
|
|
|
throw new ServiceException("参数为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> infoMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
//生成近一周开始时间、结束时间
|
|
|
//生成近一周开始时间、结束时间
|
|
|
List<String> dayList = getLastSixDays(); |
|
|
List<String> dayList = getLastSixDays(); |
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
String startTime = dayList.get(dayList.size() - 1); |
|
|
String endTime = dayList.get(0); |
|
|
String endTime = dayList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
infoMap.put("date", startTime + "~" + endTime); |
|
|
|
|
|
|
|
|
//不是空的话查看是对应各局的
|
|
|
//不是空的话查看是对应各局的
|
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
|
List<RemoteAiLabelPostVo> postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); |
|
@ -390,36 +385,30 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { |
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
Map<String, List<RemoteAiLabelPostVo>> aiNameMap = postVoList.stream().collect(Collectors.groupingBy(RemoteAiLabelPostVo::getAiName)); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(postVoList)){ |
|
|
if (ObjectUtil.isEmpty(postVoList)){ |
|
|
return resultList; |
|
|
infoMap.put("panel",Map.of()); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
aiNameMap.keySet().forEach(key -> { |
|
|
infoMap.put("list", ListUtil.empty()); |
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> infoMap = new HashMap<>(); |
|
|
return infoMap; |
|
|
|
|
|
} |
|
|
businessAlertBo.setAiLabelEnList(aiNameMap.get(key).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); |
|
|
|
|
|
|
|
|
|
|
|
List<BusinessAlert> alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Integer> labelCnMap = alertList.stream() |
|
|
businessAlertBo.setAiLabelEnList(aiNameMap.get(businessAlertBo.getAiName()).stream().map(RemoteAiLabelPostVo::getLabelEn).distinct().toList()); |
|
|
.collect(Collectors.groupingBy( |
|
|
|
|
|
BusinessAlert::getLabelCn, |
|
|
|
|
|
Collectors.summingInt(e -> 1) |
|
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
@Override |
|
|