|
@@ -13,6 +13,7 @@ import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.iot.domain.*;
|
|
|
import com.usky.iot.mapper.BaseAlarmMapper;
|
|
|
+import com.usky.iot.mapper.DmpDeviceTypeMapper;
|
|
|
import com.usky.iot.service.*;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.iot.service.config.websocket.WebSocket;
|
|
@@ -29,6 +30,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -61,6 +63,9 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
@Autowired
|
|
|
private DmpDeviceStatusService dmpDeviceStatusService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DmpDeviceTypeMapper dmpDeviceTypeMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public CommonPage<BaseAlarmResponeVO> statistic(BaseAlarmRequestVO baseAlarmRequestVO){
|
|
|
|
|
@@ -204,6 +209,7 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
for(int j=0;j<deviceInfo.size();j++){
|
|
|
if(records.get(i).getDeviceId().equals(deviceInfo.get(j).getDeviceId())){
|
|
|
records.get(i).setDeviceName(deviceInfo.get(j).getDeviceName());
|
|
|
+ records.get(i).setDeviceType(deviceInfo.get(j).getDeviceType());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -246,8 +252,32 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
|
|
|
if(pageNum != null && pageSize >0){
|
|
|
current = (pageNum-1)*pageSize;
|
|
|
}
|
|
|
+ QueryWrapper<DmpDeviceType> queryWrapper5 = Wrappers.query();
|
|
|
+ queryWrapper5.eq("tenant_id",SecurityUtils.getTenantId());
|
|
|
+ List<DmpDeviceType> deviceTypeList = dmpDeviceTypeMapper.selectList(queryWrapper5);
|
|
|
List<BaseAlarm> info = list.stream().sorted(Comparator.comparing(BaseAlarm::getId,Comparator.reverseOrder())).skip(current).limit(pageSize).collect(Collectors.toList());
|
|
|
-
|
|
|
+ LocalDateTime toDateTime = LocalDateTime.now();
|
|
|
+ for(int l=0;l<info.size();l++){
|
|
|
+ LocalDateTime fromDateTime = info.get(l).getAlarmTime();
|
|
|
+ LocalDateTime tempDateTime = LocalDateTime.from( fromDateTime );
|
|
|
+ long days = tempDateTime.until( toDateTime, ChronoUnit.DAYS);
|
|
|
+ tempDateTime = tempDateTime.plusDays( days );
|
|
|
+ long hours = tempDateTime.until( toDateTime, ChronoUnit.HOURS);
|
|
|
+ tempDateTime = tempDateTime.plusHours( hours );
|
|
|
+ long minutes = tempDateTime.until( toDateTime, ChronoUnit.MINUTES);
|
|
|
+ tempDateTime = tempDateTime.plusMinutes( minutes );
|
|
|
+ long seconds = tempDateTime.until( toDateTime, ChronoUnit.SECONDS);
|
|
|
+ if (days>0){
|
|
|
+ info.get(l).setAlarmTime1(days+"天");
|
|
|
+ }else {
|
|
|
+ info.get(l).setAlarmTime1(hours+":"+minutes+":"+seconds);
|
|
|
+ }
|
|
|
+ for(int m=0;m<deviceTypeList.size();m++){
|
|
|
+ if(info.get(l).getDeviceType().equals(deviceTypeList.get(m).getTypeCode())){
|
|
|
+ info.get(l).setDeviceTypeName(deviceTypeList.get(m).getTypeName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return new CommonPage<BaseAlarm>(info,total,pageSize,pageNum);
|
|
|
|
|
|
}
|