浏览代码

bug修复

wangb 1 月之前
父节点
当前提交
704d785d69

+ 22 - 8
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -1570,13 +1570,27 @@ public class EconomyPointHomePageService {
     }
     }
 
 
 
 
-    public Map<String, Object> getHomeRight(String companyId) {
+    public Map<String, Object> getHomeRight(String companyId, String periodType) {
         Map<String, Object> allmap = new HashMap<>();
         Map<String, Object> allmap = new HashMap<>();
         Map<String, Object> sbklyl = new HashMap<>();
         Map<String, Object> sbklyl = new HashMap<>();
-        LocalDate nowStart = LocalDate.now().with(TemporalAdjusters.firstDayOfYear());
+        LocalDate nowStart = null;
         LocalDate nowEnd = LocalDate.now();
         LocalDate nowEnd = LocalDate.now();
-        LocalDate lastYearStartDate = LocalDate.now().minusYears(1).with(TemporalAdjusters.firstDayOfYear());
-        LocalDate lastYearEndDate = LocalDate.now().minusYears(1).atStartOfDay().toLocalDate();
+        LocalDate lastYearStartDate = null;
+        LocalDate lastYearEndDate = null;
+        if ("year".equals(periodType)) {
+            nowStart = nowEnd.with(TemporalAdjusters.firstDayOfYear());
+            lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfYear());
+            lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
+        } else if ("month".equals(periodType)) {
+            nowStart = nowEnd.with(TemporalAdjusters.firstDayOfMonth());
+            lastYearStartDate = nowEnd.minusYears(1).with(TemporalAdjusters.firstDayOfMonth());
+            lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
+        } else if ("week".equals(periodType)) {
+            nowStart = nowEnd.with(DayOfWeek.MONDAY);
+            lastYearStartDate = nowEnd.minusYears(1).with(DayOfWeek.MONDAY);
+            lastYearEndDate = nowEnd.minusYears(1).atStartOfDay().toLocalDate();
+        }
+
 
 
         Map<String, Object> zbtqdb = new HashMap<>();
         Map<String, Object> zbtqdb = new HashMap<>();
         String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
         String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
@@ -2000,13 +2014,13 @@ public class EconomyPointHomePageService {
 
 
         List<ComparetqVo> ls2 = new ArrayList<>();
         List<ComparetqVo> ls2 = new ArrayList<>();
         ComparetqVo cv = new ComparetqVo();
         ComparetqVo cv = new ComparetqVo();
-        cv.setWtId("发电量");
+        cv.setWtId("发电量");
         ComparetqVo cv1 = new ComparetqVo();
         ComparetqVo cv1 = new ComparetqVo();
-        cv1.setWtId("上网电量");
+        cv1.setWtId("上网电量");
         ComparetqVo cv2 = new ComparetqVo();
         ComparetqVo cv2 = new ComparetqVo();
-        cv2.setWtId("购网电量");
+        cv2.setWtId("购网电量");
         ComparetqVo cv4 = new ComparetqVo();
         ComparetqVo cv4 = new ComparetqVo();
-        cv4.setWtId("厂用电量");
+        cv4.setWtId("厂用电量");
         cv.setRecodedate(generatingCapacity15min.get("年发电量").getValue());
         cv.setRecodedate(generatingCapacity15min.get("年发电量").getValue());
 
 
         if (null == day2s || day2s.isEmpty()) {
         if (null == day2s || day2s.isEmpty()) {