|
|
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.inspur.elevator_data_collect.dao.DeviceStatisticsDayInfoDao;
|
|
|
import com.inspur.elevator_data_collect.domain.DeviceStatisticsDayInfo;
|
|
|
+import com.inspur.elevator_data_collect.domain.ElevatorInfoVO;
|
|
|
import com.inspur.elevator_data_collect.mqtt.MqttGateway;
|
|
|
+import com.inspur.idm.api.IElevatorService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.dubbo.config.annotation.Reference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
@@ -37,6 +40,9 @@ public class WriteMongoService {
|
|
|
@Autowired
|
|
|
private MqttGateway mqttGateway;
|
|
|
|
|
|
+ @Reference
|
|
|
+ private IElevatorService elevatorService;
|
|
|
+
|
|
|
/**
|
|
|
* 统计信息缓存key
|
|
|
*/
|
|
|
@@ -108,6 +114,16 @@ public class WriteMongoService {
|
|
|
}
|
|
|
DeviceStatisticsDayInfo deviceStatisticsDayInfo = deviceStatisticsDayInfoDao.selectSumStatisticsInfo(deviceId);
|
|
|
if (null != deviceStatisticsDayInfo) {
|
|
|
+ String elevatorId = deviceStatisticsDayInfoDao.selectElevatorIdByDeviceId(deviceId);
|
|
|
+ if (StringUtils.isNotBlank(elevatorId)) {
|
|
|
+ deviceStatisticsDayInfo.setElevatorId(elevatorId);
|
|
|
+ ElevatorInfoVO elevatorInfoVO = elevatorService.getElevatorInfoById(elevatorId);
|
|
|
+ if (null != elevatorInfoVO) {
|
|
|
+ deviceStatisticsDayInfo.setElevatorName(elevatorInfoVO.getElevatorName());
|
|
|
+ deviceStatisticsDayInfo.setCityName(elevatorInfoVO.getCityName());
|
|
|
+ deviceStatisticsDayInfo.setEstateName(elevatorInfoVO.getEstateName());
|
|
|
+ }
|
|
|
+ }
|
|
|
jsonResult = (JSONObject) JSON.toJSON(deviceStatisticsDayInfo);
|
|
|
// 为防止缓存穿透,设置缓存时间为随机60-120分钟
|
|
|
long randomTime = (long) (Math.random() * 60 + 60);
|