|
|
|
@ -17,6 +17,7 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
|
|
|
|
|
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; |
|
|
|
|
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; |
|
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; |
|
|
|
|
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
|
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
|
import com.hnac.hzims.operational.main.entity.UserDeptEntity; |
|
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
@ -800,7 +801,7 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
private List<PowerYearVo> generateThreeYear(List<String> stations,Map<String, Map<String, Float>> map) { |
|
|
|
|
List<Map<String, Float>> filter = map.entrySet().stream().filter(entry -> stations.contains(entry.getKey())).map(Map.Entry::getValue).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(filter)) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
return this.defaultThreeYear(); |
|
|
|
|
} |
|
|
|
|
// 根据月份分组
|
|
|
|
|
List<PowerMonthVo> powerMonthVos = new ArrayList<>(); |
|
|
|
@ -837,6 +838,47 @@ public class HydropowerServiceImpl implements HydropowerService {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 默认结构 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<PowerYearVo> defaultThreeYear() { |
|
|
|
|
List<String> mons = this.mons(2,12,false); |
|
|
|
|
// 返回结果
|
|
|
|
|
// 根据月份分组
|
|
|
|
|
List<PowerMonthVo> powerMonthVos = new ArrayList<>(); |
|
|
|
|
mons.forEach(item -> { |
|
|
|
|
PowerMonthVo powerMonthVo = new PowerMonthVo(); |
|
|
|
|
powerMonthVo.setStrMonth(item); |
|
|
|
|
powerMonthVo.setPower(0f); |
|
|
|
|
powerMonthVos.add(powerMonthVo); |
|
|
|
|
}); |
|
|
|
|
Map<String, List<PowerMonthVo>> months = powerMonthVos.stream().collect(Collectors.groupingBy(PowerMonthVo::getStrMonth)); |
|
|
|
|
// 总和所有相同月份的发电量
|
|
|
|
|
List<PowerMonthVo> powerMonthVoList = months.entrySet().stream().map(entry -> { |
|
|
|
|
PowerMonthVo powerMonth = new PowerMonthVo(); |
|
|
|
|
powerMonth.setStrMonth(entry.getKey()); |
|
|
|
|
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), entry.getKey()), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); |
|
|
|
|
powerMonth.setYear(localDate.getYear()); |
|
|
|
|
powerMonth.setMonth(localDate.getMonthValue()); |
|
|
|
|
powerMonth.setPower((float) entry.getValue().stream().mapToDouble(PowerMonthVo::getPower).sum()); |
|
|
|
|
return powerMonth; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
// 根据年份分组
|
|
|
|
|
Map<Integer, List<PowerMonthVo>> year = powerMonthVoList.stream().collect(Collectors.groupingBy(PowerMonthVo::getYear)); |
|
|
|
|
// 返回结果集
|
|
|
|
|
return year.entrySet().stream().map(entry -> { |
|
|
|
|
PowerYearVo powerYearVo = new PowerYearVo(); |
|
|
|
|
powerYearVo.setYear(entry.getKey()); |
|
|
|
|
List<PowerMonthVo> sortValue = entry.getValue().stream().sorted(Comparator.comparing(PowerMonthVo::getMonth)).collect(Collectors.toList()); |
|
|
|
|
powerYearVo.setPowerMonthVoList(sortValue); |
|
|
|
|
return powerYearVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*=====================================================app=====================================================*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|