|
@@ -17,9 +17,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 【风-光-火-高载能 日前明细表】Controller
|
|
@@ -46,6 +47,40 @@ public class MengxiVppDayAheadPlanDataController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查询【首页储能曲线】
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('client:data:list')")
|
|
|
+ @GetMapping("/echarts")
|
|
|
+ public Map<String, Object> echarts(MengxiVppDayAheadPlanData mengxiVppDayAheadPlanData) {
|
|
|
+ LambdaQueryWrapper<MengxiVppDayAheadPlanData> queryWrapper = this.buildQueryWrapper(mengxiVppDayAheadPlanData);
|
|
|
+ List<MengxiVppDayAheadPlanData> list = iMengxiVppDayAheadPlanDataService.list(queryWrapper);
|
|
|
+ list.sort((u4, u5) -> {
|
|
|
+ Long age1 = u4.getTime().getTime();
|
|
|
+ Long age2 = u5.getTime().getTime();
|
|
|
+ return age1.compareTo(age2);
|
|
|
+ });
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Set<String> settime = new HashSet<>();
|
|
|
+ List<String> plan = new ArrayList<>();
|
|
|
+ for (MengxiVppDayAheadPlanData m : list) {
|
|
|
+ settime.add(simpleDateFormat.format(new Date(m.getTime().getTime())));
|
|
|
+ }
|
|
|
+ List<String> times = new ArrayList<>(settime);
|
|
|
+ // 对List进行排序
|
|
|
+ Collections.sort(times);
|
|
|
+ for (String t : times) {
|
|
|
+ // 求和
|
|
|
+ List<MengxiVppDayAheadPlanData> filterList = list.stream().filter(n -> simpleDateFormat.format(n.getTime()).equals(t)).collect(Collectors.toList());
|
|
|
+ BigDecimal sum = filterList.stream().map(s -> new BigDecimal(s.getPlan().longValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ plan.add(sum.toString());
|
|
|
+ }
|
|
|
+ map.put("times", times);
|
|
|
+ map.put("plan", plan);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 导出【风-光-火-高载能 日前明细表】列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('client:data:export')")
|