Browse Source

[feat]

1、修改根据设备权限获取飞行时长、飞行总价次
wuyuan
杨威 2 months ago
parent
commit
7321f972b0
  1. 27
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

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

@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.business.domain.bo.BusinessAlertBo; import org.dromara.business.domain.bo.BusinessAlertBo;
import org.dromara.business.domain.model.StatObj; import org.dromara.business.domain.model.StatObj;
import org.dromara.business.feign.FeignDeviceGroup;
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;
@ -20,6 +21,7 @@ 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.dromara.system.api.model.LoginUser; import org.dromara.system.api.model.LoginUser;
import org.dromara.system.api.model.RoleDTO; import org.dromara.system.api.model.RoleDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -58,6 +60,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
@DubboReference(timeout = 30000) @DubboReference(timeout = 30000)
RemoteDataScopeService remoteDataScopeService; RemoteDataScopeService remoteDataScopeService;
@Autowired
FeignDeviceGroup feignDeviceGroup;
/** /**
* 按照月份分类预警数量 * 按照月份分类预警数量
* @param businessAlertBo * @param businessAlertBo
@ -176,7 +182,17 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//----------------------------------------------获取飞行总架次、总时长---------------------------------------------- //----------------------------------------------获取飞行总架次、总时长----------------------------------------------
//获取飞行总架次、总时长 //获取飞行总架次、总时长
Map<String, Object> countMap = RedisUtils.getCacheMap(FLY_COUNT); //获取机场信息根据当前登录人
List<String> deviceSnList = ObjectUtil.isNotEmpty(feignDeviceGroup.listDevice(LoginHelper.getUserId()))?feignDeviceGroup.listDevice(LoginHelper.getUserId()):ListUtil.empty();
//过滤redis中用户所拥有的设备
Map<String, Object> countMap = Optional.ofNullable(RedisUtils.getCacheMap(FLY_COUNT))
.map(map -> map.entrySet().stream()
.filter(entry -> deviceSnList.contains(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)))
.orElse(new HashMap<>());
int flyCount; int flyCount;
if (ObjectUtil.isNotEmpty(countMap)){ if (ObjectUtil.isNotEmpty(countMap)){
@ -193,7 +209,14 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
flyCount = 0; flyCount = 0;
} }
Map<String, Object> accTimeMap = RedisUtils.getCacheMap(FLY_ACC_TIME); //过滤redis中用户所拥有的设备
Map<String, Object> accTimeMap = Optional.ofNullable(RedisUtils.getCacheMap(FLY_ACC_TIME))
.map(map -> map.entrySet().stream()
.filter(entry -> deviceSnList.contains(entry.getKey()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)))
.orElse(new HashMap<>());
double flyAccTime; double flyAccTime;
if (ObjectUtil.isNotEmpty(accTimeMap)) { if (ObjectUtil.isNotEmpty(accTimeMap)) {

Loading…
Cancel
Save