优化月核定流量列表接口

master
cxw 2024-11-14 16:20:30 +08:00
parent 0704035698
commit 029d92fc07
1 changed files with 4 additions and 3 deletions

View File

@ -149,10 +149,11 @@ public class StWaterRController {
wrapper.orderBy(true, ObjectUtils.isEmpty(stWaterR.getIsAsc()) ? false : stWaterR.getIsAsc(), stWaterR.getOrderField());
}
list = service.list(wrapper);
if(CollectionUtils.isNotEmpty(list)){
ResMonthEcoFlow monthFlow = resMonthEcoFlowService.getOne(new QueryWrapper<ResMonthEcoFlow>().eq("month", Integer.valueOf(DateUtil.getYM().substring(4))));
BigDecimal value = monthFlow.getValue();
List<ResMonthEcoFlow> resMonthEcoFlows = resMonthEcoFlowService.list();
if(CollectionUtils.isNotEmpty(list) && CollectionUtils.isNotEmpty(resMonthEcoFlows)){
Map<Integer, BigDecimal> resMonthEcoFlowMap = resMonthEcoFlows.stream().collect(Collectors.toMap(ResMonthEcoFlow::getMonth, ResMonthEcoFlow::getValue));
list.stream().forEach(w -> {
BigDecimal value = resMonthEcoFlowMap.get(w.getTm().getMonth());
w.setApprovalV(value);
w.setIsStandard(w.getQ().compareTo(value) >= 0 ? true : false);
});