Browse Source

修改首页月取值

wangb 1 year ago
parent
commit
130474b691

+ 58 - 36
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -3,13 +3,15 @@ package com.gyee.runeconomy.service.monitor;
 
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.DoubleUtils;
+import com.gyee.common.util.SortUtils;
 import com.gyee.runeconomy.dto.PowercurveVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.service.auto.IProBasicEquipmentPointService;
 import com.gyee.runeconomy.service.auto.IProBasicPowerstationPointService;
 import com.gyee.runeconomy.service.auto.IProBasicProjectPlanService;
-import com.gyee.runeconomy.util.DateUtils;
 import com.gyee.runeconomy.util.MathUtil;
 import com.gyee.runeconomy.util.StringUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
@@ -1377,17 +1379,22 @@ public class MonitorService {
         currentyear.add(Calendar.YEAR, 1);
         Date currentDate = currentyear.getTime();
 
-        Calendar twomonth = Calendar.getInstance();
-        twomonth.add(Calendar.MONTH, -2);
-        Date twoDatemonth = twomonth.getTime();
-
-        Calendar onemonth = Calendar.getInstance();
-        onemonth.add(Calendar.MONTH, -1);
-        Date oneDatemonth = onemonth.getTime();
-
-        Calendar currentmonth = Calendar.getInstance();
-        currentmonth.add(Calendar.MONTH, 1);
-        Date currentDatemonth = currentmonth.getTime();
+//        Calendar threemonth = Calendar.getInstance();
+//        threemonth.add(Calendar.MONTH, -3);
+//        Date threeDatemonth = threemonth.getTime();
+//
+//
+//        Calendar twomonth = Calendar.getInstance();
+//        twomonth.add(Calendar.MONTH, -2);
+//        Date twoDatemonth = twomonth.getTime();
+//
+//        Calendar onemonth = Calendar.getInstance();
+//        onemonth.add(Calendar.MONTH, -1);
+//        Date oneDatemonth = onemonth.getTime();
+//
+//        Calendar currentmonth = Calendar.getInstance();
+//        currentmonth.add(Calendar.MONTH, 1);
+//        Date currentDatemonth = currentmonth.getTime();
 
 
         double zjrl = 0.0;
@@ -1463,8 +1470,8 @@ public class MonitorService {
 
             List<String> year = new ArrayList<>();
             year.add(wtpointmap.get(ContantXk.NFDL).getNemCode());
-            List<String> month = new ArrayList<>();
-            month.add(wtpointmap.get(ContantXk.YFDL).getNemCode());
+
+            String month = wtpointmap.get(ContantXk.YFDL).getNemCode();
 
             if (timetype.contains("year")) {
 
@@ -1498,31 +1505,46 @@ public class MonitorService {
 
             if (timetype.contains("month")) {
 
-                List<PointData> currentls = edosUtil.getHistMatrix(month, currentDatemonth.getTime() / 1000);
-                List<PointData> onels = edosUtil.getHistMatrix(month, oneDatemonth.getTime() / 1000);
-                List<PointData> twols = edosUtil.getHistMatrix(month, twoDatemonth.getTime() / 1000);
-
-                List<PointData> sj = new ArrayList<>();
-                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
-                {
-                    sj.add(currentls.get(0));
-                    sj.add(onels.get(0));
-                    sj.add(twols.get(0));
-                }
-
+                int month1 = DateUtils.getMonth(new Date());///4
+                DateUtils.getMonthLast(new Date());//4.30
+                Date date = DateUtils.getCurrentDate();
 
-                double temp0 = 0;
-                double temp1 = 0;
-                double temp2 = 0;
+                for(int i = month1;i>0;i--){
 
-                if (!sj.isEmpty() && sj.size()==3) {
-                    temp0 = sj.get(0).getPointValueInDouble();
-                    temp1 = sj.get(1).getPointValueInDouble();
-                    temp2 = sj.get(2).getPointValueInDouble();
-                    vos.get(0).setYfdl(StringUtils.round(temp0 / zjrl, 2));
-                    vos.get(1).setYfdl(StringUtils.round(temp1 / zjrl, 2));
-                    vos.get(2).setYfdl(StringUtils.round(temp2 / zjrl, 2));
+                    PointData data = edosUtil.getSectionData(month, DateUtils.getEndOfDay(DateUtils.getMonthLast(date)).getTime());
+                    PowercurveVo vo = new PowercurveVo();
+                    vo.setYfdl(DoubleUtils.keepPrecision(data.getPointValueInDouble(),2));
+                    vo.setHours(i);
+                    vos.add(vo);
+                    date = DateUtils.addMonths(date,-1);
                 }
+                SortUtils.sort(vos,"hours",SortUtils.ASC);
+
+//                List<PointData> currentls = edosUtil.getHistMatrix(month, currentDatemonth.getTime() / 1000);
+//                List<PointData> onels = edosUtil.getHistMatrix(month, oneDatemonth.getTime() / 1000);
+//                List<PointData> twols = edosUtil.getHistMatrix(month, twoDatemonth.getTime() / 1000);
+
+//                List<PointData> sj = new ArrayList<>();
+//                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
+//                {
+//                    sj.add(currentls.get(0));
+//                    sj.add(onels.get(0));
+//                    sj.add(twols.get(0));
+//                }
+
+//
+//                double temp0 = 0;
+//                double temp1 = 0;
+//                double temp2 = 0;
+//
+//                if (!sj.isEmpty() && sj.size()==3) {
+//                    temp0 = sj.get(0).getPointValueInDouble();
+//                    temp1 = sj.get(1).getPointValueInDouble();
+//                    temp2 = sj.get(2).getPointValueInDouble();
+//                    vos.get(0).setYfdl(StringUtils.round(temp0 / zjrl, 2));
+//                    vos.get(1).setYfdl(StringUtils.round(temp1 / zjrl, 2));
+//                    vos.get(2).setYfdl(StringUtils.round(temp2 / zjrl, 2));
+//                }
 
             }
         }