|
@@ -0,0 +1,52 @@
|
|
|
+package com.cpp.web.controller.largeScreen;
|
|
|
+
|
|
|
+import com.cpp.common.core.domain.R;
|
|
|
+import com.cpp.web.domain.station.PowerStationStatusData;
|
|
|
+import com.cpp.web.service.station.PowerStationStatusDataService;
|
|
|
+import com.cpp.web.utils.DateTimeUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 大屏模块
|
|
|
+ *
|
|
|
+ * @author whc
|
|
|
+ * @date 2022-03-18 15:49:14
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RequestMapping("/largeScreenController")
|
|
|
+public class LargeScreenController {
|
|
|
+ @Autowired
|
|
|
+ PowerStationStatusDataService powerStationStatusDataService;
|
|
|
+
|
|
|
+ @GetMapping("/getBizData")
|
|
|
+ public R getBizData() {
|
|
|
+ Map bizDataMap = new HashMap();
|
|
|
+ // 获取首页实际功率、可用、理论
|
|
|
+ Date powerStationTime = DateTimeUtil.getMomentTimeFor5Minute(System.currentTimeMillis());
|
|
|
+ List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataService.findByTimeBetween(powerStationTime,powerStationTime);
|
|
|
+ BigDecimal realSum = BigDecimal.ZERO;
|
|
|
+ BigDecimal ableSum = BigDecimal.ZERO;
|
|
|
+ BigDecimal theorySum = BigDecimal.ZERO;
|
|
|
+ for (PowerStationStatusData powerStationStatusData: powerStationStatusDataList){
|
|
|
+ realSum = realSum.add(powerStationStatusData.getRealValue());
|
|
|
+ ableSum = ableSum.add(powerStationStatusData.getAbleValue());
|
|
|
+ theorySum = theorySum.add(powerStationStatusData.getTheoryValue());
|
|
|
+ }
|
|
|
+ Map powerStationSumMap = new HashMap();
|
|
|
+ powerStationSumMap.put("realSum",realSum);
|
|
|
+ powerStationSumMap.put("ableSum",ableSum);
|
|
|
+ powerStationSumMap.put("theorySum",theorySum);
|
|
|
+ bizDataMap.put("powerStationSumMap",powerStationSumMap);
|
|
|
+ return R.ok(bizDataMap);
|
|
|
+ }
|
|
|
+}
|