|
@@ -0,0 +1,143 @@
|
|
|
+package com.gyee.gaia.meter.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.gaia.meter.entity.PowerStation;
|
|
|
+import com.gyee.gaia.meter.entity.vo.MeterInfoVo;
|
|
|
+import com.gyee.gaia.meter.entity.vo.Result;
|
|
|
+import com.gyee.gaia.meter.service.impl.PowerStationServiceImpl;
|
|
|
+import com.gyee.gaia.meter.service.meterInfo.GetMeterInfo;
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Author: malijun
|
|
|
+ * Data : 2023: 05: 24
|
|
|
+ **/
|
|
|
+@RestController
|
|
|
+@CrossOrigin(origins = "*")
|
|
|
+public class MeterInfoController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ GetMeterInfo getMeterInfo;
|
|
|
+ @Resource
|
|
|
+ PowerStationServiceImpl powerStationService;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/meter/infoall")
|
|
|
+ public Result<Object> getPowerstation() {
|
|
|
+ List<PowerStation> powerStations = powerStationService.list(new QueryWrapper<PowerStation>().eq("wind_type", "-1"));
|
|
|
+
|
|
|
+ ArrayList<MeterInfoVo> meterInfoVos = new ArrayList<>();
|
|
|
+ for (PowerStation powerStation: powerStations ) {
|
|
|
+ MeterInfoVo meterInfoVo = new MeterInfoVo();
|
|
|
+ meterInfoVo.setName(powerStation.getName());
|
|
|
+ meterInfoVo.setNemCode(powerStation.getNemCode());
|
|
|
+ meterInfoVos.add(meterInfoVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> response = new HashMap<>();
|
|
|
+ response.put("fdc", meterInfoVos);
|
|
|
+
|
|
|
+ return new Result<>(200, "成功", response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/meterinfo/bottom")
|
|
|
+ public Result<Object> getBottomInfo(
|
|
|
+ @RequestParam(required = false) String windId,
|
|
|
+ @RequestParam(required = false) long startTime,
|
|
|
+ @RequestParam(required = false) long endTime,
|
|
|
+ @RequestParam(defaultValue = "1") int page,
|
|
|
+ @RequestParam(defaultValue = "25") int perPage
|
|
|
+ ) {
|
|
|
+ ArrayList<MeterInfoVo> meterInfoByWindIdList = getMeterInfo.getBottomInfoByWindId(windId, startTime, endTime);
|
|
|
+ // 进行分页处理
|
|
|
+ int totalItems = meterInfoByWindIdList.size();
|
|
|
+ int startIndex = (page - 1) * perPage;
|
|
|
+ int endIndex = Math.min(startIndex + perPage, totalItems);
|
|
|
+
|
|
|
+ List<MeterInfoVo> paginatedList = meterInfoByWindIdList.subList(startIndex, endIndex);
|
|
|
+
|
|
|
+ // 构建响应
|
|
|
+ Map<String, Object> response = new HashMap<>();
|
|
|
+ response.put("bottom", paginatedList);
|
|
|
+ response.put("totalItems", totalItems);
|
|
|
+ response.put("page", page);
|
|
|
+ response.put("perPage", perPage);
|
|
|
+ return new Result<>(200, "成功", response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/meterinfo/equipment")
|
|
|
+ public Result<Object> getEquipmentInfo(
|
|
|
+ @RequestParam(required = false) String windId,
|
|
|
+ @RequestParam(required = false) String startTime,
|
|
|
+ @RequestParam(required = false) String endTime,
|
|
|
+ @RequestParam(defaultValue = "1") int page,
|
|
|
+ @RequestParam(defaultValue = "25") int perPage
|
|
|
+ ) {
|
|
|
+ ArrayList<MeterInfoVo> meterInfoByWindIdList = getMeterInfo.getEquipmentInfoByWindId(windId, startTime, endTime);
|
|
|
+
|
|
|
+ // 进行排序
|
|
|
+ meterInfoByWindIdList.sort(Comparator.comparing(MeterInfoVo::getName));
|
|
|
+
|
|
|
+ // 进行分页处理
|
|
|
+ int totalItems = meterInfoByWindIdList.size();
|
|
|
+ int startIndex = (page - 1) * perPage;
|
|
|
+ int endIndex = Math.min(startIndex + perPage, totalItems);
|
|
|
+
|
|
|
+ List<MeterInfoVo> paginatedList = meterInfoByWindIdList.subList(startIndex, endIndex);
|
|
|
+
|
|
|
+ // 构建响应
|
|
|
+ Map<String, Object> response = new HashMap<>();
|
|
|
+ response.put("equipment", paginatedList);
|
|
|
+ response.put("totalItems", totalItems);
|
|
|
+ response.put("page", page);
|
|
|
+ response.put("perPage", perPage);
|
|
|
+ return new Result<>(200, "成功", response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/meterinfo/calculating")
|
|
|
+ public Result<Object> getCalculatingInfo(
|
|
|
+ @RequestParam(required = false) String windId,
|
|
|
+ @RequestParam(required = false) String startTime,
|
|
|
+ @RequestParam(required = false) String endTime,
|
|
|
+ @RequestParam(defaultValue = "1") int page,
|
|
|
+ @RequestParam(defaultValue = "25") int perPage
|
|
|
+ ) {
|
|
|
+ ArrayList<MeterInfoVo> meterInfoByWindIdList = getMeterInfo.getCalculatingInfoByWindId(windId, startTime, endTime);
|
|
|
+
|
|
|
+ // 进行排序
|
|
|
+ meterInfoByWindIdList.sort(Comparator.comparing(MeterInfoVo::getName));
|
|
|
+
|
|
|
+ // 进行分页处理
|
|
|
+ int totalItems = meterInfoByWindIdList.size();
|
|
|
+ int startIndex = (page - 1) * perPage;
|
|
|
+ int endIndex = Math.min(startIndex + perPage, totalItems);
|
|
|
+
|
|
|
+ List<MeterInfoVo> paginatedList = meterInfoByWindIdList.subList(startIndex, endIndex);
|
|
|
+
|
|
|
+ // 构建响应
|
|
|
+ Map<String, Object> response = new HashMap<>();
|
|
|
+ response.put("calculating", paginatedList);
|
|
|
+ response.put("totalItems", totalItems);
|
|
|
+ response.put("page", page);
|
|
|
+ response.put("perPage", perPage);
|
|
|
+ return new Result<>(200, "成功", response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|