|
@@ -2,8 +2,6 @@ package com.bizmatics.service.impl;
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
-import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
-import cn.afterturn.easypoi.handler.inter.IExcelExportServer;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.bizmatics.common.core.bean.CommonPage;
|
|
|
import com.bizmatics.common.core.exception.BusinessException;
|
|
@@ -19,21 +17,18 @@ import com.bizmatics.service.util.SessionLocal;
|
|
|
import com.bizmatics.service.vo.AlarmPowerExportVO;
|
|
|
import com.bizmatics.service.vo.ApCountVO;
|
|
|
import com.bizmatics.service.vo.CommonIcoVO;
|
|
|
-import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
+import jdk.nashorn.internal.ir.LiteralNode;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
-import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.util.unit.DataUnit;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.Duration;
|
|
|
import java.util.*;
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -174,6 +169,7 @@ public class AlarmPowerServiceImpl extends AbstractCrudService<AlarmPowerMapper,
|
|
|
List<Object> offDateS = new ArrayList<>();
|
|
|
List<Object> runStatus = new ArrayList<>();
|
|
|
List<Object> runDates = new ArrayList<>();
|
|
|
+ long offTime = 0;
|
|
|
List<AlarmPower> alarmPowers = baseMapper.list(userId, siteId, null, startTime, endTime, "LoadLive", null);
|
|
|
if (!CollectionUtils.isEmpty(list)){
|
|
|
Date forEndTime;
|
|
@@ -184,14 +180,30 @@ public class AlarmPowerServiceImpl extends AbstractCrudService<AlarmPowerMapper,
|
|
|
forEndTime = dayEndTime;
|
|
|
offDateS.add(DateUtils.format(endTime,DateUtils.PARSE_PATTERNS[8]));
|
|
|
} while (forEndTime.before(endTime));
|
|
|
-
|
|
|
- alarmPowers.forEach(alarmPower -> {
|
|
|
- runStatus.add(alarmPower.getDigitalValue());
|
|
|
- runDates.add(DateUtils.format(alarmPower.getSendingTime(),DateUtils.PARSE_PATTERNS[5]));
|
|
|
- });
|
|
|
+ //上次off时间
|
|
|
+ long offStartTime = 0;
|
|
|
+ //off状态
|
|
|
+ Integer flag = null;
|
|
|
+ for (AlarmPower alarmPower:alarmPowers) {
|
|
|
+ Integer digitalValue = alarmPower.getDigitalValue();
|
|
|
+ Date sendingTime = alarmPower.getSendingTime();
|
|
|
+ runStatus.add(digitalValue);
|
|
|
+ runDates.add(DateUtils.format(sendingTime,DateUtils.PARSE_PATTERNS[5]));
|
|
|
+ if (1 == digitalValue){
|
|
|
+ if (null == flag || 0 == flag){
|
|
|
+ offStartTime = sendingTime.getTime();
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (null != flag && 1 == flag){
|
|
|
+ offTime+=sendingTime.getTime()-offStartTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ flag = alarmPower.getDigitalValue();
|
|
|
+ }
|
|
|
}
|
|
|
list.add(CommonIcoVO.builder().name("offCount").list(offCounts).listDate(offDateS).build());
|
|
|
list.add(CommonIcoVO.builder().name("runStates").list(runStatus).listDate(runDates).build());
|
|
|
+ list.add(CommonIcoVO.builder().name("offTime").list(offTime).build());
|
|
|
return list;
|
|
|
}
|
|
|
|