|
@@ -2,11 +2,16 @@ package com.gyee.runeconomy.service.agc;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gyee.runeconomy.config.GyeeConfig;
|
|
|
import com.gyee.runeconomy.controller.agc.AgcDeviateTag;
|
|
|
import com.gyee.runeconomy.controller.agc.AiPoints;
|
|
|
import com.gyee.runeconomy.controller.agc.FileService;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
|
+import com.gyee.runeconomy.model.PowerLosses;
|
|
|
+import com.gyee.runeconomy.model.PowerLossesDTO;
|
|
|
+import com.gyee.runeconomy.service.PowerLossesService;
|
|
|
import com.gyee.runeconomy.util.realtimesource.feign.IDataAdapter;
|
|
|
import com.gyee.runeconomy.util.realtimesource.feign.RemoteServiceBuilder;
|
|
|
import com.gyee.runeconomy.util.realtimesource.feign.TsDoubleTsData;
|
|
@@ -17,6 +22,11 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.time.Instant;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -57,7 +67,8 @@ public class AgcDeviateService {
|
|
|
private IDataAdapter iDataAdapter;
|
|
|
@Autowired
|
|
|
private RemoteServiceBuilder remoteService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private PowerLossesService powerLossService;
|
|
|
|
|
|
* 获取agc曲线偏差分析需要的数据
|
|
|
*
|
|
@@ -247,4 +258,52 @@ public class AgcDeviateService {
|
|
|
return fileService.getFromFile(ls.get(ran), new TypeReference<List<AgcDeviateTag>>() {
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 限电时间列表
|
|
|
+ * @param startTs
|
|
|
+ * @param endTs
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<PowerLossesDTO> getAgcxd(long startTs, long endTs,int pageNum, int pageSize) {
|
|
|
+
|
|
|
+
|
|
|
+ LocalDateTime startDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(startTs), ZoneId.systemDefault());
|
|
|
+ LocalDateTime endDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(endTs), ZoneId.systemDefault());
|
|
|
+ Page<PowerLosses> page = new Page<>(pageNum, pageSize);
|
|
|
+ IPage<PowerLosses> list = powerLossService.pageList(page, startDateTime, endDateTime);
|
|
|
+ list.setTotal(list.getRecords().size());
|
|
|
+ List<PowerLosses> List = list.getRecords();
|
|
|
+ List<PowerLossesDTO> dtos = new ArrayList<>();
|
|
|
+
|
|
|
+ DecimalFormat df = new DecimalFormat("0.0000000");
|
|
|
+
|
|
|
+ for (PowerLosses pl : List) {
|
|
|
+ PowerLossesDTO dto = new PowerLossesDTO();
|
|
|
+ dto.setId(pl.getId());
|
|
|
+
|
|
|
+
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
+ dto.setStartTime(pl.getStartTime().format(formatter));
|
|
|
+ dto.setEndTime(pl.getEndTime().format(formatter));
|
|
|
+
|
|
|
+ try {
|
|
|
+ double xddl = Double.parseDouble(pl.getXdss());
|
|
|
+ double xddlDivided = xddl / 10000;
|
|
|
+ String xd = df.format(xddlDivided);
|
|
|
+ dto.setXdss(xd);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+
|
|
|
+ dto.setXdss("0.0000000");
|
|
|
+ }
|
|
|
+
|
|
|
+ dto.setRecordDate(pl.getRecordDate());
|
|
|
+ dtos.add(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
}
|