Commit 7c4b0748 by 汪志阳

modify:bug 修改

parent 1f4b369f
......@@ -88,6 +88,16 @@ public class PlatElderSleepController {
}
@ApiOperation("测试")
@GetMapping("test44")
@AuthIgnore
@TenantIdIgnore
public ApiResponseEntity<Void> test44(@RequestParam Integer month,
@RequestParam Integer day) {
platElderSleepService.test44(month, day);
return ApiResponseUtils.success();
}
@ApiOperation("测试")
@PostMapping("test5")
@AuthIgnore
@TenantIdIgnore
......
......@@ -22,4 +22,5 @@ public interface PlatElderSleepService extends IService<PlatElderSleep> {
String calculateScores(long daySleepTime, long dayRestTime, long deepTime, long soberTime, long lightTime,
SaasSleepEvaluateStandardReport evaluateStandardReport);
void test44(Integer month, Integer day);
}
......@@ -99,7 +99,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
TreeMap<String, AnalysisVO> result = new TreeMap<>();
collect1.forEach(result::put);
getDayMinute(1,10).forEach(minute -> {
getDayMinute(3,21).forEach(minute -> {
boolean key = result.containsKey(minute);
if (!key) {
AnalysisVO analysisVO = buildDefaultData(minute);
......
......@@ -240,8 +240,9 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
for (Map.Entry<String, AnalysisVO> entry : totalMap.entrySet()) {
AnalysisVO analysisVO = entry.getValue();
boolean isValid = analysisVO.getAvgBr() == 255 && analysisVO.getAvgHr() == 255;
// 非离床且体动值<20
if (!analysisVO.getIsAction() && !analysisVO.getIsMoveBed()) {
if (!analysisVO.getIsAction() && !analysisVO.getIsMoveBed() && !isValid) {
if (StrUtil.isBlank(startSleepTime)) {
startSleepTime = entry.getKey();
}
......@@ -955,6 +956,44 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
return result;
}
/**
* iot线上机器数据插入表,方便分析睡眠
* @param month
* @param day
*/
@Override
public void test44(Integer month, Integer day) {
List<String> dayHourRangeList = getLastDayHourRange(month, day);
String oriDeviceId = "H6V01241050037T";
SaasSleepAnalysisModel analysisModel = saasSleepAnalysisModelService.getOne(new QueryWrapper<SaasSleepAnalysisModel>().lambda()
.orderByDesc(BaseEntity::getCreateBy)
.last("limit 1"));
for (String hourRange : dayHourRangeList) {
String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(oriDeviceId,
"reportProperty", 10000, hourRangeArray[0], hourRangeArray[1]);
if (CollUtil.isEmpty(deviceOperationLogEntities)) {
continue;
}
List<DeviceInfoContentBreathe> deviceInfoContentBreatheList = deviceOperationLogEntities.stream()
.filter(deviceOperationLogEntity -> deviceOperationLogEntity.getType().contains("reportProperty"))
.map(deviceOperationLogEntity -> {
DeviceInfoContentBreathe deviceInfoContentBreathe = JsonUtil.toObj((String) deviceOperationLogEntity.getContent(), DeviceInfoContentBreathe.class);
assert deviceInfoContentBreathe != null;
deviceInfoContentBreathe.setReportTime(formatLongTime(deviceInfoContentBreathe.getTimestamp()));
return deviceInfoContentBreathe;
}).collect(Collectors.toList());
Map<String, List<DeviceInfoContentBreathe>> minuteMap = StreamUtil.groupBy(deviceInfoContentBreatheList, DeviceInfoContentBreathe::getReportTime);
deviceLogService.save(deviceOperationLogEntities);
deviceOperationLogEntities.clear();
TreeMap<String, AnalysisVO> statisticsMap = getPerMinuteData(minuteMap, analysisModel);
if (CollUtil.isNotEmpty(statisticsMap)) {
//测试环境数据 device_minute_info
deviceLogService.saveEntity(statisticsMap, "1765616197461037058");
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@TenantIdIgnore
......@@ -1024,6 +1063,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
if (CollUtil.isEmpty(totalMap)) {
continue;
}
// 测试环境数据 device_minute_info totalMap = deviceLogService.getData();
// 没有上报数据的时间,填默认值
deviceLogService.fillDefaultData(totalMap, month, day);
// 记录长者不同类型的睡眠时间
......
......@@ -57,7 +57,7 @@
</insert>
<select id="getData" resultType="com.makeit.module.iot.vo.analysis.AnalysisVO">
select * from device_minute_info where device_id = '1732647368962203650' order by created_time
select * from device_minute_info where device_id = '1765616197461037058' order by created_time
</select>
......
......@@ -117,6 +117,15 @@ iot:
sync:
enable: false
# 线上iot
#iot:
# url: https://iot.quanthium.com.cn/api/
# uploadUrl: https://saas.qa.insightica.cn/api/saas/device/devicePushLog
# clientId: SGtXMT3nXNjDrexH
# secureKey: SK48ztMZDMEs8FmaPHjGQGmQBA4CjrPt
# sync:
# enable: false
mqtt:
username: admin|1693982115969
password: 8e3795ef7b5e95869fa8c323b865b3a9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment