Browse Source

[feat]

1、增加查询获取飞行架次、飞行时长方法
pull/1/head
杨威 3 months ago
parent
commit
9172742ed9
  1. 9
      dk-common/common-core/src/main/java/org/dromara/common/core/constant/Constants.java
  2. 55
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

9
dk-common/common-core/src/main/java/org/dromara/common/core/constant/Constants.java

@ -77,5 +77,14 @@ public interface Constants {
*/ */
Long TOP_PARENT_ID = 0L; Long TOP_PARENT_ID = 0L;
/**
* 飞行总架次
*/
String FLY_COUNT = "fly_count";
/**
* 飞行总时长
*/
String FLY_ACC_TIME = "fly_accTime";
} }

55
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

@ -9,7 +9,9 @@ import org.dromara.business.domain.model.StatObj;
import org.dromara.business.mapper.BusinessAlertMapper; import org.dromara.business.mapper.BusinessAlertMapper;
import org.dromara.business.service.IBusinessAlertStatisticsService; import org.dromara.business.service.IBusinessAlertStatisticsService;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.redis.utils.RedisOpsUtils;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.tenant.helper.TenantHelper;
import org.dromara.system.api.RemoteDeptService; import org.dromara.system.api.RemoteDeptService;
import org.dromara.system.api.RemoteLabelPostService; import org.dromara.system.api.RemoteLabelPostService;
import org.dromara.system.api.RemotePostService; import org.dromara.system.api.RemotePostService;
@ -17,7 +19,7 @@ import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo;
import org.dromara.system.api.domain.vo.RemoteDeptVo; import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.dromara.system.api.domain.vo.RemotePostVo; import org.dromara.system.api.domain.vo.RemotePostVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.dromara.common.redis.utils.RedisUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
@ -29,6 +31,9 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static org.dromara.common.core.constant.Constants.FLY_ACC_TIME;
import static org.dromara.common.core.constant.Constants.FLY_COUNT;
/** /**
* *
*预警统计Service业务层处理 *预警统计Service业务层处理
@ -141,7 +146,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
new StatObj("total", 0), new StatObj("total", 0),
new StatObj("todoCount", 0), new StatObj("todoCount", 0),
new StatObj("finishCount", 0), new StatObj("finishCount", 0),
new StatObj("cancelCount", 0) new StatObj("cancelCount", 0),
new StatObj("flyCount", 0),
new StatObj("flyAccTime", 0)
).toList(); ).toList();
} }
@ -150,6 +157,34 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()));
} }
//获取飞行总架次、总时长
Map<String, Object> countMap = RedisUtils.getCacheMap(FLY_COUNT);
int flyCount = countMap.values().stream()
.filter(Objects::nonNull)
.mapToInt(value -> {
if (value instanceof Number) {
return ((Number) value).intValue();
}
return 0;
})
.sum();
Map<String, Object> accTimeMap = RedisUtils.getCacheMap(FLY_ACC_TIME);
double flyAccTime = accTimeMap.values().stream()
.filter(Objects::nonNull)
.mapToDouble(value -> {
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return 0.0;
})
.sum();
List<Map<String, Object>> mapList = baseMapper.countPanelAlert(businessAlertBo); List<Map<String, Object>> mapList = baseMapper.countPanelAlert(businessAlertBo);
return mapList.stream() return mapList.stream()
@ -157,7 +192,9 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
new StatObj("total", map.get("total")), new StatObj("total", map.get("total")),
new StatObj("todoCount", map.get("todoCount")), new StatObj("todoCount", map.get("todoCount")),
new StatObj("finishCount", map.get("finishCount")), new StatObj("finishCount", map.get("finishCount")),
new StatObj("cancelCount", map.get("cancelCount")) new StatObj("cancelCount", map.get("cancelCount")),
new StatObj("flyCount", flyCount),
new StatObj("flyAccTime", flyAccTime)
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -435,19 +472,19 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List<Map<String,Object>> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList); List<Map<String,Object>> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList);
//街道事件高发区前5个 //街道事件高发区前5个
result.put("streetCount", top5Map); result.put("incidentTop5", top5Map);
//-------------------------------------------------------街道处理效率Top5-------------------------------------------- //-------------------------------------------------------街道处理效率Top5--------------------------------------------
List<Map<String,Object>> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList); List<Map<String,Object>> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList);
//街道处理效率top5 //街道处理效率top5
result.put("handlerRate", streetRateTop5Map); result.put("incidentHandlerTop5", streetRateTop5Map);
//-------------------------------------------------------识别类型事件处理情况-------------------------------------------- //-------------------------------------------------------识别类型事件处理情况--------------------------------------------
//识别类型事件处理情况 //识别类型事件处理情况
List<Map<String,Object>> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime); List<Map<String,Object>> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime);
result.put("labelRate", labelRateMap); result.put("labelHandlerRate", labelRateMap);
return result; return result;
@ -549,7 +586,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); List<Map<String,Object>> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime);
keyMap.put("handlerStat", labelMapList); keyMap.put("incidentHandlerStat", labelMapList);
//-------------------------------------------------------事件高发区-------------------------------------------- //-------------------------------------------------------事件高发区--------------------------------------------
@ -557,13 +594,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//事件高发区top1 //事件高发区top1
Map<String,Object> topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList); Map<String,Object> topStreet = this.baseMapper.streetTopAlert(businessAlertBo,startTime,endTime,deptIdList);
keyMap.put("topAlert",ObjectUtil.isEmpty(topStreet)?null:topStreet.get("deptName")); keyMap.put("incidentTop1",ObjectUtil.isEmpty(topStreet)?null:topStreet.get("deptName"));
//-------------------------------------------------------处理效率-------------------------------------------- //-------------------------------------------------------处理效率--------------------------------------------
//处理效率top1 //处理效率top1
Map<String,Object> topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList); Map<String,Object> topStreetRate = this.baseMapper.streetRateTopAlert(businessAlertBo,startTime,endTime,deptIdList);
keyMap.put("handlerRate", ObjectUtil.isEmpty(topStreetRate)?null:topStreetRate.get("deptName")); keyMap.put("handlerRateTop1", ObjectUtil.isEmpty(topStreetRate)?null:topStreetRate.get("deptName"));
//-------------------------------------------------------存储结果-------------------------------------------- //-------------------------------------------------------存储结果--------------------------------------------

Loading…
Cancel
Save