|
@@ -8,17 +8,22 @@ import com.gyee.runeconomy.dto.response.EconHomePagePointRateDTO;
|
|
|
import com.gyee.runeconomy.dto.response.ProEconPointCodeDTO;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
|
import com.gyee.runeconomy.model.auto.*;
|
|
|
-import com.gyee.runeconomy.model.vo.ColumnVo;
|
|
|
-import com.gyee.runeconomy.model.vo.ComparetqVo;
|
|
|
-import com.gyee.runeconomy.model.vo.GeneratingCapacityVo;
|
|
|
+import com.gyee.runeconomy.model.vo.*;
|
|
|
import com.gyee.runeconomy.service.auto.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.Month;
|
|
|
+import java.time.ZoneOffset;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -55,6 +60,14 @@ public class EconomyPointHomePageService {
|
|
|
@Autowired
|
|
|
private IProEconPointCodeService proEconPointCodeService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IProEconPowerstationInfoDay2Service iProEconPowerstationInfoDay2Service;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicProjectPlanService iProBasicProjectPlanService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 指标率相应类
|
|
|
*/
|
|
@@ -159,7 +172,7 @@ public class EconomyPointHomePageService {
|
|
|
cl2.setName(String.valueOf(LocalDate.now().getYear()));
|
|
|
cl2.setField("recodedate");
|
|
|
ColumnVo cl3 = new ColumnVo();
|
|
|
- cl3.setName(String.valueOf(LocalDate.now().getYear()-1));
|
|
|
+ cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
|
|
|
cl3.setField("recodedate2");
|
|
|
ColumnVo cl4 = new ColumnVo();
|
|
|
cl4.setName("涨跌%");
|
|
@@ -172,7 +185,6 @@ public class EconomyPointHomePageService {
|
|
|
List<ColumnVo> ls2 = new ArrayList<>();
|
|
|
|
|
|
|
|
|
-
|
|
|
zbtqdb.put("column", ls1);
|
|
|
zbtqdb.put("data", ls2);
|
|
|
allmap.put("fdl", ls);
|
|
@@ -1554,7 +1566,8 @@ public class EconomyPointHomePageService {
|
|
|
rfdl.setTotal(day1.getRllfdl());
|
|
|
BigDecimal rbfb = (day1.getRfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getRllfdl().compareTo(BigDecimal.ZERO) == 0)
|
|
|
? BigDecimal.ZERO
|
|
|
- : day1.getRllfdl().divide(day1.getRfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
|
|
|
+ : day1.getRllfdl().divide(day1.getRfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ rfdl.setBfb(rbfb);
|
|
|
rfdl.setBfb(rbfb);
|
|
|
ls.add(rfdl);
|
|
|
|
|
@@ -1564,17 +1577,19 @@ public class EconomyPointHomePageService {
|
|
|
yfdl.setTotal(day1.getYllfdl());
|
|
|
BigDecimal ybfb = (day1.getYfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getYllfdl().compareTo(BigDecimal.ZERO) == 0)
|
|
|
? BigDecimal.ZERO
|
|
|
- : day1.getYllfdl().divide(day1.getYfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
|
|
|
+ : day1.getYllfdl().divide(day1.getYfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ rfdl.setBfb(rbfb);
|
|
|
yfdl.setBfb(ybfb);
|
|
|
ls.add(yfdl);
|
|
|
|
|
|
GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
|
|
|
nfdl.setName("年发电量");
|
|
|
- nfdl.setValue(day1.getNfdl());
|
|
|
- nfdl.setTotal(day1.getNllfdl());
|
|
|
+ nfdl.setValue(day1.getNfdl().divide(new BigDecimal(1000)));
|
|
|
+ nfdl.setTotal(day1.getNllfdl().divide(new BigDecimal(1000)));
|
|
|
BigDecimal nbfb = (day1.getNfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getNllfdl().compareTo(BigDecimal.ZERO) == 0)
|
|
|
? BigDecimal.ZERO
|
|
|
- : day1.getNllfdl().divide(day1.getNfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));rfdl.setBfb(rbfb);
|
|
|
+ : day1.getNllfdl().divide(day1.getNfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ rfdl.setBfb(rbfb);
|
|
|
nfdl.setBfb(nbfb);
|
|
|
ls.add(nfdl);
|
|
|
|
|
@@ -1587,7 +1602,7 @@ public class EconomyPointHomePageService {
|
|
|
cl2.setName(String.valueOf(LocalDate.now().getYear()));
|
|
|
cl2.setField("recodedate");
|
|
|
ColumnVo cl3 = new ColumnVo();
|
|
|
- cl3.setName(String.valueOf(LocalDate.now().getYear()-1));
|
|
|
+ cl3.setName(String.valueOf(LocalDate.now().getYear() - 1));
|
|
|
cl3.setField("recodedate2");
|
|
|
ColumnVo cl4 = new ColumnVo();
|
|
|
cl4.setName("涨跌%");
|
|
@@ -1599,11 +1614,35 @@ public class EconomyPointHomePageService {
|
|
|
|
|
|
List<ComparetqVo> ls2 = new ArrayList<>();
|
|
|
ComparetqVo cv = new ComparetqVo();
|
|
|
- cv.setWtId("风电发电量");
|
|
|
- cv.setRecodedate(String.valueOf(day1.getNfdl()));
|
|
|
+ cv.setWtId("发电量");
|
|
|
+ cv.setRecodedate(String.valueOf(day1.getNfdl().divide(new BigDecimal(1000))));
|
|
|
cv.setRecodedate2(String.valueOf(0));
|
|
|
cv.setOperation("100");
|
|
|
+ ComparetqVo cv1 = new ComparetqVo();
|
|
|
+ cv1.setWtId("上网电量");
|
|
|
+ cv1.setRecodedate(String.valueOf(0.00));
|
|
|
+ cv1.setRecodedate2(String.valueOf(0));
|
|
|
+ cv1.setOperation("0");
|
|
|
+ ComparetqVo cv2 = new ComparetqVo();
|
|
|
+ cv2.setWtId("网购电量");
|
|
|
+ cv2.setRecodedate(String.valueOf(0.00));
|
|
|
+ cv2.setRecodedate2(String.valueOf(0));
|
|
|
+ cv2.setOperation("0");
|
|
|
+ ComparetqVo cv3 = new ComparetqVo();
|
|
|
+ cv3.setWtId("损失电量");
|
|
|
+ cv3.setRecodedate(String.valueOf(0.00));
|
|
|
+ cv3.setRecodedate2(String.valueOf(0));
|
|
|
+ cv3.setOperation("0");
|
|
|
+ ComparetqVo cv4 = new ComparetqVo();
|
|
|
+ cv4.setWtId("场用电量");
|
|
|
+ cv4.setRecodedate(String.valueOf(0.00));
|
|
|
+ cv4.setRecodedate2(String.valueOf(0));
|
|
|
+ cv4.setOperation("0");
|
|
|
ls2.add(cv);
|
|
|
+ ls2.add(cv1);
|
|
|
+ ls2.add(cv2);
|
|
|
+ ls2.add(cv3);
|
|
|
+ ls2.add(cv4);
|
|
|
|
|
|
zbtqdb.put("column", ls1);
|
|
|
zbtqdb.put("data", ls2);
|
|
@@ -1611,8 +1650,311 @@ public class EconomyPointHomePageService {
|
|
|
allmap.put("zbtqdb", zbtqdb);
|
|
|
}
|
|
|
|
|
|
+ return allmap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, Object> getHomeRight(String companyId) {
|
|
|
+ Map<String, Object> allmap = new HashMap<>();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ Date currentDate = DateUtils.getCurrentDate();
|
|
|
+ Date monthFirst = DateUtils.getMonthFirst(currentDate);
|
|
|
+ double hoursDiff = DateUtils.hoursDiff2(currentDate, monthFirst);
|
|
|
+ QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, now)
|
|
|
+ .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
|
|
|
+ Map<String, Object> sbklyl = new HashMap<>();
|
|
|
+ for (ProEconPowerstationInfoDay1 day1 : day1s) {
|
|
|
+ Map<String, Object> zbtqdb = new HashMap<>();
|
|
|
+ String[] title = {"排名", "名称", "风能利用率%", "去年同期%", "涨跌%"};
|
|
|
+ List<ColumnVo> ls1 = getTitle(title);
|
|
|
+ String[] title2 = {"排名", "名称", "设备利用率%", "去年同期%", "涨跌%"};
|
|
|
+ List<ColumnVo> ls3 = getTitle(title2);
|
|
|
+ List<HomeRightVo> ls2 = new ArrayList<>();
|
|
|
+ HomeRightVo hv = new HomeRightVo();
|
|
|
+ hv.setIndex("1");
|
|
|
+ hv.setName("惠安风场");
|
|
|
+ BigDecimal fnlyl = (day1.getNfdl().compareTo(BigDecimal.ZERO) == 0 || day1.getNllfdl().compareTo(BigDecimal.ZERO) == 0)
|
|
|
+ ? BigDecimal.ZERO
|
|
|
+ : day1.getNfdl().divide(day1.getNllfdl(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ hv.setFnlyl(String.valueOf(fnlyl));
|
|
|
+ hv.setYearTq("0");
|
|
|
+ hv.setOperation(String.valueOf(fnlyl));
|
|
|
+ ls2.add(hv);
|
|
|
+
|
|
|
+ zbtqdb.put("column", ls1);
|
|
|
+ zbtqdb.put("data", ls2);
|
|
|
+ sbklyl.put("column", ls3);
|
|
|
+ allmap.put("fnlyl", zbtqdb);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<ProEconPowerstationInfoDay2> qw2 = new QueryWrapper<>();
|
|
|
+ qw2.lambda().eq(ProEconPowerstationInfoDay2::getRecordDate, now)
|
|
|
+ .eq(ProEconPowerstationInfoDay2::getForeignKeyId, companyId);
|
|
|
+ List<ProEconPowerstationInfoDay2> list = iProEconPowerstationInfoDay2Service.list(qw2);
|
|
|
+ for (ProEconPowerstationInfoDay2 day2 : list) {
|
|
|
+ List<HomeRightVo> ls3 = new ArrayList<>();
|
|
|
+ HomeRightVo hv2 = new HomeRightVo();
|
|
|
+ hv2.setIndex("1");
|
|
|
+ hv2.setName("惠安风场");
|
|
|
+ BigDecimal hoursDiffDecimal = BigDecimal.valueOf(hoursDiff);
|
|
|
+ BigDecimal result = hoursDiffDecimal.subtract(day2.getNhjgztjxs()).subtract(day2.getNhjjxtjxs());
|
|
|
+ BigDecimal ysbklyl = result.divide(hoursDiffDecimal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
|
|
+ hv2.setFnlyl(String.valueOf(ysbklyl));
|
|
|
+ hv2.setYearTq("0");
|
|
|
+ hv2.setOperation(String.valueOf(ysbklyl));
|
|
|
+ ls3.add(hv2);
|
|
|
+ sbklyl.put("data", ls3);
|
|
|
+ allmap.put("sbklyl", sbklyl);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> lgxzkh = new HashMap<>();
|
|
|
+ String[] title = {"排名", "名称", "考核分数", "去年同期%", "涨跌%"};
|
|
|
+ List<ColumnVo> ls1 = getTitle(title);
|
|
|
+ List<HomeRightVo> ls2 = new ArrayList<>();
|
|
|
+ HomeRightVo hv = new HomeRightVo();
|
|
|
+ hv.setIndex("1");
|
|
|
+ hv.setName("惠安风场");
|
|
|
+ hv.setFnlyl("98");
|
|
|
+ hv.setYearTq("0");
|
|
|
+ hv.setOperation("100");
|
|
|
+ ls2.add(hv);
|
|
|
+
|
|
|
+ lgxzkh.put("column", ls1);
|
|
|
+ lgxzkh.put("data", ls2);
|
|
|
+ allmap.put("lgxzkh", lgxzkh);
|
|
|
+
|
|
|
+ return allmap;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<ColumnVo> getTitle(String[] title) {
|
|
|
+ List<ColumnVo> ls1 = new ArrayList<>();
|
|
|
+ ColumnVo cl1 = new ColumnVo(title[0], "index");
|
|
|
+ ColumnVo cl2 = new ColumnVo(title[1], "name");
|
|
|
+ ColumnVo cl3 = new ColumnVo(title[2], "fnlyl");
|
|
|
+ ColumnVo cl4 = new ColumnVo(title[3], "yearTq");
|
|
|
+ ColumnVo cl5 = new ColumnVo(title[4], "operation");
|
|
|
+ ls1.add(cl1);
|
|
|
+ ls1.add(cl2);
|
|
|
+ ls1.add(cl3);
|
|
|
+ ls1.add(cl4);
|
|
|
+ ls1.add(cl5);
|
|
|
+ return ls1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ Integer month = LocalDate.now().getMonthValue();
|
|
|
+ int year = LocalDate.now().getYear();
|
|
|
+ Map<String, Object> allmap = new HashMap<>();
|
|
|
+ PlanDataVo pd = new PlanDataVo();
|
|
|
+ List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
|
|
|
+
|
|
|
+ QueryWrapper<ProEconPowerstationInfoDay1> qw1 = new QueryWrapper<>();
|
|
|
+ qw1.lambda().eq(ProEconPowerstationInfoDay1::getRecordDate, currentDate)
|
|
|
+ .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
|
|
|
+ List<ProEconPowerstationInfoDay1> days1 = proEconPowerstationInfoDay1Service.list(qw1);
|
|
|
+
|
|
|
+ LocalDate startOfWeek = currentDate.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));// 本周周一日期
|
|
|
+ LocalDate endOfWeek = currentDate.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
|
|
|
+ QueryWrapper<ProEconPowerstationInfoDay1> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().between(ProEconPowerstationInfoDay1::getRecordDate, startOfWeek, endOfWeek)
|
|
|
+ .eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s = proEconPowerstationInfoDay1Service.list(qw);
|
|
|
+ if (null == day1s || day1s.isEmpty()) {
|
|
|
+ pd.setZfdlsj(0.00);
|
|
|
+ pd.setYfdlsj(0.00);
|
|
|
+ pd.setNfdlsj(0.00);
|
|
|
+ return allmap;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProBasicProjectPlan> pp = list.stream()
|
|
|
+ .filter(ls -> String.valueOf(month).equals(ls.getMonth())
|
|
|
+ && ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (null == pp || pp.isEmpty()) {
|
|
|
+ return allmap;
|
|
|
+ }
|
|
|
+ pd.setZfdljh(pp.get(0).getGeneratingCapacity() / 4);
|
|
|
+ double sum = day1s.stream().map(ProEconPowerstationInfoDay1::getRfdl).mapToDouble(BigDecimal::doubleValue).sum();
|
|
|
+ pd.setZfdlsj(sum);
|
|
|
+ Double zjd = calDivide(pd.getZfdlsj(), pd.getZfdljh());
|
|
|
+ pd.setZjd(zjd * 100);
|
|
|
+ pd.setZwcl(zjd);
|
|
|
+ pd.setYfdljh(pp.get(0).getGeneratingCapacity());
|
|
|
+ pd.setYfdlsj(days1.get(0).getYfdl().doubleValue());
|
|
|
+ Double yjd = calDivide(pd.getYfdlsj(), pd.getYfdljh());
|
|
|
+ pd.setYjd(yjd * 100);
|
|
|
+ pd.setYwcl(yjd);
|
|
|
+
|
|
|
+ List<ProBasicProjectPlan> pp2 = list.stream()
|
|
|
+ .filter(ls -> ls.getYear().equals(String.valueOf(year)) && ls.getProjectId().equals(companyId) && ls.getMonth() == null)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ pd.setNfdljh(pp2.get(0).getGeneratingCapacity());
|
|
|
+ pd.setNfdlsj(days1.get(0).getNfdl().doubleValue()/1000);
|
|
|
+ Double njd = calDivide(pd.getNfdlsj()/1000, pd.getNfdljh());
|
|
|
+ pd.setNjd(njd * 100);
|
|
|
+ pd.setNwcl(njd);
|
|
|
+ allmap.put("planData", pd);
|
|
|
+
|
|
|
+ QueryWrapper<ProEconPowerstationInfoDay1> qw2 = new QueryWrapper<>();
|
|
|
+ qw2.lambda().eq(ProEconPowerstationInfoDay1::getForeignKeyId, companyId);
|
|
|
+ List<ProEconPowerstationInfoDay1> days3 = proEconPowerstationInfoDay1Service.list(qw2);
|
|
|
+
|
|
|
+ Map<Date, List<ProEconPowerstationInfoDay1>> date = days3.stream().collect(Collectors.groupingBy(ProEconPowerstationInfoDay1::getRecordDate));
|
|
|
+ Set<Integer> year2 = new TreeSet<>();
|
|
|
+ for (Date date1 : date.keySet()) {
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ int year3 = calendar.get(Calendar.YEAR);
|
|
|
+ year2.add(year3);
|
|
|
+ }
|
|
|
+ int yy = year2.iterator().next();
|
|
|
+ String start = yy + "-01-01";
|
|
|
+ String end = yy + "-12-31";
|
|
|
+ String start2 = yy - 1 + "-01-01";
|
|
|
+ String end2 = yy - 1 + "-12-31";
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date start1 = sdf.parse(start);
|
|
|
+ Date end1 = sdf.parse(end);
|
|
|
+ Date start3 = sdf.parse(start2);
|
|
|
+ Date end3 = sdf.parse(end2);
|
|
|
+ List<ProEconPowerstationInfoDay1> thisYear = days3.stream().filter(rec -> rec.getRecordDate().after(start1) && rec.getRecordDate().before(end1)).collect(Collectors.toList());
|
|
|
+ List<ProEconPowerstationInfoDay1> lastYear = days3.stream().filter(rec -> rec.getRecordDate().after(start3) && rec.getRecordDate().before(end3)).collect(Collectors.toList());
|
|
|
+ Map<Integer, List<ProEconPowerstationInfoDay1>> day1sMap = thisYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
|
|
|
+ List<PowertrendVo> xdl = new ArrayList<>();
|
|
|
+ List<PowertrendVo> ssdl = new ArrayList<>();
|
|
|
+ List<PowertrendVo> fdl = new ArrayList<>();
|
|
|
+ PowertrendVo ptxdl = new PowertrendVo();
|
|
|
+ PowertrendVo ptssdl = new PowertrendVo();
|
|
|
+ PowertrendVo ptfdl = new PowertrendVo();
|
|
|
+ ptxdl.setTitle("限电量");
|
|
|
+ ptssdl.setTitle("损失电量");
|
|
|
+ ptfdl.setTitle("发电量");
|
|
|
+ ptxdl.setYAxisIndex(0);
|
|
|
+ ptssdl.setYAxisIndex(0);
|
|
|
+ ptfdl.setYAxisIndex(0);
|
|
|
+ List<ValueVo> vexdl = value(year, month);
|
|
|
+ List<ValueVo> vessdl = value(year, month);
|
|
|
+ List<ValueVo> vefdl = value(year, month);
|
|
|
+ for (Integer mon : day1sMap.keySet()) {
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s1 = day1sMap.get(mon);
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s2 = day1s1.stream().sorted(Comparator.comparing(ProEconPowerstationInfoDay1::getRecordDate).reversed()).collect(Collectors.toList());
|
|
|
+ LocalDate localDate = day1s2.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
|
|
|
+ int year1 = localDate.getYear();
|
|
|
+ String text = year1 + "-" + mon;
|
|
|
+ for (ValueVo vv : vexdl) {
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
+ vv.setValue(day1s2.get(0).getYxdjclssdl().add(day1s2.get(0).getYxdtjssdl()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (ValueVo vv : vessdl) {
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
+ vv.setValue(day1s2.get(0).getYgzssdl().add(day1s2.get(0).getYcnslgzssdl().add(day1s2.get(0).getYjxssdl().add(day1s2.get(0).getYcnsljxssdl()
|
|
|
+ .add(day1s2.get(0).getYdjssdl().add(day1s2.get(0).getYqxjclssdl().add(day1s2.get(0).getYsdtjssdl().add(day1s2.get(0).getYxnssdl()
|
|
|
+ .add(day1s2.get(0).getYxdtjssdl().add(day1s2.get(0).getYxdjclssdl().add(day1s2.get(0).getYcwsldwssdl().add(day1s2.get(0).getYcwsltqssdl()))))))))))));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (ValueVo vv : vefdl) {
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
+ vv.setValue(day1s2.get(0).getYfdl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ ptxdl.setValue(vexdl);
|
|
|
+ ptssdl.setValue(vessdl);
|
|
|
+ ptfdl.setValue(vefdl);
|
|
|
+ xdl.add(ptxdl);
|
|
|
+ ssdl.add(ptssdl);
|
|
|
+ fdl.add(ptfdl);
|
|
|
+
|
|
|
+ PowertrendVo ptxdl2 = new PowertrendVo();
|
|
|
+ PowertrendVo ptssdl2 = new PowertrendVo();
|
|
|
+ PowertrendVo ptfdl2 = new PowertrendVo();
|
|
|
+ ptxdl2.setTitle("去年同期限电量");
|
|
|
+ ptssdl2.setTitle("去年同期损失电量");
|
|
|
+ ptfdl2.setTitle("去年同期发电量");
|
|
|
+ ptxdl.setYAxisIndex(0);
|
|
|
+ ptssdl.setYAxisIndex(0);
|
|
|
+ ptfdl.setYAxisIndex(0);
|
|
|
+ if (null == lastYear || lastYear.isEmpty()) {
|
|
|
+ List<ValueVo> value = value(year - 1, month);
|
|
|
+ ptxdl2.setValue(value);
|
|
|
+ ptssdl2.setValue(value);
|
|
|
+ ptfdl2.setValue(value);
|
|
|
+ } else {
|
|
|
+ List<ValueVo> vxdl2 = new ArrayList<>();
|
|
|
+ List<ValueVo> vssdl2 = new ArrayList<>();
|
|
|
+ List<ValueVo> vfdl2 = new ArrayList<>();
|
|
|
+ Map<Integer, List<ProEconPowerstationInfoDay1>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
|
|
|
+ for (Integer mon2 : day1sMap2.keySet()) {
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s3 = day1sMap2.get(mon2);
|
|
|
+ List<ProEconPowerstationInfoDay1> day1s4 = day1s3.stream().sorted(Comparator.comparing(ProEconPowerstationInfoDay1::getRecordDate).reversed()).collect(Collectors.toList());
|
|
|
+ LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
|
|
|
+ int year1 = localDate.getYear();
|
|
|
+ String text = year1 + "-" + mon2;
|
|
|
+ ValueVo vexdl2 = new ValueVo();
|
|
|
+ ValueVo vessdl2 = new ValueVo();
|
|
|
+ ValueVo vefdl2 = new ValueVo();
|
|
|
+ vexdl2.setText(text);
|
|
|
+ vessdl2.setText(text);
|
|
|
+ vefdl2.setText(text);
|
|
|
+ vexdl2.setValue(day1s4.get(0).getYxdjclssdl().add(day1s4.get(0).getYxdtjssdl()));
|
|
|
+ vessdl2.setValue(day1s4.get(0).getYgzssdl().add(day1s4.get(0).getYcnslgzssdl().add(day1s4.get(0).getYjxssdl().add(day1s4.get(0).getYcnsljxssdl()
|
|
|
+ .add(day1s4.get(0).getYdjssdl().add(day1s4.get(0).getYqxjclssdl().add(day1s4.get(0).getYsdtjssdl().add(day1s4.get(0).getYxnssdl()
|
|
|
+ .add(day1s4.get(0).getYxdtjssdl().add(day1s4.get(0).getYxdjclssdl().add(day1s4.get(0).getYcwsldwssdl().add(day1s4.get(0).getYcwsltqssdl()))))))))))));
|
|
|
+ vefdl2.setValue(day1s4.get(0).getYfdl());
|
|
|
+ vxdl2.add(vexdl2);
|
|
|
+ vssdl2.add(vessdl2);
|
|
|
+ vfdl2.add(vefdl2);
|
|
|
+ }
|
|
|
+ ptxdl2.setValue(vxdl2);
|
|
|
+ ptssdl2.setValue(vssdl2);
|
|
|
+ ptxdl2.setValue(vfdl2);
|
|
|
+ }
|
|
|
+ xdl.add(ptxdl2);
|
|
|
+ ssdl.add(ptssdl2);
|
|
|
+ fdl.add(ptfdl2);
|
|
|
|
|
|
+ allmap.put("Powertrend", xdl);
|
|
|
+ allmap.put("Powerloss", ssdl);
|
|
|
+ allmap.put("Powersend", fdl);
|
|
|
return allmap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 除法
|
|
|
+ */
|
|
|
+ private Double calDivide(Double divide, Double divisor) {
|
|
|
+ if (divide == 0 || divisor == 0) {
|
|
|
+ return 0.0;
|
|
|
+ } else {
|
|
|
+ BigDecimal divide1 = BigDecimal.valueOf(divide);
|
|
|
+ BigDecimal divisor1 = BigDecimal.valueOf(divisor);
|
|
|
+ BigDecimal result = divide1.divide(divisor1, 2, RoundingMode.HALF_UP);
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
+ String formattedResult = df.format(result);
|
|
|
+ return Double.parseDouble(formattedResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<ValueVo> value(int year, int month) {
|
|
|
+ List<ValueVo> lv = new ArrayList<>();
|
|
|
+ for (int i = 1; i < month; i++) {
|
|
|
+ ValueVo vo = new ValueVo();
|
|
|
+ vo.setText(year + "-" + i);
|
|
|
+ vo.setValue(new BigDecimal(0));
|
|
|
+ lv.add(vo);
|
|
|
+ }
|
|
|
+ return lv;
|
|
|
|
|
|
}
|
|
|
|