添加暂态事件id

This commit is contained in:
wr
2023-05-17 20:16:59 +08:00
parent c7b6d4022c
commit b4938a8345
7 changed files with 50 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
@@ -172,16 +173,30 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
List<String> updateTime = new ArrayList<>();
List<Integer> comType = new ArrayList<>();
//开始时间
if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){
Boolean beginFly =false;
if(CollUtil.isNotEmpty(communicateList)){
if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){
beginFly =true;
}
}else{
beginFly =true;
}
if(beginFly){
Instant instant = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant();
Long time = instant.toEpochMilli();
String timeText = df.format(time);
updateTime.add(timeText);
if(communicateList.get(0).getType()==0){
comType.add(1);
if(CollUtil.isNotEmpty(communicateList)){
if(communicateList.get(0).getType()==0){
comType.add(1);
}else{
comType.add(0);
}
}else{
comType.add(0);
comType.add(1);
}
}
for (Communicate communicate : communicateList) {
//转化时间
@@ -197,11 +212,23 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
String format = times.format(date);
Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant();
if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){
Boolean endFly =false;
if(CollUtil.isNotEmpty(communicateList)){
if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){
endFly =true;
}
}else{
endFly =true;
}
if(endFly){
Long time = endTime.toEpochMilli();
String timeText = df.format(time);
updateTime.add(timeText);
comType.add(communicateList.get(communicateList.size()-1).getType());
if(CollUtil.isNotEmpty(communicateList)){
comType.add(communicateList.get(communicateList.size()-1).getType());
}else{
comType.add(1);
}
}
communicateVOList.setUpdateTime(updateTime);
communicateVOList.setType(comType);