Commit 4183b965 by 汪志阳

fix:睡眠时间计算

parent 97525de9
......@@ -12,7 +12,7 @@ import java.util.TreeMap;
* @description
* @createDate 2024-01-24-16:38
*/
public interface TestLogService {
public interface DeviceLogService {
void save(Map<String, List<DeviceInfoContentBreathe>> minuteMap);
......@@ -20,5 +20,5 @@ public interface TestLogService {
TreeMap<String, AnalysisVO> getData();
void fillDefaultData(TreeMap<String, AnalysisVO> statisticsMap);
void fillDefaultData(TreeMap<String, AnalysisVO> statisticsMap,Integer month, Integer day);
}
......@@ -9,7 +9,7 @@ import com.makeit.exception.BusinessException;
import com.makeit.mapper.platform.auth.PlatOrgMapper;
import com.makeit.module.iot.vo.analysis.AnalysisVO;
import com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe;
import com.makeit.service.platform.elder.TestLogService;
import com.makeit.service.platform.elder.DeviceLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
* @createDate 2024-01-24-16:38
*/
@Service
public class TestLogServiceImpl implements TestLogService {
public class DeviceLogServiceImpl implements DeviceLogService {
@Resource
private PlatOrgMapper platOrgMapper;
......@@ -80,7 +80,7 @@ public class TestLogServiceImpl implements TestLogService {
TreeMap<String, AnalysisVO> result = new TreeMap<>();
collect1.forEach(result::put);
getDayMinute().forEach(minute -> {
getDayMinute(1,10).forEach(minute -> {
boolean key = result.containsKey(minute);
if (!key) {
AnalysisVO analysisVO = buildDefaultData(minute);
......@@ -91,9 +91,9 @@ public class TestLogServiceImpl implements TestLogService {
}
public static List<String> getDayMinute() {
public static List<String> getDayMinute(Integer month, Integer day) {
List<String> list = Lists.newArrayList();
LocalDateTime now = LocalDateTime.of(2024, 1, 9, 8, 0);
LocalDateTime now = LocalDateTime.of(2024, month, day - 1, 8, 0);
for (int i = 0; i < 24; i++) {
int hour = now.getHour();
for (int j = 0; j < 60; j++) {
......@@ -107,8 +107,8 @@ public class TestLogServiceImpl implements TestLogService {
@Override
public void fillDefaultData(TreeMap<String, AnalysisVO> statisticsMap) {
List<String> dayMinute = getDayMinute();
public void fillDefaultData(TreeMap<String, AnalysisVO> statisticsMap, Integer month, Integer day) {
List<String> dayMinute = getDayMinute(month, day);
dayMinute.forEach(minute -> {
boolean key = statisticsMap.containsKey(minute);
if (!key) {
......
......@@ -57,8 +57,7 @@
</insert>
<select id="getData" resultType="com.makeit.module.iot.vo.analysis.AnalysisVO">
select * from device_minute_info where created_time >= '2024-01-09 23:40'
and created_time &lt; '2024-01-10 08:00' and device_id = '1732647368962203650' order by created_time
select * from device_minute_info where device_id = '1732647368962203650' order by created_time
</select>
......
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