|
@@ -2,6 +2,7 @@ package com.usky.cdi.service.impl;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.usky.cdi.domain.*;
|
|
import com.usky.cdi.domain.*;
|
|
@@ -387,7 +388,7 @@ public class IotDataTransferService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 发送人员统计情况(703)
|
|
|
|
|
|
|
+ * 发送人员统计情况(703)-掩蔽人数
|
|
|
*
|
|
*
|
|
|
* @return 推送结果,包含成功数和失败数
|
|
* @return 推送结果,包含成功数和失败数
|
|
|
**/
|
|
**/
|
|
@@ -425,8 +426,14 @@ public class IotDataTransferService {
|
|
|
headcountVO.setEngineeringID(transferVO.getEngineeringId());
|
|
headcountVO.setEngineeringID(transferVO.getEngineeringId());
|
|
|
headcountVO.setSensorValue(peopleCount);
|
|
headcountVO.setSensorValue(peopleCount);
|
|
|
// headcountVO.setSensorID(buildUnit.getId());
|
|
// headcountVO.setSensorID(buildUnit.getId());
|
|
|
- headcountVO.setDataEndTime(now.minusMinutes(ThreadLocalRandom.current().nextInt(1, 2)));
|
|
|
|
|
- headcountVO.setPublishTime(now);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 为每条数据生成秒级微差的时间
|
|
|
|
|
+ int secondsOffset = ThreadLocalRandom.current().nextInt(0, 60);
|
|
|
|
|
+ LocalDateTime dataEndTimeWithOffset = now.minusMinutes(ThreadLocalRandom.current().nextInt(1, 3)).plusSeconds(secondsOffset);
|
|
|
|
|
+ LocalDateTime publishTimeWithOffset = now.plusSeconds(ThreadLocalRandom.current().nextInt(0, 30));
|
|
|
|
|
+
|
|
|
|
|
+ headcountVO.setDataEndTime(dataEndTimeWithOffset);
|
|
|
|
|
+ headcountVO.setPublishTime(publishTimeWithOffset);
|
|
|
headcountVO.setUnitName(buildUnit.getUnitName());
|
|
headcountVO.setUnitName(buildUnit.getUnitName());
|
|
|
headcountVO.setFloor(buildUnit.getFloor());
|
|
headcountVO.setFloor(buildUnit.getFloor());
|
|
|
|
|
|
|
@@ -1348,7 +1355,10 @@ public class IotDataTransferService {
|
|
|
} else if (raw instanceof Number) {
|
|
} else if (raw instanceof Number) {
|
|
|
dataTime = ((Number) raw).longValue();
|
|
dataTime = ((Number) raw).longValue();
|
|
|
} else if (raw instanceof String) {
|
|
} else if (raw instanceof String) {
|
|
|
- try { dataTime = Long.parseLong((String) raw); } catch (Exception ignored) {}
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ dataTime = Long.parseLong((String) raw);
|
|
|
|
|
+ } catch (Exception ignored) {
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (dataTime == null) return null;
|
|
if (dataTime == null) return null;
|
|
|
return LocalDateTime.ofInstant(Instant.ofEpochMilli(dataTime), ZoneId.systemDefault());
|
|
return LocalDateTime.ofInstant(Instant.ofEpochMilli(dataTime), ZoneId.systemDefault());
|
|
@@ -1408,7 +1418,8 @@ public class IotDataTransferService {
|
|
|
log.warn("平面图文件为空,FileID: {}", vo.getFloorFileID());
|
|
log.warn("平面图文件为空,FileID: {}", vo.getFloorFileID());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return jsonObject.toJSONString();
|
|
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ return gson.toJson(jsonObject);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void allData(Long engineeringId, String username, String password) {
|
|
public void allData(Long engineeringId, String username, String password) {
|