package com.gyee.runeconomy.service.specific; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.gyee.common.model.StringUtils; import com.gyee.common.util.DateUtils; import com.gyee.common.util.DoubleUtils; import com.gyee.common.util.SortUtils; import com.gyee.common.vo.specific.SpecificCenterVo; import com.gyee.common.vo.specific.SpecificTarget; import com.gyee.common.vo.specific.SpecificTargetVo; import com.gyee.common.vo.specific.SpecificTopVo; import com.gyee.runeconomy.init.CacheContext; import com.gyee.runeconomy.model.auto.*; import com.gyee.runeconomy.service.TokenService; import com.gyee.runeconomy.service.auto.*; import com.gyee.runeconomy.service.bmk.BenchmarkingService; import org.springframework.stereotype.Service; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.text.ParseException; import java.time.Instant; import java.time.ZoneId; import java.util.*; import java.util.stream.Collectors; /* @author 谢生杰 @date 2022/11/23-21:38 专题分析 */ @Service public class SpecificService { @Resource private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service; @Resource private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service; @Resource private IProEconPowerstationInfoDay5Service proEconPowerstationInfoDay5Service; @Resource private IProEconPowerstationInfoDay7Service proEconPowerstationInfoDay7Service; @Resource private BenchmarkingService benchmarkingService; @Resource private TokenService tokenService; @Resource private IStationInfoDayService iStationInfoDayService; @Resource private ITurbineInfoDayService iTurbineInfoDayService; /** * 获取专题分析上面部分 * * @param yearmonth * @return * @throws ParseException */ public List maintoplist(String companys, String type, String yearmonth) throws ParseException { List resultList = new ArrayList<>(); Date date = DateUtils.parseDate(yearmonth + "-01"); Calendar c = Calendar.getInstance(); c.setTime(date); Integer year = c.get(Calendar.YEAR); Integer month = c.get(Calendar.MONTH) + 1; SpecificTopVo dqvo = new SpecificTopVo(); dqvo.setType("本期"); setDySpecificinfodays(companys, type, yearmonth, dqvo); setDnSpecificinfodays(companys, type, yearmonth, dqvo); resultList.add(dqvo); SpecificTopVo tqvo = new SpecificTopVo(); tqvo.setType("同期"); setTySpecificinfodays(companys, type, yearmonth, tqvo); setTnSpecificinfodays(companys, type, yearmonth, tqvo); resultList.add(tqvo); SpecificTopVo bjvo = new SpecificTopVo(); bjvo.setType("比较"); setBjVo(dqvo, tqvo, bjvo); resultList.add(bjvo); return resultList; } /** * 比较当前,同期值,给比较值赋值 * * @param dqvo * @param tqvo * @param bjvo */ private void setBjVo(SpecificTopVo dqvo, SpecificTopVo tqvo, SpecificTopVo bjvo) { bjvo.setYfnlyl(dqvo.getYfnlyl() >= tqvo.getYfnlyl() ? 1.0 : 2.0); bjvo.setYwhssl(dqvo.getYwhssl() >= tqvo.getYwhssl() ? 1.0 : 2.0); bjvo.setYgzssl(dqvo.getYgzssl() >= tqvo.getYgzssl() ? 1.0 : 2.0); bjvo.setYxdssl(dqvo.getYxdssl() >= tqvo.getYxdssl() ? 1.0 : 2.0); bjvo.setYxnssl(dqvo.getYxnssl() >= tqvo.getYxnssl() ? 1.0 : 2.0); bjvo.setYslssl(dqvo.getYslssl() >= tqvo.getYslssl() ? 1.0 : 2.0); bjvo.setNfnlyl(dqvo.getNfnlyl() >= tqvo.getNfnlyl() ? 1.0 : 2.0); bjvo.setNwhssl(dqvo.getNwhssl() >= tqvo.getNwhssl() ? 1.0 : 2.0); bjvo.setNgzssl(dqvo.getNgzssl() >= tqvo.getNgzssl() ? 1.0 : 2.0); bjvo.setNxdssl(dqvo.getNxdssl() >= tqvo.getNxdssl() ? 1.0 : 2.0); bjvo.setNxnssl(dqvo.getNxnssl() >= tqvo.getNxnssl() ? 1.0 : 2.0); bjvo.setNslssl(dqvo.getNslssl() >= tqvo.getNslssl() ? 1.0 : 2.0); } // /** // * 获取当月专题分析上面数据 // * // * @param companys // * @param type // * @param yearmonth // * @return // */ // private void setDySpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { // QueryWrapper qw = new QueryWrapper<>(); // qw.select("sum(rllfdl) as yllfdl,sum(rfdl) as yfdl,sum(rgzssdl) as ygzssdl,sum(rcnslgzssdl) as ycnslgzssdl,sum(rjxssdl) as yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) as yqxjclssdl,sum(rsdtjssdl) as ysdtjssdl,sum(rxnssdl) as yxnssdl,sum(rxdtjssdl) as yxdtjssdl,sum(rxdjclssdl) as yxdjclssdl,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl"); // qw.eq("foreign_key_id", companys + type); // qw.eq("to_char(record_date,'yyyy-MM')", yearmonth); // qw.groupBy("to_char(record_date,'yyyy-MM')"); // List monthList = proEconPowerstationInfoDay1Service.list(qw); // if (StringUtils.isNotEmpty(monthList)) { // Optional monthFirst = monthList.stream().findFirst(); // if (monthFirst.isPresent()) { // ProEconPowerstationInfoDay1 monthSpecific = monthFirst.get(); // dqvo.setYllfdl(DoubleUtils.getRoundingNum(monthSpecific.getYllfdl().doubleValue() / 10000, 2)); // dqvo.setYsjfdl(DoubleUtils.getRoundingNum(monthSpecific.getYfdl().doubleValue() / 10000, 2)); // dqvo.setYwhssdl(DoubleUtils.getRoundingNum(monthSpecific.getYjxssdl().doubleValue() / 10000 + monthSpecific.getYcnsljxssdl().doubleValue() / 10000, 2)); // dqvo.setYgzssdl(DoubleUtils.getRoundingNum(monthSpecific.getYgzssdl().doubleValue() / 10000 + monthSpecific.getYcnslgzssdl().doubleValue() / 10000, 2)); // dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getYxnssdl().doubleValue() / 10000 + monthSpecific.getYxdjclssdl().doubleValue() / 10000, 2)); // dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getYdjssdl().doubleValue() / 10000 + monthSpecific.getYqxjclssdl().doubleValue() / 10000 + monthSpecific.getYxnssdl().doubleValue() / 10000 + monthSpecific.getYsdtjssdl().doubleValue() / 10000, 2)); // dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getYcwsldwssdl().doubleValue() / 10000 + monthSpecific.getYcwsltqssdl().doubleValue() / 10000, 2)); // if (dqvo.getYllfdl() != 0) { // dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYxnssl(DoubleUtils.getRoundingNum(dqvo.getYxnssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYslssl(DoubleUtils.getRoundingNum(dqvo.getYslssdl() / dqvo.getYllfdl() * 100, 2)); // } else { // dqvo.setYfnlyl(0.0); // dqvo.setYwhssl(0.0); // dqvo.setYgzssl(0.0); // dqvo.setYxdssl(0.0); // dqvo.setYxnssl(0.0); // dqvo.setYslssl(0.0); // } // } // } else { // dqvo.setYllfdl(0.0); // dqvo.setYsjfdl(0.0); // dqvo.setYwhssdl(0.0); // dqvo.setYgzssdl(0.0); // dqvo.setYxdssdl(0.0); // dqvo.setYxnssdl(0.0); // dqvo.setYslssdl(0.0); // dqvo.setYfnlyl(0.0); // dqvo.setYwhssl(0.0); // dqvo.setYgzssl(0.0); // dqvo.setYxdssl(0.0); // dqvo.setYxnssl(0.0); // dqvo.setYslssl(0.0); // } // // } /** * 获取当月专题分析上面数据 * * @param companys * @param type * @param yearmonth * @return */ private void setDySpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { QueryWrapper qw = new QueryWrapper<>(); qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss"); qw.eq("to_char(record_date,'yyyy-MM')", yearmonth); qw.groupBy("to_char(record_date,'yyyy-MM')"); List monthList = iTurbineInfoDayService.list(qw); if (StringUtils.isNotEmpty(monthList)) { Optional monthFirst = monthList.stream().findFirst(); if (monthFirst.isPresent()) { TurbineInfoDay monthSpecific = monthFirst.get(); dqvo.setYllfdl(DoubleUtils.getRoundingNum(monthSpecific.getLlfdl() / 10000, 2)); dqvo.setYsjfdl(DoubleUtils.getRoundingNum(monthSpecific.getRfdl().doubleValue() / 10000, 2)); dqvo.setYwhssdl(DoubleUtils.getRoundingNum(monthSpecific.getJhjxss().doubleValue() / 10000 + monthSpecific.getFjhjxss().doubleValue() / 10000, 2)); dqvo.setYgzssdl(DoubleUtils.getRoundingNum(monthSpecific.getGzss().doubleValue() / 10000, 2)); dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getXnss().doubleValue() / 10000, 2)); dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getDjss().doubleValue() / 10000, 2)); dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getSlss().doubleValue() / 10000, 2)); if (dqvo.getYllfdl() != 0) { dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYxnssl(DoubleUtils.getRoundingNum(dqvo.getYxnssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYslssl(DoubleUtils.getRoundingNum(dqvo.getYslssdl() / dqvo.getYllfdl() * 100, 2)); } else { dqvo.setYfnlyl(0.0); dqvo.setYwhssl(0.0); dqvo.setYgzssl(0.0); dqvo.setYxdssl(0.0); dqvo.setYxnssl(0.0); dqvo.setYslssl(0.0); } } } else { dqvo.setYllfdl(0.0); dqvo.setYsjfdl(0.0); dqvo.setYwhssdl(0.0); dqvo.setYgzssdl(0.0); dqvo.setYxdssdl(0.0); dqvo.setYxnssdl(0.0); dqvo.setYslssdl(0.0); dqvo.setYfnlyl(0.0); dqvo.setYwhssl(0.0); dqvo.setYgzssl(0.0); dqvo.setYxdssl(0.0); dqvo.setYxnssl(0.0); dqvo.setYslssl(0.0); } } // /** // * 获取月同期专题分析上面数据 // * // * @param companys // * @param type // * @return // */ // private void setTySpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { // String yearString = yearmonth.split("-")[0]; // String year = String.valueOf(Integer.parseInt(yearString) - 1); // String yearMonth = year + "-" + yearmonth.split("-")[1]; // QueryWrapper qw = new QueryWrapper<>(); // qw.select("sum(rllfdl) as yllfdl,sum(rfdl) as yfdl,sum(rgzssdl) as ygzssdl,sum(rcnslgzssdl) as ycnslgzssdl,sum(rjxssdl) as yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) as yqxjclssdl,sum(rsdtjssdl) as ysdtjssdl,sum(rxnssdl) as yxnssdl,sum(rxdtjssdl) as yxdtjssdl,sum(rxdjclssdl) as yxdjclssdl,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl"); // qw.eq("foreign_key_id", companys + type); // qw.eq("to_char(record_date,'yyyy-MM')", yearMonth); // qw.groupBy("to_char(record_date,'yyyy-MM')"); // List monthList = proEconPowerstationInfoDay1Service.list(qw); // Optional monthFirst = monthList.stream().findFirst(); // if (monthFirst.isPresent()) { // ProEconPowerstationInfoDay1 monthSpecific = monthFirst.get(); // dqvo.setYllfdl(DoubleUtils.getRoundingNum(monthSpecific.getYllfdl().doubleValue() / 10000, 2)); // dqvo.setYsjfdl(DoubleUtils.getRoundingNum(monthSpecific.getYfdl().doubleValue() / 10000, 2)); // dqvo.setYwhssdl(DoubleUtils.getRoundingNum(monthSpecific.getYjxssdl().doubleValue() / 10000 + monthSpecific.getYcnsljxssdl().doubleValue() / 10000, 2)); // dqvo.setYgzssdl(DoubleUtils.getRoundingNum(monthSpecific.getYgzssdl().doubleValue() / 10000 + monthSpecific.getYcnslgzssdl().doubleValue() / 10000, 2)); // dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getYxnssdl().doubleValue() / 10000 + monthSpecific.getYxdjclssdl().doubleValue() / 10000, 2)); // dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getYdjssdl().doubleValue() / 10000 + monthSpecific.getYqxjclssdl().doubleValue() / 10000 + monthSpecific.getYxnssdl().doubleValue() / 10000 + monthSpecific.getYsdtjssdl().doubleValue() / 10000, 2)); // dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getYcwsldwssdl().doubleValue() / 10000 + monthSpecific.getYcwsltqssdl().doubleValue() / 10000, 2)); // if (dqvo.getYllfdl() != 0) { // dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYxnssl(DoubleUtils.getRoundingNum(dqvo.getYxnssdl() / dqvo.getYllfdl() * 100, 2)); // dqvo.setYslssl(DoubleUtils.getRoundingNum(dqvo.getYslssdl() / dqvo.getYllfdl() * 100, 2)); // } else { // dqvo.setYfnlyl(0.0); // dqvo.setYwhssl(0.0); // dqvo.setYgzssl(0.0); // dqvo.setYxdssl(0.0); // dqvo.setYxnssl(0.0); // dqvo.setYslssl(0.0); // } // } else { // dqvo.setYllfdl(0.0); // dqvo.setYsjfdl(0.0); // dqvo.setYwhssdl(0.0); // dqvo.setYgzssdl(0.0); // dqvo.setYxdssdl(0.0); // dqvo.setYxnssdl(0.0); // dqvo.setYslssdl(0.0); // dqvo.setYfnlyl(0.0); // dqvo.setYwhssl(0.0); // dqvo.setYgzssl(0.0); // dqvo.setYxdssl(0.0); // dqvo.setYxnssl(0.0); // dqvo.setYslssl(0.0); // } // } /** * 获取月同期专题分析上面数据 * * @param companys * @param type * @return */ private void setTySpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { String yearString = yearmonth.split("-")[0]; String year = String.valueOf(Integer.parseInt(yearString) - 1); String yearMonth = year + "-" + yearmonth.split("-")[1]; QueryWrapper qw = new QueryWrapper<>(); qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss"); qw.eq("to_char(record_date,'yyyy-MM')", yearMonth); qw.groupBy("to_char(record_date,'yyyy-MM')"); List monthList = iTurbineInfoDayService.list(qw); Optional monthFirst = monthList.stream().findFirst(); if (monthFirst.isPresent()) { TurbineInfoDay monthSpecific = monthFirst.get(); dqvo.setYllfdl(DoubleUtils.getRoundingNum(monthSpecific.getLlfdl() / 10000, 2)); dqvo.setYsjfdl(DoubleUtils.getRoundingNum(monthSpecific.getRfdl().doubleValue() / 10000, 2)); dqvo.setYwhssdl(DoubleUtils.getRoundingNum(monthSpecific.getJhjxss().doubleValue() / 10000 + monthSpecific.getFjhjxss().doubleValue() / 10000, 2)); dqvo.setYgzssdl(DoubleUtils.getRoundingNum(monthSpecific.getGzss().doubleValue() / 10000, 2)); dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getXnss().doubleValue() / 10000, 2)); dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getDjss().doubleValue() / 10000, 2)); dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getSlss().doubleValue() / 10000, 2)); if (dqvo.getYllfdl() != 0) { dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYxnssl(DoubleUtils.getRoundingNum(dqvo.getYxnssdl() / dqvo.getYllfdl() * 100, 2)); dqvo.setYslssl(DoubleUtils.getRoundingNum(dqvo.getYslssdl() / dqvo.getYllfdl() * 100, 2)); } else { dqvo.setYfnlyl(0.0); dqvo.setYwhssl(0.0); dqvo.setYgzssl(0.0); dqvo.setYxdssl(0.0); dqvo.setYxnssl(0.0); dqvo.setYslssl(0.0); } } else { dqvo.setYllfdl(0.0); dqvo.setYsjfdl(0.0); dqvo.setYwhssdl(0.0); dqvo.setYgzssdl(0.0); dqvo.setYxdssdl(0.0); dqvo.setYxnssdl(0.0); dqvo.setYslssdl(0.0); dqvo.setYfnlyl(0.0); dqvo.setYwhssl(0.0); dqvo.setYgzssl(0.0); dqvo.setYxdssl(0.0); dqvo.setYxnssl(0.0); dqvo.setYslssl(0.0); } } // /** // * 获取当年专题分析上面数据 // * // * @param companys // * @param type // * @param yearmonth // * @param dqvo // */ // private void setDnSpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { // QueryWrapper qw = new QueryWrapper<>(); // qw.select("sum(rllfdl) as nllfdl,sum(rfdl) as nfdl,sum(rgzssdl) as ngzssdl,sum(rcnslgzssdl) as ncnslgzssdl,sum(rjxssdl) as njxssdl,sum(rcnsljxssdl) ncnsljxssdl,sum(rdjssdl) ndjssdl,sum(rqxjclssdl) as nqxjclssdl,sum(rsdtjssdl) as nsdtjssdl,sum(rxnssdl) as nxnssdl,sum(rxdtjssdl) as nxdtjssdl,sum(rxdjclssdl) as nxdjclssdl,sum(rcwsldwssdl) ncwsldwssdl,sum(rcwsltqssdl) ncwsltqssdl"); // qw.eq("foreign_key_id", companys + type); // qw.eq("to_char(record_date,'yyyy')", yearmonth.split("-")[0]); // qw.groupBy("to_char(record_date,'yyyy')"); // List yearList = proEconPowerstationInfoDay1Service.list(qw); // if (StringUtils.isNotEmpty(yearList)) { // Optional yearFirsts = yearList.stream().findFirst(); // if (yearFirsts.isPresent()) { // ProEconPowerstationInfoDay1 yearSpecific = yearFirsts.get(); // dqvo.setNllfdl(DoubleUtils.getRoundingNum(yearSpecific.getNllfdl().doubleValue() / 10000, 2)); // dqvo.setNsjfdl(DoubleUtils.getRoundingNum(yearSpecific.getNfdl().doubleValue() / 10000, 2)); // dqvo.setNwhssdl(DoubleUtils.getRoundingNum(yearSpecific.getNjxssdl().doubleValue() / 10000 + yearSpecific.getNcnsljxssdl().doubleValue() / 10000, 2)); // dqvo.setNgzssdl(DoubleUtils.getRoundingNum(yearSpecific.getNgzssdl().doubleValue() / 10000 + yearSpecific.getNcnslgzssdl().doubleValue() / 10000, 2)); // dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getNxnssdl().doubleValue() / 10000 + yearSpecific.getNxdjclssdl().doubleValue() / 10000, 2)); // dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getNdjssdl().doubleValue() / 10000 + yearSpecific.getNqxjclssdl().doubleValue() / 10000 + yearSpecific.getNxnssdl().doubleValue() / 10000 + yearSpecific.getNsdtjssdl().doubleValue() / 10000, 2)); // dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getNcwsldwssdl().doubleValue() / 10000 + yearSpecific.getNcwsltqssdl().doubleValue() / 10000, 2)); // if (dqvo.getYllfdl() != 0) { // dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNxnssl(DoubleUtils.getRoundingNum(dqvo.getNxnssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNslssl(DoubleUtils.getRoundingNum(dqvo.getNslssdl() / dqvo.getNllfdl() * 100, 2)); // } else { // dqvo.setNfnlyl(0.0); // dqvo.setNwhssl(0.0); // dqvo.setNgzssl(0.0); // dqvo.setNxdssl(0.0); // dqvo.setNxnssl(0.0); // dqvo.setNslssl(0.0); // } // } // } else { // dqvo.setNllfdl(0.0); // dqvo.setNsjfdl(0.0); // dqvo.setNwhssdl(0.0); // dqvo.setNgzssdl(0.0); // dqvo.setNxdssdl(0.0); // dqvo.setNxnssdl(0.0); // dqvo.setNslssdl(0.0); // dqvo.setNfnlyl(0.0); // dqvo.setNwhssl(0.0); // dqvo.setNgzssl(0.0); // dqvo.setNxdssl(0.0); // dqvo.setNxnssl(0.0); // dqvo.setNslssl(0.0); // } // // } /** * 获取当年专题分析上面数据 * * @param companys * @param type * @param yearmonth * @param dqvo */ private void setDnSpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) { QueryWrapper qw = new QueryWrapper<>(); qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss"); qw.eq("to_char(record_date,'yyyy')", yearmonth.split("-")[0]); qw.groupBy("to_char(record_date,'yyyy')"); List yearList = iTurbineInfoDayService.list(qw); if (StringUtils.isNotEmpty(yearList)) { Optional yearFirsts = yearList.stream().findFirst(); if (yearFirsts.isPresent()) { TurbineInfoDay yearSpecific = yearFirsts.get(); dqvo.setNllfdl(DoubleUtils.getRoundingNum(yearSpecific.getLlfdl() / 10000, 2)); dqvo.setNsjfdl(DoubleUtils.getRoundingNum(yearSpecific.getRfdl().doubleValue() / 10000, 2)); dqvo.setNwhssdl(DoubleUtils.getRoundingNum(yearSpecific.getJhjxss().doubleValue() / 10000 + yearSpecific.getFjhjxss().doubleValue() / 10000, 2)); dqvo.setNgzssdl(DoubleUtils.getRoundingNum(yearSpecific.getGzss().doubleValue() / 10000, 2)); dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss().doubleValue() / 10000, 2)); dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getDjss().doubleValue() / 10000, 2)); dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getSlss().doubleValue() / 10000, 2)); if (dqvo.getYllfdl() != 0) { dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNxnssl(DoubleUtils.getRoundingNum(dqvo.getNxnssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNslssl(DoubleUtils.getRoundingNum(dqvo.getNslssdl() / dqvo.getNllfdl() * 100, 2)); } else { dqvo.setNfnlyl(0.0); dqvo.setNwhssl(0.0); dqvo.setNgzssl(0.0); dqvo.setNxdssl(0.0); dqvo.setNxnssl(0.0); dqvo.setNslssl(0.0); } } } else { dqvo.setNllfdl(0.0); dqvo.setNsjfdl(0.0); dqvo.setNwhssdl(0.0); dqvo.setNgzssdl(0.0); dqvo.setNxdssdl(0.0); dqvo.setNxnssdl(0.0); dqvo.setNslssdl(0.0); dqvo.setNfnlyl(0.0); dqvo.setNwhssl(0.0); dqvo.setNgzssl(0.0); dqvo.setNxdssl(0.0); dqvo.setNxnssl(0.0); dqvo.setNslssl(0.0); } } // /** // * 获取年同期专题分析上面数据 // * // * @param companys // * @param dqvo // */ // private void setTnSpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) throws ParseException { // String yearString = yearmonth.split("-")[0]; // String year = String.valueOf(Integer.parseInt(yearString) - 1); // QueryWrapper qw = new QueryWrapper<>(); // qw.select("sum(rllfdl) as nllfdl,sum(rfdl) as nfdl,sum(rgzssdl) as ngzssdl,sum(rcnslgzssdl) as ncnslgzssdl,sum(rjxssdl) as njxssdl,sum(rcnsljxssdl) ncnsljxssdl,sum(rdjssdl) ndjssdl,sum(rqxjclssdl) as nqxjclssdl,sum(rsdtjssdl) as nsdtjssdl,sum(rxnssdl) as nxnssdl,sum(rxdtjssdl) as nxdtjssdl,sum(rxdjclssdl) as nxdjclssdl,sum(rcwsldwssdl) ncwsldwssdl,sum(rcwsltqssdl) ncwsltqssdl"); // qw.eq("foreign_key_id", companys + type); // qw.eq("to_char(record_date,'yyyy')", year); // qw.groupBy("to_char(record_date,'yyyy')"); // List yearList = proEconPowerstationInfoDay1Service.list(qw); // // Optional yearFirsts = yearList.stream().findFirst(); // if (yearFirsts.isPresent()) { // ProEconPowerstationInfoDay1 yearSpecific = yearFirsts.get(); // dqvo.setNllfdl(DoubleUtils.getRoundingNum(yearSpecific.getNllfdl().doubleValue() / 10000, 2)); // dqvo.setNsjfdl(DoubleUtils.getRoundingNum(yearSpecific.getNfdl().doubleValue() / 10000, 2)); // dqvo.setNwhssdl(DoubleUtils.getRoundingNum(yearSpecific.getNjxssdl().doubleValue() / 10000 + yearSpecific.getNcnsljxssdl().doubleValue() / 10000, 2)); // dqvo.setNgzssdl(DoubleUtils.getRoundingNum(yearSpecific.getNgzssdl().doubleValue() / 10000 + yearSpecific.getNcnslgzssdl().doubleValue() / 10000, 2)); // dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getNxnssdl().doubleValue() / 10000 + yearSpecific.getNxdjclssdl().doubleValue() / 10000, 2)); // dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getNdjssdl().doubleValue() / 10000 + yearSpecific.getNqxjclssdl().doubleValue() / 10000 + yearSpecific.getNxnssdl().doubleValue() / 10000 + yearSpecific.getNsdtjssdl().doubleValue() / 10000, 2)); // dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getNcwsldwssdl().doubleValue() / 10000 + yearSpecific.getNcwsltqssdl().doubleValue() / 10000, 2)); // if (dqvo.getYllfdl() != 0) { // dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNxnssl(DoubleUtils.getRoundingNum(dqvo.getNxnssdl() / dqvo.getNllfdl() * 100, 2)); // dqvo.setNslssl(DoubleUtils.getRoundingNum(dqvo.getNslssdl() / dqvo.getNllfdl() * 100, 2)); // } else { // dqvo.setNfnlyl(0.0); // dqvo.setNwhssl(0.0); // dqvo.setNgzssl(0.0); // dqvo.setNxdssl(0.0); // dqvo.setNxnssl(0.0); // dqvo.setNslssl(0.0); // } // } else { // dqvo.setNllfdl(0.0); // dqvo.setNsjfdl(0.0); // dqvo.setNwhssdl(0.0); // dqvo.setNgzssdl(0.0); // dqvo.setNxdssdl(0.0); // dqvo.setNxnssdl(0.0); // dqvo.setNslssdl(0.0); // dqvo.setNfnlyl(0.0); // dqvo.setNwhssl(0.0); // dqvo.setNgzssl(0.0); // dqvo.setNxdssl(0.0); // dqvo.setNxnssl(0.0); // dqvo.setNslssl(0.0); // } // } /** * 获取年同期专题分析上面数据 * * @param companys * @param dqvo */ private void setTnSpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) throws ParseException { String yearString = yearmonth.split("-")[0]; String year = String.valueOf(Integer.parseInt(yearString) - 1); QueryWrapper qw = new QueryWrapper<>(); qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss"); qw.eq("to_char(record_date,'yyyy')", year); qw.groupBy("to_char(record_date,'yyyy')"); List yearList = iTurbineInfoDayService.list(qw); Optional yearFirsts = yearList.stream().findFirst(); if (yearFirsts.isPresent()) { TurbineInfoDay yearSpecific = yearFirsts.get(); dqvo.setNllfdl(DoubleUtils.getRoundingNum(yearSpecific.getLlfdl() / 10000, 2)); dqvo.setNsjfdl(DoubleUtils.getRoundingNum(yearSpecific.getRfdl().doubleValue() / 10000, 2)); dqvo.setNwhssdl(DoubleUtils.getRoundingNum(yearSpecific.getJhjxss().doubleValue() / 10000 + yearSpecific.getFjhjxss().doubleValue() / 10000, 2)); dqvo.setNgzssdl(DoubleUtils.getRoundingNum(yearSpecific.getGzss().doubleValue() / 10000, 2)); dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss().doubleValue() / 10000, 2)); dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getDjss().doubleValue() / 10000, 2)); dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getSlss().doubleValue() / 10000, 2)); if (dqvo.getYllfdl() != 0) { dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNxnssl(DoubleUtils.getRoundingNum(dqvo.getNxnssdl() / dqvo.getNllfdl() * 100, 2)); dqvo.setNslssl(DoubleUtils.getRoundingNum(dqvo.getNslssdl() / dqvo.getNllfdl() * 100, 2)); } else { dqvo.setNfnlyl(0.0); dqvo.setNwhssl(0.0); dqvo.setNgzssl(0.0); dqvo.setNxdssl(0.0); dqvo.setNxnssl(0.0); dqvo.setNslssl(0.0); } } else { dqvo.setNllfdl(0.0); dqvo.setNsjfdl(0.0); dqvo.setNwhssdl(0.0); dqvo.setNgzssdl(0.0); dqvo.setNxdssdl(0.0); dqvo.setNxnssdl(0.0); dqvo.setNslssdl(0.0); dqvo.setNfnlyl(0.0); dqvo.setNwhssl(0.0); dqvo.setNgzssl(0.0); dqvo.setNxdssl(0.0); dqvo.setNxnssl(0.0); dqvo.setNslssl(0.0); } } /** * 获取专题分析中间部分 * * @param yearmonth * @return */ public Map> maincenterlist2(String companys, String type, String yearmonth) throws ParseException { Map wpmap = CacheContext.wpmap; Date date = DateUtils.parseDate(yearmonth + "-01"); Calendar c = Calendar.getInstance(); c.setTime(date); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; //定义左边部分的结果list List monthresultList = new ArrayList<>(); //设置当月数据 setCenterDyInfo(companys, type, yearmonth, monthresultList); //设置同期数据 setCenterYtqInfo(companys, type, yearmonth, monthresultList); //设置比较数据 monthresultList.stream().forEach(i -> { i.setMtbfCompare(null == i.getTqmtbf() ? 2 : (i.getMtbf() > i.getTqmtbf() ? 1 : 2)); i.setMttrCompare(null == i.getTqmttr() ? 2 : (i.getMttr() > i.getTqmttr() ? 1 : 2)); i.setFwjslCompare(null == i.getTqfwjsl() ? 2 : (i.getFwjsl() > i.getTqfwjsl() ? 1 : 2)); i.setZtzhlCompare(null == i.getTqztzhl() ? 2 : (i.getZtzhl() > i.getTqztzhl() ? 1 : 2)); i.setXqjslCompare(null == i.getTqxqjsl() ? 2 : (i.getXqjsl() > i.getTqxqjsl() ? 1 : 2)); }); //定义右边部分的结果list List yearresultList = new ArrayList<>(); //设置当年数据 setCenterDnInfo(companys, type, yearmonth, yearresultList); //设置同期数据 setCenterNtqInfo(companys, type, yearmonth, yearresultList); //设置比较数据 yearresultList.stream().forEach(i -> { i.setMtbfCompare(null == i.getTqmtbf() ? 2 : (i.getMtbf() > i.getTqmtbf() ? 1 : 2)); i.setMttrCompare(null == i.getTqmttr() ? 2 : (i.getMttr() > i.getTqmttr() ? 1 : 2)); i.setFwjslCompare(null == i.getTqfwjsl() ? 2 : (i.getFwjsl() > i.getTqfwjsl() ? 1 : 2)); i.setZtzhlCompare(null == i.getTqztzhl() ? 2 : (i.getZtzhl() > i.getTqztzhl() ? 1 : 2)); i.setXqjslCompare(null == i.getTqxqjsl() ? 2 : (i.getXqjsl() > i.getTqxqjsl() ? 1 : 2)); }); //封装最终返回结果 monthresultList.stream().forEach(i -> { i.setOrdernum(wpmap.get(i.getWpid()).getOrderNum()); i.setWpid(wpmap.get(i.getWpid()).getAname()); }); yearresultList.stream().forEach(i -> { i.setOrdernum(wpmap.get(i.getWpid()).getOrderNum()); i.setWpid(wpmap.get(i.getWpid()).getAname()); }); SortUtils.sort(monthresultList, "ordernum", SortUtils.ASC); SortUtils.sort(yearresultList, "ordernum", SortUtils.ASC); Map> resultMap = new HashMap<>(); resultMap.put("当月", monthresultList); resultMap.put("当年", yearresultList); return resultMap; } public Map> maincenterlist(String companys, String type, String yearmonth) throws ParseException { Map wpmap = CacheContext.wpmap; Date date = DateUtils.parseDate(yearmonth + "-01"); Calendar c = Calendar.getInstance(); c.setTime(date); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; //定义左边部分的结果list List monthresultList = new ArrayList<>(); //设置当月数据 setCenterDyInfo(companys, type, yearmonth, monthresultList); //设置同期数据 setCenterYtqInfo(companys, type, yearmonth, monthresultList); //设置比较数据 monthresultList.stream().forEach(i -> { i.setMtbfCompare(null == i.getTqmtbf() ? 2 : (i.getMtbf() > i.getTqmtbf() ? 1 : 2)); i.setMttrCompare(null == i.getTqmttr() ? 2 : (i.getMttr() > i.getTqmttr() ? 1 : 2)); i.setFwjslCompare(null == i.getTqfwjsl() ? 2 : (i.getFwjsl() > i.getTqfwjsl() ? 1 : 2)); i.setZtzhlCompare(null == i.getTqztzhl() ? 2 : (i.getZtzhl() > i.getTqztzhl() ? 1 : 2)); i.setXqjslCompare(null == i.getTqxqjsl() ? 2 : (i.getXqjsl() > i.getTqxqjsl() ? 1 : 2)); }); //定义右边部分的结果list List yearresultList = new ArrayList<>(); //设置当年数据 setCenterDnInfo(companys, type, yearmonth, yearresultList); //设置同期数据 setCenterNtqInfo(companys, type, yearmonth, yearresultList); //设置比较数据 yearresultList.stream().forEach(i -> { i.setMtbfCompare(null == i.getTqmtbf() ? 2 : (i.getMtbf() > i.getTqmtbf() ? 1 : 2)); i.setMttrCompare(null == i.getTqmttr() ? 2 : (i.getMttr() > i.getTqmttr() ? 1 : 2)); i.setFwjslCompare(null == i.getTqfwjsl() ? 2 : (i.getFwjsl() > i.getTqfwjsl() ? 1 : 2)); i.setZtzhlCompare(null == i.getTqztzhl() ? 2 : (i.getZtzhl() > i.getTqztzhl() ? 1 : 2)); i.setXqjslCompare(null == i.getTqxqjsl() ? 2 : (i.getXqjsl() > i.getTqxqjsl() ? 1 : 2)); }); //封装最终返回结果 monthresultList.stream().forEach(i -> { i.setOrdernum(wpmap.get(i.getWpid()).getOrderNum()); i.setWpid(wpmap.get(i.getWpid()).getAname()); }); yearresultList.stream().forEach(i -> { i.setOrdernum(wpmap.get(i.getWpid()).getOrderNum()); i.setWpid(wpmap.get(i.getWpid()).getAname()); }); SortUtils.sort(monthresultList, "ordernum", SortUtils.ASC); SortUtils.sort(yearresultList, "ordernum", SortUtils.ASC); Map> resultMap = new HashMap<>(); resultMap.put("当月", monthresultList); resultMap.put("当年", yearresultList); return resultMap; } /** * 设置月同期mtbf,mttr,复位及时率,状态转换率,消缺及时率 * * @param companys * @param type * @param yearmonth * @param monthresultList */ private void setCenterYtqInfo(String companys, String type, String yearmonth, List monthresultList) { // HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); // List wplsToken = tokenService.getWpls(request); List wplsToken = CacheContext.wpls; String yearString = yearmonth.split("-")[0]; String year = String.valueOf(Integer.parseInt(yearString) - 1); String yearMonth = year + "-" + yearmonth.split("-")[1]; QueryWrapper qw = new QueryWrapper<>(); QueryWrapper qw1 = new QueryWrapper<>(); qw.select("foreign_key_id,sum(rmtbf) ymtbf,sum(rmttr) ymttr,avg(rfwjsl) yfwjsl,avg(rztzhjsl) yztzhjsl,avg(rgzxqjsl) ygzxqjsl"); qw1.select("foreign_key_id,avg(rxtxlpr) yxtxlpr,avg(rlsl) ylsl,avg(rnbqzhxl) ynbqzhxl"); qw.eq("location", "wp"); qw1.eq("location", "wp"); if (type.endsWith("-1")) { qw.like("foreign_key_id", "_FDC_"); qw1.like("foreign_key_id", "_FDC_"); } else if (type.endsWith("-2")) { qw.like("foreign_key_id", "_GDC_"); qw1.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { qw.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); qw1.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); } qw.eq("to_char(record_date,'yyyy-MM')", yearMonth); qw1.eq("to_char(record_date,'yyyy-MM')", yearMonth); qw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); qw1.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List tqList = proEconPowerstationInfoDay4Service.list(qw); List tq1List = proEconPowerstationInfoDay7Service.list(qw1); if (StringUtils.isNotEmpty(tqList)) { tqList.stream().forEach(i -> { Optional optionMonth = monthresultList.stream().filter(j -> j.getWpid().equals(i.getForeignKeyId())).findFirst(); SpecificCenterVo leftVo = optionMonth.get(); if (optionMonth.isPresent()) { leftVo.setTqmtbf(DoubleUtils.keepPrecision(i.getYmtbf().doubleValue(), 2)); leftVo.setTqmttr(DoubleUtils.keepPrecision(i.getYmttr().doubleValue(), 2)); if (type.equals("-1")) { leftVo.setTqfwjsl(DoubleUtils.keepPrecision(i.getYfwjsl().doubleValue(), 2)); leftVo.setTqztzhl(DoubleUtils.keepPrecision(i.getYztzhjsl().doubleValue(), 2)); leftVo.setTqxqjsl(DoubleUtils.keepPrecision(i.getYgzxqjsl().doubleValue(), 2)); } else if (type.equals("-2")) { Optional first = tq1List.stream().filter(d -> d.getForeignKeyId().equals(i.getForeignKeyId())).findFirst(); if (first.isPresent()) { ProEconPowerstationInfoDay7 proEconPowerstationInfoDay7 = first.get(); leftVo.setFwjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYxtxlpr().doubleValue(), 2)); leftVo.setZtzhl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYlsl().doubleValue(), 2)); leftVo.setXqjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYnbqzhxl().doubleValue(), 2)); } else { leftVo.setFwjsl(0.0); leftVo.setZtzhl(0.0); leftVo.setXqjsl(0.0); } } } else { leftVo.setTqmtbf(0.0); leftVo.setTqmttr(0.0); leftVo.setTqfwjsl(0.0); leftVo.setTqztzhl(0.0); leftVo.setTqxqjsl(0.0); } }); } else { List wpls = benchmarkingService.wpByCplist(companys, type); wpls.stream().forEach(wp -> { Optional optionMonth = monthresultList.stream().filter(j -> j.getWpid().equals(wp.getId())).findFirst(); if (optionMonth.isPresent()) { SpecificCenterVo leftVo = optionMonth.get(); leftVo.setTqmtbf(0.0); leftVo.setTqmttr(0.0); leftVo.setTqfwjsl(0.0); leftVo.setTqztzhl(0.0); leftVo.setTqxqjsl(0.0); } }); } } /** * 设置年同期mtbf,mttr,复位及时率,状态转换率,消缺及时率 * * @param companys * @param yearresultList */ private void setCenterNtqInfo(String companys, String type, String yearmonth, List yearresultList) throws ParseException { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); // List wplsToken = tokenService.getWpls(request); List wplsToken = CacheContext.wpls; String yearString = yearmonth.split("-")[0]; String year = String.valueOf(Integer.parseInt(yearString) - 1); QueryWrapper qw = new QueryWrapper<>(); QueryWrapper qw1 = new QueryWrapper<>(); qw.select("foreign_key_id,sum(rmtbf) nmtbf,sum(rmttr) nmttr,avg(rfwjsl) nfwjsl,avg(rztzhjsl) nztzhjsl,avg(rgzxqjsl) ngzxqjsl"); qw1.select("foreign_key_id,avg(rxtxlpr) nxtxlpr,avg(rlsl) nlsl,avg(rnbqzhxl) nnbqzhxl"); qw.eq("location", "wp"); qw1.eq("location", "wp"); if (type.endsWith("-1")) { qw.like("foreign_key_id", "_FDC_"); qw1.like("foreign_key_id", "_FDC_"); } else if (type.endsWith("-2")) { qw.like("foreign_key_id", "_GDC_"); qw1.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { qw.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); qw1.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); } qw.eq("to_char(record_date,'yyyy')", year); qw1.eq("to_char(record_date,'yyyy')", year); qw.groupBy("to_char(record_date,'yyyy'),foreign_key_id"); qw1.groupBy("to_char(record_date,'yyyy'),foreign_key_id"); List tqList = proEconPowerstationInfoDay4Service.list(qw); List tq1List = proEconPowerstationInfoDay7Service.list(qw1); if (StringUtils.isNotEmpty(tqList)) { tqList.stream().forEach(i -> { Optional optionYear = yearresultList.stream().filter(j -> j.getWpid().equals(i.getWindpowerstationId())).findFirst(); if (optionYear.isPresent()) { SpecificCenterVo rightVo = optionYear.get(); rightVo.setTqmtbf(DoubleUtils.keepPrecision(i.getNmtbf().doubleValue(), 2)); rightVo.setTqmttr(DoubleUtils.keepPrecision(i.getNmttr().doubleValue(), 2)); if (type.equals("-1")) { rightVo.setTqfwjsl(DoubleUtils.keepPrecision(i.getNfwjsl().doubleValue(), 2)); rightVo.setTqztzhl(DoubleUtils.keepPrecision(i.getNztzhjsl().doubleValue(), 2)); rightVo.setTqxqjsl(DoubleUtils.keepPrecision(i.getNgzxqjsl().doubleValue(), 2)); } else if (type.equals("-2")) { Optional first = tq1List.stream().filter(d -> d.getForeignKeyId().equals(i.getForeignKeyId())).findFirst(); if (first.isPresent()) { ProEconPowerstationInfoDay7 proEconPowerstationInfoDay7 = first.get(); rightVo.setFwjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNxtxlpr().doubleValue(), 2)); rightVo.setZtzhl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNlsl().doubleValue(), 2)); rightVo.setXqjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNnbqzhxl().doubleValue(), 2)); } else { rightVo.setFwjsl(0.0); rightVo.setZtzhl(0.0); rightVo.setXqjsl(0.0); } } } }); } else { List wpls = benchmarkingService.wpByCplist(companys, type); wpls.stream().forEach(wp -> { Optional optionMonth = yearresultList.stream().filter(j -> j.getWpid().equals(wp.getId())).findFirst(); if (optionMonth.isPresent()) { SpecificCenterVo leftVo = optionMonth.get(); leftVo.setTqmtbf(0.0); leftVo.setTqmttr(0.0); leftVo.setTqfwjsl(0.0); leftVo.setTqztzhl(0.0); leftVo.setTqxqjsl(0.0); } }); } } /** * 设置当月mtbf,mttr,复位及时率,状态转换率,消缺及时率 * * @param companys * @param type * @param monthresultList */ private void setCenterDyInfo(String companys, String type, String yearmonth, List monthresultList) { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); // List wplsToken = tokenService.getWpls(request); List wplsToken = CacheContext.wpls; QueryWrapper qw = new QueryWrapper<>(); QueryWrapper qw1 = new QueryWrapper<>(); qw.select("foreign_key_id,sum(rmtbf) ymtbf,sum(rmttr) ymttr,avg(rfwjsl) yfwjsl,avg(rztzhjsl) yztzhjsl,avg(rgzxqjsl) ygzxqjsl"); qw1.select("foreign_key_id,avg(rxtxlpr) yxtxlpr,avg(rlsl) ylsl,avg(rnbqzhxl) ynbqzhxl"); qw.eq("location", "wp"); qw1.eq("location", "wp"); if (type.endsWith("-1")) { qw.like("foreign_key_id", "_FDC_"); qw1.like("foreign_key_id", "_FDC_"); } else if (type.endsWith("-2")) { qw.like("foreign_key_id", "_GDC_"); qw1.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { qw.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); qw1.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); } qw.eq("to_char(record_date,'yyyy-MM')", yearmonth); qw1.eq("to_char(record_date,'yyyy-MM')", yearmonth); qw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); qw1.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List dyList = proEconPowerstationInfoDay4Service.list(qw); List dy1List = proEconPowerstationInfoDay7Service.list(qw1); if (StringUtils.isNotEmpty(dyList)) { dyList.stream().forEach(i -> { SpecificCenterVo leftVo = new SpecificCenterVo(); leftVo.setWpid(i.getForeignKeyId()); leftVo.setMtbf(DoubleUtils.keepPrecision(i.getYmtbf().doubleValue(), 2)); leftVo.setMttr(DoubleUtils.keepPrecision(i.getYmttr().doubleValue(), 2)); if (type.equals("-1")) { leftVo.setFwjsl(DoubleUtils.keepPrecision(i.getYfwjsl().doubleValue(), 2)); leftVo.setZtzhl(DoubleUtils.keepPrecision(i.getYztzhjsl().doubleValue(), 2)); leftVo.setXqjsl(DoubleUtils.keepPrecision(i.getYgzxqjsl().doubleValue(), 2)); } else if (type.equals("-2")) { Optional first = dy1List.stream().filter(d -> d.getForeignKeyId().equals(i.getForeignKeyId())).findFirst(); if (first.isPresent()) { ProEconPowerstationInfoDay7 proEconPowerstationInfoDay7 = first.get(); leftVo.setFwjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYxtxlpr().doubleValue(), 2)); leftVo.setZtzhl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYlsl().doubleValue(), 2)); leftVo.setXqjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getYnbqzhxl().doubleValue(), 2)); } else { leftVo.setFwjsl(0.0); leftVo.setZtzhl(0.0); leftVo.setXqjsl(0.0); } } monthresultList.add(leftVo); }); } else { List wpls = benchmarkingService.wpByCplist(companys, type); wpls.stream().forEach(i -> { SpecificCenterVo leftVo = new SpecificCenterVo(); leftVo.setWpid(i.getId()); leftVo.setMtbf(0.0); leftVo.setMttr(0.0); leftVo.setFwjsl(0.0); leftVo.setZtzhl(0.0); leftVo.setXqjsl(0.0); monthresultList.add(leftVo); }); } } /** * 设置当年mtbf,mttr,复位及时率,状态转换率,消缺及时率 * * @param companys * @param yearresultList */ private void setCenterDnInfo(String companys, String type, String yearmonth, List yearresultList) { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); // List wplsToken = tokenService.getWpls(request); List wplsToken = CacheContext.wpls; QueryWrapper qw = new QueryWrapper<>(); QueryWrapper qw1 = new QueryWrapper<>(); qw.select("foreign_key_id,sum(rmtbf) nmtbf,sum(rmttr) nmttr,avg(rfwjsl) nfwjsl,avg(rztzhjsl) nztzhjsl,avg(rgzxqjsl) ngzxqjsl"); qw1.select("foreign_key_id,avg(rxtxlpr) nxtxlpr,avg(rlsl) nlsl,avg(rnbqzhxl) nnbqzhxl"); qw.eq("location", "wp"); qw1.eq("location", "wp"); if (type.endsWith("-1")) { qw.like("foreign_key_id", "_FDC_"); qw1.like("foreign_key_id", "_FDC_"); } else if (type.endsWith("-2")) { qw.like("foreign_key_id", "_GDC_"); qw1.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { qw.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); qw1.in("foreign_key_id", wplsToken.stream().filter(wp -> wp.getCompanyId().equals(companys)).map(wp -> wp.getId()).collect(Collectors.toList())); } qw.eq("to_char(record_date,'yyyy')", yearmonth.split("-")[0]); qw1.eq("to_char(record_date,'yyyy')", yearmonth.split("-")[0]); qw.groupBy("to_char(record_date,'yyyy'),foreign_key_id"); qw1.groupBy("to_char(record_date,'yyyy'),foreign_key_id"); List dyList = proEconPowerstationInfoDay4Service.list(qw); List dy1List = proEconPowerstationInfoDay7Service.list(qw1); if (StringUtils.isNotEmpty(dyList)) { dyList.stream().forEach(i -> { SpecificCenterVo rightVo = new SpecificCenterVo(); rightVo.setWpid(i.getForeignKeyId()); rightVo.setMtbf(DoubleUtils.keepPrecision(i.getNmtbf().doubleValue(), 2)); rightVo.setMttr(DoubleUtils.keepPrecision(i.getNmttr().doubleValue(), 2)); if (type.equals("-1")) { rightVo.setFwjsl(DoubleUtils.keepPrecision(i.getNfwjsl().doubleValue(), 2)); rightVo.setZtzhl(DoubleUtils.keepPrecision(i.getNztzhjsl().doubleValue(), 2)); rightVo.setXqjsl(DoubleUtils.keepPrecision(i.getNgzxqjsl().doubleValue(), 2)); } else if (type.equals("-2")) { Optional first = dy1List.stream().filter(d -> d.getForeignKeyId().equals(i.getForeignKeyId())).findFirst(); if (first.isPresent()) { ProEconPowerstationInfoDay7 proEconPowerstationInfoDay7 = first.get(); rightVo.setFwjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNxtxlpr().doubleValue(), 2)); rightVo.setZtzhl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNlsl().doubleValue(), 2)); rightVo.setXqjsl(DoubleUtils.keepPrecision(proEconPowerstationInfoDay7.getNnbqzhxl().doubleValue(), 2)); } else { rightVo.setFwjsl(0.0); rightVo.setZtzhl(0.0); rightVo.setXqjsl(0.0); } } yearresultList.add(rightVo); }); } else { List wpls = benchmarkingService.wpByCplist(companys, type); wpls.stream().forEach(i -> { SpecificCenterVo rightVo = new SpecificCenterVo(); rightVo.setWpid(i.getId()); rightVo.setMtbf(0.0); rightVo.setMttr(0.0); rightVo.setFwjsl(0.0); rightVo.setZtzhl(0.0); rightVo.setXqjsl(0.0); yearresultList.add(rightVo); }); } } /** * 获取风能利用率 * * @param companys * @param type * @param year * @return */ public List fnlylList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdl) yfdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdl) yfdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdl) yfdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdl) yfdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? i.getYfdl().doubleValue() / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && DateUtils.getMonth(j.getRecordDate()) == (i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? tqinfoday.getYfdl().doubleValue() / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List fnlylList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl"); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iTurbineInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl"); // sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId()); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); // vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? i.getRfdl().doubleValue() / i.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0; double rfdl = i.getRfdl() != null ? i.getRfdl().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getStationId().equals(i.getWpid()) && DateUtils.getMonth(j.getRecordDate()) == (i.getMonth())) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? tqinfoday.getRfdl().doubleValue() / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0; double rfdl = tqinfoday.getRfdl() != null ? tqinfoday.getRfdl().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List fdlList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay5Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay5Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay5Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay5Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYfdldb().doubleValue() / 10000, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> i.getWpid().equals(j.getForeignKeyId()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay5 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYfdldb().doubleValue() / 10000, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } // public List fdlList(String companys, String type, String year) { // //获取年份所有当月的数据 // QueryWrapper currentqw = new QueryWrapper<>(); // currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); //// currentqw.eq("location", "wp"); // currentqw.eq("to_char(record_date,'yyyy')", year); // if (type.equals("-1")) { // currentqw.like("station_id", "_FDC_"); // } else { // currentqw.like("station_id", "_GDC_"); // } //// if (companys.endsWith("ZGS")) { //// currentqw.eq("company_id", companys); //// } else { //// currentqw.eq("region_id", companys); //// } // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // List currentList = iStationInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); //// currentqw.eq("foreign_key_id", companys + type); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iStationInfoDayService.list(currentqw)); // // int subYear = Integer.parseInt(year) - 1; // QueryWrapper sameperiodqw = new QueryWrapper<>(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); //// sameperiodqw.eq("location", "wp"); // if (type.equals("-1")) { // currentqw.like("station_id", "_FDC_"); // } else { // currentqw.like("station_id", "_GDC_"); // } //// if (companys.endsWith("ZGS")) { //// currentqw.eq("company_id", companys); //// } else { //// currentqw.eq("region_id", companys); //// } // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // List sameperiodList = iStationInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); //// sameperiodqw.eq("foreign_key_id", companys + type); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); // // //合并当月与同期数据为返回结果 // List resultList = new ArrayList<>(); // // currentList.stream().forEach(i -> { // SpecificTargetVo vo = new SpecificTargetVo(); // String wpid = i.getStationId(); // vo.setWpid(wpid); //// if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { //// vo.setWpname(CacheContext.cpmap.get(companys).getAname()); //// } else if (wpid.contains("_RGN")) { //// vo.setWpname(CacheContext.rgmap.get(companys).getAname()); //// } else { // vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); //// } // Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); // Date date = Date.from(instant); // vo.setYear(DateUtils.getYear(date)); // vo.setMonth(DateUtils.getMonth(date)); // vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue(), 2)); // resultList.add(vo); // }); // resultList.stream().forEach(i -> { // Optional optional = sameperiodList.stream() // .filter(j -> i.getWpid().equals(j.getStationId()) // && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) // .findFirst(); // // if (optional.isPresent()) { // StationInfoDay tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue(), 2)); // i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); // } else { // i.setSameperiod(0.0); // i.setCompare(0); // } // }); // List resultendList = new ArrayList<>(); // // Map> map = new HashMap<>(); // // resultList.stream().forEach(i -> { // if (map.containsKey(i.getWpid())) { // Map integerListMap = map.get(i.getWpid()); // if (!integerListMap.containsKey(i.getMonth())) { // map.get(i.getWpid()).put(i.getMonth(), i); // } else { // // } // } else { // Map tempMap = new HashMap<>(); // tempMap.put(i.getMonth(), i); // map.put(i.getWpid(), tempMap); // } // }); // Set wpids = map.keySet(); // if (StringUtils.isNotNull(wpids)) { // wpids.stream().forEach(wpid -> { // SpecificTarget vo = new SpecificTarget(); // vo.setWpid(wpid); // int orderNum = 100; //// if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { //// vo.setWpname(CacheContext.cpmap.get(companys).getAname()); //// } else if (wpid.contains("_RGN")) { //// vo.setWpname(CacheContext.rgmap.get(companys).getAname()); //// } else { // vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); //// } // vo.setOrderNum(orderNum); // List tempList = new ArrayList<>(); // // Map listMap = map.get(wpid); // for (int x = 1; x <= 12; x++) { // if (listMap.containsKey(x)) { // tempList.add(listMap.get(x)); // } else { // SpecificTargetVo vo1 = new SpecificTargetVo(); // vo1.setWpid(wpid); //// if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { //// vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); //// } else if (wpid.contains("_RGN")) { //// vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); //// } else { // vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); //// } // vo1.setYear(Integer.parseInt(year)); // vo1.setMonth(x); // tempList.add(vo1); // } // } // // // vo.setTargetList(tempList); // resultendList.add(vo); // }); // } // SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); // // return resultendList; // } public List fdlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iStationInfoDayService.list(currentqw); currentqw.clear(); currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); currentList.addAll(iStationInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iStationInfoDayService.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); vo.setYear(DateUtils.getYear(date)); vo.setMonth(DateUtils.getMonth(date)); vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> i.getWpid().equals(j.getStationId()) && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) .findFirst(); if (optional.isPresent()) { StationInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List zhcydlList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rzhcydldb) yzhcydldb"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay5Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rzhcydldb) yzhcydldb"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay5Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rzhcydldb) yzhcydldb"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay5Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rzhcydldb) yzhcydldb"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay5Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYzhcydldb().doubleValue() / 10000, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay5 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYzhcydldb().doubleValue() / 10000, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List zhcydlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(cydl) cydl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iStationInfoDayService.list(currentqw); currentqw.clear(); currentqw.select("station_id,max(record_date) record_date,sum(cydl) cydl"); // currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); currentList.addAll(iStationInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(cydl) cydl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iStationInfoDayService.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("station_id,max(record_date) record_date,sum(cydl) cydl"); // sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); vo.setYear(DateUtils.getYear(date)); vo.setMonth(DateUtils.getMonth(date)); vo.setCurrent(DoubleUtils.keepPrecision(i.getCydl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .filter(j -> j.getStationId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) .findFirst(); if (optional.isPresent()) { StationInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getCydl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List gwdlList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rgwgwdldb) ygwgwdldb"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay5Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rgwgwdldb) ygwgwdldb"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay5Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rgwgwdldb) ygwgwdldb"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay5Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rgwgwdldb) ygwgwdldb"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay5Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYgwgwdldb().doubleValue() / 10000, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay5 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYgwgwdldb().doubleValue() / 10000, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List gwdlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(gwdl) gwdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iStationInfoDayService.list(currentqw); currentqw.clear(); currentqw.select("station_id,max(record_date) record_date,sum(gwdl) gwdl"); // currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); currentList.addAll(iStationInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(gwdl) gwdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iStationInfoDayService.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("station_id,max(record_date) record_date,sum(gwdl) gwdl"); // sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); vo.setYear(DateUtils.getYear(date)); vo.setMonth(DateUtils.getMonth(date)); vo.setCurrent(DoubleUtils.keepPrecision(i.getGwdl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getStationId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) .findFirst(); if (optional.isPresent()) { StationInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getGwdl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List swdlList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rswdldb) yswdldb"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay5Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rswdldb) yswdldb"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay5Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rswdldb) yswdldb"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay5Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rswdldb) yswdldb"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay5Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYswdldb().doubleValue() / 10000, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay5 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYswdldb().doubleValue() / 10000, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List swdlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(swdl) swdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iStationInfoDayService.list(currentqw); currentqw.clear(); currentqw.select("station_id,max(record_date) record_date,sum(swdl) swdl"); // currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); currentList.addAll(iStationInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(swdl) swdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iStationInfoDayService.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("station_id,max(record_date) record_date,sum(swdl) swdl"); // sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); vo.setYear(DateUtils.getYear(date)); vo.setMonth(DateUtils.getMonth(date)); vo.setCurrent(DoubleUtils.keepPrecision(i.getSwdl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getStationId().equals(i.getWpid()) && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) .findFirst(); if (optional.isPresent()) { StationInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getSwdl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List lyxsList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay5Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay5Service.list(currentqw)); // int subYear = Integer.parseInt(year) - 1; int subYear = Integer.parseInt(year); QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay5Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rfdldb) yfdldb"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay5Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); List rl = CacheContext.wpls.stream().filter(wp -> wpid.equals(wp.getId())).collect(Collectors.toList()); List gsrl = CacheContext.cpls.stream().filter(wp -> wpid.contains(wp.getId())).collect(Collectors.toList()); double capacity = 1; if (!rl.isEmpty() && rl.size() > 0) { capacity = (rl.get(0).getJrCapacity() / 10000) + (rl.get(0).getJrwindCapacity() / 10000); } else { capacity = (gsrl.get(0).getJrCapacity() / 10000) + (gsrl.get(0).getJrwindCapacity() / 10000); } vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision((i.getYfdldb().doubleValue() / 10000) / capacity, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> i.getWpid().equals(j.getForeignKeyId()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); List rl = CacheContext.wpls.stream().filter(wp -> i.getWpid().equals(wp.getId())).collect(Collectors.toList()); List gsrl = CacheContext.cpls.stream().filter(wp -> i.getWpid().contains(wp.getId())).collect(Collectors.toList()); double capacity = 1; if (!rl.isEmpty() && rl.size() > 0) { capacity = (rl.get(0).getJrCapacity() / 10000) + (rl.get(0).getJrwindCapacity() / 10000); } else { capacity = (gsrl.get(0).getJrCapacity() / 10000) + (gsrl.get(0).getJrwindCapacity() / 10000); } if (optional.isPresent()) { ProEconPowerstationInfoDay5 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(((tqinfoday.getYfdldb().doubleValue() / 10000)) / capacity, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List lyxsList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(lyxs) lyxs"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); int subYear = Integer.parseInt(year); QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(lyxs) lyxs"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear-1)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(i.getLyxs()/50); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> i.getWpid().equals(j.getStationId()) && i.getMonth().equals(DateUtils.getMonthFromDate(j.getRecordDate()))) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); i.setSameperiod(tqinfoday.getLyxs()/50); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List lyxsList3(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iStationInfoDayService.list(currentqw); currentqw.clear(); currentqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); // currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); currentList.addAll(iStationInfoDayService.list(currentqw)); // int subYear = Integer.parseInt(year) - 1; int subYear = Integer.parseInt(year); QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iStationInfoDayService.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl_fj) rfdl_fj"); // sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); sameperiodList.addAll(iStationInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); List rl = CacheContext.wpls.stream().filter(wp -> wpid.equals(wp.getId())).collect(Collectors.toList()); List gsrl = CacheContext.cpls.stream().filter(wp -> wpid.contains(wp.getId())).collect(Collectors.toList()); double capacity = 1; if (!rl.isEmpty() && rl.size() > 0) { capacity = (rl.get(0).getJrCapacity()) + (rl.get(0).getJrwindCapacity()); } else { capacity = (gsrl.get(0).getJrCapacity()) + (gsrl.get(0).getJrwindCapacity()); } vo.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); Date date = Date.from(instant); vo.setYear(DateUtils.getYear(date)); vo.setMonth(DateUtils.getMonth(date)); vo.setCurrent(DoubleUtils.keepPrecision((i.getRfdlFj().doubleValue()) / capacity, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> i.getWpid().equals(j.getStationId()) && i.getMonth().equals(DateUtils.getMonthFromDate(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())))) .findFirst(); List rl = CacheContext.wpls.stream().filter(wp -> i.getWpid().equals(wp.getId())).collect(Collectors.toList()); List gsrl = CacheContext.cpls.stream().filter(wp -> i.getWpid().contains(wp.getId())).collect(Collectors.toList()); double capacity = 1; if (!rl.isEmpty() && rl.size() > 0) { capacity = (rl.get(0).getJrCapacity()) + (rl.get(0).getJrwindCapacity()); } else { capacity = (gsrl.get(0).getJrCapacity()) + (gsrl.get(0).getJrwindCapacity()); } if (optional.isPresent()) { StationInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(((tqinfoday.getRfdlFj().doubleValue())) / capacity, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS")|| wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List gzsslList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rgzssdl) ygzssdl,sum(rcnslgzssdl) ycnslgzssdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rgzssdl) ygzssdl,sum(rcnslgzssdl) ycnslgzssdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rgzssdl) ygzssdl,sum(rcnslgzssdl) ycnslgzssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rgzssdl) ygzssdl,sum(rcnslgzssdl) ycnslgzssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYgzssdl().doubleValue() + i.getYcnslgzssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYgzssdl().doubleValue() + tqinfoday.getYcnslgzssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List gzsslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("station_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl"); // currentqw.eq("station_id", CacheContext.wplsf.get(0).getId()); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iTurbineInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { // currentqw.eq("station_id", companys); // } else { // currentqw.eq("station_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl"); // sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId()); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (companys.endsWith("ZGS") || companys.endsWith("FGS")) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } // Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); // Date date2 = Date.from(instant); vo.setYear(i.getRecordDate().getYear()+1900); vo.setMonth(i.getRecordDate().getMonth()+1); // vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getGzss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0; double rfdl = i.getGzss() != null ? i.getGzss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getGzss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0; double rfdl = tqinfoday.getGzss() != null ? tqinfoday.getGzss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List whsslList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYjxssdl().doubleValue() + i.getYcnsljxssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYjxssdl().doubleValue() + tqinfoday.getYcnsljxssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } // public List whsslList(String companys, String type, String year) { // //获取年份所有当月的数据 // QueryWrapper currentqw = new QueryWrapper<>(); // currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); // currentqw.eq("location", "wp"); // currentqw.eq("to_char(record_date,'yyyy')", year); // if (type.equals("-1")) { // currentqw.like("foreign_key_id", "_FDC_"); // } else { // currentqw.like("foreign_key_id", "_GDC_"); // } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } // currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); // List currentList = proEconPowerstationInfoDay1Service.list(currentqw); // currentqw.clear(); // currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); // currentqw.eq("foreign_key_id", companys + type); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); // currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); // // int subYear = Integer.parseInt(year) - 1; // QueryWrapper sameperiodqw = new QueryWrapper<>(); // sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); // sameperiodqw.eq("location", "wp"); // if (type.equals("-1")) { // currentqw.like("foreign_key_id", "_FDC_"); // } else { // currentqw.like("foreign_key_id", "_GDC_"); // } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); // List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl"); // sameperiodqw.eq("foreign_key_id", companys + type); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); // sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); // // //合并当月与同期数据为返回结果 // List resultList = new ArrayList<>(); // // currentList.stream().forEach(i -> { // SpecificTargetVo vo = new SpecificTargetVo(); // String wpid = i.getForeignKeyId(); // vo.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { // vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } // vo.setYear(DateUtils.getYear(i.getRecordDate())); // vo.setMonth(DateUtils.getMonth(i.getRecordDate())); // vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYjxssdl().doubleValue() + i.getYcnsljxssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); // resultList.add(vo); // }); // resultList.stream().forEach(i -> { // Optional optional = sameperiodList.stream() // .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) // .findFirst(); // if (optional.isPresent()) { // ProEconPowerstationInfoDay1 tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYjxssdl().doubleValue() + tqinfoday.getYcnsljxssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); // i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); // } else { // i.setSameperiod(0.0); // i.setCompare(0); // } // }); // List resultendList = new ArrayList<>(); // // Map> map = new HashMap<>(); // // resultList.stream().forEach(i -> { // if (map.containsKey(i.getWpid())) { // Map integerListMap = map.get(i.getWpid()); // if (!integerListMap.containsKey(i.getMonth())) { // map.get(i.getWpid()).put(i.getMonth(), i); // } else { // // } // } else { // Map tempMap = new HashMap<>(); // tempMap.put(i.getMonth(), i); // map.put(i.getWpid(), tempMap); // } // }); // Set wpids = map.keySet(); // if (StringUtils.isNotNull(wpids)) { // wpids.stream().forEach(wpid -> { // SpecificTarget vo = new SpecificTarget(); // vo.setWpid(wpid); // int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { // vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } // vo.setOrderNum(orderNum); // List tempList = new ArrayList<>(); // // Map listMap = map.get(wpid); // for (int x = 1; x <= 12; x++) { // if (listMap.containsKey(x)) { // tempList.add(listMap.get(x)); // } else { // SpecificTargetVo vo1 = new SpecificTargetVo(); // vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { // vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } // vo1.setYear(Integer.parseInt(year)); // vo1.setMonth(x); // tempList.add(vo1); // } // } // // vo.setTargetList(tempList); // resultendList.add(vo); // }); // } // SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); // // return resultendList; // } public List whsslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(jhjxss) jhjxss,sum(fjhjxss) fjhjxss,sum(llfdl) llfdl"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(jhjxss) jhjxss,sum(fjhjxss) fjhjxss,sum(llfdl) llfdl"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0; double rfdl = i.getJhjxss().doubleValue() + i.getFjhjxss().doubleValue() != 0 ? i.getJhjxss().doubleValue() + i.getFjhjxss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } vo.setYear(i.getRecordDate().getYear()+1900); vo.setMonth(i.getRecordDate().getMonth()+1); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0; double rfdl = tqinfoday.getJhjxss() != null ? tqinfoday.getJhjxss().doubleValue() + tqinfoday.getFjhjxss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xdsslList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rxdtjssdl) yxdtjssdl,sum(rxdjclssdl) yxdjclssdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rxdtjssdl) yxdtjssdl,sum(rxdjclssdl) yxdjclssdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rxdtjssdl) yxdtjssdl,sum(rxdjclssdl) yxdjclssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rxdtjssdl) yxdtjssdl,sum(rxdjclssdl) yxdjclssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYxdjclssdl().doubleValue() + i.getYxdtjssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYxdjclssdl().doubleValue() + tqinfoday.getYxdtjssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xdsslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl"); //// currentqw.eq("foreign_key_id", companys + type); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iTurbineInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl"); //// sameperiodqw.eq("foreign_key_id", companys + type); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } // Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); // Date date = Date.from(instant); vo.setYear(i.getRecordDate().getYear()+1900); vo.setMonth(i.getRecordDate().getMonth()+1); // vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXdss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0; double rfdl = i.getXdss() != null ? i.getXdss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXdss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0; double rfdl = tqinfoday.getXdss() != null ? tqinfoday.getXdss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xnsslList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) yqxjclssdl,sum(rsdtjssdl) ysdtjssdl,sum(rxnssdl) yxnssdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) yqxjclssdl,sum(rsdtjssdl) ysdtjssdl,sum(rxnssdl) yxnssdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) yqxjclssdl,sum(rsdtjssdl) ysdtjssdl,sum(rxnssdl) yxnssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rdjssdl) ydjssdl,sum(rqxjclssdl) yqxjclssdl,sum(rsdtjssdl) ysdtjssdl,sum(rxnssdl) yxnssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYdjssdl().doubleValue() + i.getYqxjclssdl().doubleValue() + i.getYsdtjssdl().doubleValue() + i.getYxnssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYdjssdl().doubleValue() + tqinfoday.getYqxjclssdl().doubleValue() + tqinfoday.getYsdtjssdl().doubleValue() + tqinfoday.getYxnssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xnsslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl"); //// currentqw.eq("foreign_key_id", companys + type); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iTurbineInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl"); //// sameperiodqw.eq("station_id", companys + type); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } // Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); // Date date = Date.from(instant); vo.setYear(i.getRecordDate().getYear()+1900); vo.setMonth(i.getRecordDate().getMonth()+1); // vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXnss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0; double rfdl = i.getXnss() != null ? i.getXnss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXnss().doubleValue()) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0; double rfdl = tqinfoday.getXnss() != null ? tqinfoday.getXnss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List slsslList2(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl,sum(rllfdl) yllfdl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay1Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl,sum(rllfdl) yllfdl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rcwsldwssdl) ycwsldwssdl,sum(rcwsltqssdl) ycwsltqssdl,sum(rllfdl) yllfdl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYcwsldwssdl().doubleValue() + i.getYcwsltqssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay1 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYcwsldwssdl().doubleValue() + tqinfoday.getYcwsltqssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List slsslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl"); // currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List currentList = iTurbineInfoDayService.list(currentqw); // currentqw.clear(); // currentqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl"); //// currentqw.eq("foreign_key_id", companys + type); // currentqw.eq("to_char(record_date,'yyyy')", year); // currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // currentList.addAll(iTurbineInfoDayService.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl"); // sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("station_id", "_FDC_"); } else { currentqw.like("station_id", "_GDC_"); } // if (companys.endsWith("ZGS")) { // currentqw.eq("company_id", companys); // } else { // currentqw.eq("region_id", companys); // } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); List sameperiodList = iTurbineInfoDayService.list(sameperiodqw); // sameperiodqw.clear(); // sameperiodqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl"); // sameperiodqw.eq("station_id", companys + type); // sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); // sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id"); // sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getStationId(); vo.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } // Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant(); // Date date = Date.from(instant); vo.setYear(i.getRecordDate().getYear()+1900); vo.setMonth(i.getRecordDate().getMonth()+1); // vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getSlss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0; double rfdl = i.getSlss() != null ? i.getSlss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); vo.setCurrent(calculatedValue); } else { vo.setCurrent(0.0); } resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() // .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { TurbineInfoDay tqinfoday = optional.get(); // i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getSlss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2)); double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0; double rfdl = tqinfoday.getSlss() != null ? tqinfoday.getSlss().doubleValue() : 0.0; if (llfdl != 0) { Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2); i.setSameperiod(calculatedValue); } else { i.setSameperiod(0.0); } i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); // } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); // if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { // vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); // } else if (wpid.contains("_RGN")) { // vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); // } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); // } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); SpecificTarget vo2 = new SpecificTarget(); vo2.setWpid(vo.getWpid()); vo2.setTargetList(vo.getTargetList()); vo2.setOrderNum(vo.getOrderNum() + 1); vo2.setWpname(CacheContext.cpmap.get(companys).getAname()); resultendList.add(vo2); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List fwjslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yfwjsl) yfwjsl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay4Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yfwjsl) yfwjsl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay4Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yfwjsl) yfwjsl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay4Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yfwjsl) yfwjsl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay4Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYfwjsl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay4 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYfwjsl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List ztzhlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yztzhjsl) yztzhjsl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay4Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yztzhjsl) yztzhjsl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay4Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yztzhjsl) yztzhjsl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay4Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yztzhjsl) yztzhjsl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay4Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYztzhjsl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay4 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYztzhjsl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS")) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xqjslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ygzxqjsl) ygzxqjsl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay4Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ygzxqjsl) ygzxqjsl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay4Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ygzxqjsl) ygzxqjsl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay4Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ygzxqjsl) ygzxqjsl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay4Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYgzxqjsl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay4 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYgzxqjsl().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS")) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List mtbfList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rmtbf) ymtbf"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay4Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rmtbf) ymtbf"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay4Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rmtbf) ymtbf"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay4Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rmtbf) ymtbf"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay4Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYmtbf().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay4 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYmtbf().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List mttrList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rmttr) ymttr"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay4Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,sum(rmttr) ymttr"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay4Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rmttr) ymttr"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay4Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rmttr) ymttr"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay4Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYmttr().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay4 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYmttr().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List xtxlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yxtxlpr) yxtxlpr"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay7Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(yxtxlpr) yxtxlpr"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay7Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yxtxlpr) yxtxlpr"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay7Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(yxtxlpr) yxtxlpr"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay7Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYxtxlpr().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay7 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYxtxlpr().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS")) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List lslList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ylsl) ylsl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay7Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ylsl) ylsl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay7Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ylsl) ylsl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay7Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ylsl) ylsl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay7Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYlsl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay7 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYxtxlpr().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS")) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } public List zhxlList(String companys, String type, String year) { //获取年份所有当月的数据 QueryWrapper currentqw = new QueryWrapper<>(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ynbqzhxl) ynbqzhxl"); currentqw.eq("location", "wp"); currentqw.eq("to_char(record_date,'yyyy')", year); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List currentList = proEconPowerstationInfoDay7Service.list(currentqw); currentqw.clear(); currentqw.select("foreign_key_id,max(record_date) record_date,avg(ynbqzhxl) ynbqzhxl"); currentqw.eq("foreign_key_id", companys + type); currentqw.eq("to_char(record_date,'yyyy')", year); currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); currentList.addAll(proEconPowerstationInfoDay7Service.list(currentqw)); int subYear = Integer.parseInt(year) - 1; QueryWrapper sameperiodqw = new QueryWrapper<>(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ynbqzhxl) ynbqzhxl"); sameperiodqw.eq("location", "wp"); if (type.equals("-1")) { currentqw.like("foreign_key_id", "_FDC_"); } else { currentqw.like("foreign_key_id", "_GDC_"); } if (companys.endsWith("ZGS")) { currentqw.eq("company_id", companys); } else { currentqw.eq("region_id", companys); } sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); List sameperiodList = proEconPowerstationInfoDay7Service.list(sameperiodqw); sameperiodqw.clear(); sameperiodqw.select("foreign_key_id,max(record_date) record_date,avg(ynbqzhxl) ynbqzhxl"); sameperiodqw.eq("foreign_key_id", companys + type); sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear)); sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id"); sameperiodList.addAll(proEconPowerstationInfoDay7Service.list(sameperiodqw)); //合并当月与同期数据为返回结果 List resultList = new ArrayList<>(); currentList.stream().forEach(i -> { SpecificTargetVo vo = new SpecificTargetVo(); String wpid = i.getForeignKeyId(); vo.setWpid(wpid); if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo.setYear(DateUtils.getYear(i.getRecordDate())); vo.setMonth(DateUtils.getMonth(i.getRecordDate())); vo.setCurrent(DoubleUtils.keepPrecision(i.getYnbqzhxl().doubleValue(), 2)); resultList.add(vo); }); resultList.stream().forEach(i -> { Optional optional = sameperiodList.stream() .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth())) .findFirst(); if (optional.isPresent()) { ProEconPowerstationInfoDay7 tqinfoday = optional.get(); i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYxtxlpr().doubleValue(), 2)); i.setCompare(i.getCurrent().compareTo(i.getSameperiod())); } else { i.setSameperiod(0.0); i.setCompare(0); } }); List resultendList = new ArrayList<>(); Map> map = new HashMap<>(); resultList.stream().forEach(i -> { if (map.containsKey(i.getWpid())) { Map integerListMap = map.get(i.getWpid()); if (!integerListMap.containsKey(i.getMonth())) { map.get(i.getWpid()).put(i.getMonth(), i); } else { } } else { Map tempMap = new HashMap<>(); tempMap.put(i.getMonth(), i); map.put(i.getWpid(), tempMap); } }); Set wpids = map.keySet(); if (StringUtils.isNotNull(wpids)) { wpids.stream().forEach(wpid -> { SpecificTarget vo = new SpecificTarget(); vo.setWpid(wpid); int orderNum = 100; if (wpid.contains("_ZGS")) { vo.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo.setWpname(CacheContext.wpmap.get(wpid).getAname()); orderNum = CacheContext.wpmap.get(wpid).getOrderNum(); } vo.setOrderNum(orderNum); List tempList = new ArrayList<>(); Map listMap = map.get(wpid); for (int x = 1; x <= 12; x++) { if (listMap.containsKey(x)) { tempList.add(listMap.get(x)); } else { SpecificTargetVo vo1 = new SpecificTargetVo(); vo1.setWpid(wpid); if (wpid.contains("_ZGS")) { vo1.setWpname(CacheContext.cpmap.get(companys).getAname()); } else if (wpid.contains("_RGN")) { vo1.setWpname(CacheContext.rgmap.get(companys).getAname()); } else { vo1.setWpname(CacheContext.wpmap.get(wpid).getAname()); } vo1.setYear(Integer.parseInt(year)); vo1.setMonth(x); tempList.add(vo1); } } vo.setTargetList(tempList); resultendList.add(vo); }); } SortUtils.sort(resultendList, "orderNum", SortUtils.ASC); return resultendList; } }