Browse Source

#首页风电修改

zhongwei
yang_shj 9 months ago
parent
commit
b82a556d2f
  1. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java
  2. 11
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java
  3. 22
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java
  4. 37
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java
  5. 49
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  6. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/WindMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.scheduled.mapper.operation;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface WindMapper extends UserDataScopeBaseMapper<WindEntity> {
}

11
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/WindService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.scheduled.service.operation.fill;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface WindService extends BaseService<WindEntity> {
}

22
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/fill/impl/WindServiceImpl.java

@ -0,0 +1,22 @@
package com.hnac.hzims.scheduled.service.operation.fill.impl;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.scheduled.mapper.operation.WindMapper;
import com.hnac.hzims.scheduled.service.operation.fill.WindService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author ysj
*/
@Slf4j
@Service
@AllArgsConstructor
public class WindServiceImpl extends BaseServiceImpl<WindMapper, WindEntity> implements WindService {
}

37
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java

@ -31,6 +31,7 @@ import com.hnac.hzims.scheduled.service.operation.plate.DataService;
import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzims.scheduled.service.ticket.TicketService; import com.hnac.hzims.scheduled.service.ticket.TicketService;
import com.hnac.hzims.scheduled.service.ticket.WorkTicketService; import com.hnac.hzims.scheduled.service.ticket.WorkTicketService;
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO;
@ -53,6 +54,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -75,6 +77,7 @@ public class ShowServiceImpl implements ShowService {
private final TaskService taskService; private final TaskService taskService;
private final OverService overService; private final OverService overService;
private final PlanService planService; private final PlanService planService;
private final WindService windService;
private final PowerService powerService; private final PowerService powerService;
private final SolveService solveService; private final SolveService solveService;
private final OtherService otherService; private final OtherService otherService;
@ -318,27 +321,35 @@ public class ShowServiceImpl implements ShowService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return target; return target;
} }
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{ // 计划发电量
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); List<PlanGenerationEntity> plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null, DateUtil.format(new Date(),"yyyy"));
eq("type", HomePageConstant.WIND_POWER_TYPE); // 填报信息
likeRight("mon", DateUtil.format(new Date(),"yyyy")); List<WindEntity> winds = windService.list(Wrappers.<WindEntity>lambdaQuery()
}}; .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
List<PowerEntity> list = powerService.list(queryWrapper); .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy")));
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(winds)){
return target; return target;
} }
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); double power = winds.stream().mapToDouble(WindEntity::getPower).sum();
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 装机容量 // 装机容量
target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); target.setTaget_one(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum());
// 发电量 // 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); target.setTaget_two(power);
if(Math.abs(plan) > 0){ if(Math.abs(plan) > 0){
// 发电完成率 // 发电完成率
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
} }
// 双票合格率 // 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
R<List<Dept>> result = sysClient.getDeptList();
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList());
DoublePassRateVO pass = ticketService.doublePassRate(areas, firstDateTime, LocalDateTime.now());
if (ObjectUtil.isNotEmpty(pass)) {
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
return target; return target;
} }

49
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -55,6 +55,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
@ -75,6 +76,8 @@ public class TargetServiceImpl implements TargetService {
private final OverService overService; private final OverService overService;
private final WindService windService;
private final PowerService powerService; private final PowerService powerService;
private final SolveService solveService; private final SolveService solveService;
@ -232,19 +235,19 @@ public class TargetServiceImpl implements TargetService {
}else{ }else{
// 查询填报数据 // 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy"); String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) .in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01") .ge(WindEntity::getFillDate, mon + "-01")
); );
electrics = stations.stream().map(station -> { electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo(); ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName()); item.setStationName(station.getName());
// 发电量 // 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){ if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0); item.setElectricGeneration(0.0);
}else{ }else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(WindEntity::getFillDate).reversed()).collect(Collectors.toList()).get(0).getPower());
} }
item.setDetail("站点为填报数据,暂无设备装机发电量信息!"); item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item; return item;
@ -356,24 +359,32 @@ public class TargetServiceImpl implements TargetService {
return item; return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList()); }).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{ }else{
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
String mon = DateUtil.format(new Date(),"yyyy"); String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery() List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())) .in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01") .ge(WindEntity::getFillDate, mon + "-01")
); );
generations = stations.stream().map(station -> { generations = stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo(); CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName()); item.setStationName(station.getName());
if(CollectionUtil.isEmpty(plans)){
item.setPlanGeneration(0.0);
}else{
item.setPlanGeneration(plans.stream().filter(plan->plan.getStationId().equals(station.getCode())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
}
// 发电量 // 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList()); List<WindEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){ if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0); item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{ }else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear()); item.setRealityGeneration(stationPowers.stream().mapToDouble(WindEntity::getPower).sum());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear()); }
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear())); if(Math.abs(item.getPlanGeneration()) <= 0 || Math.abs(item.getRealityGeneration()) <= 0){
item.setCompleteRate(100.0);
}else{
item.setCompleteRate(BigDecimal.valueOf(item.getRealityGeneration() / item.getPlanGeneration() * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
} }
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -389,13 +400,6 @@ public class TargetServiceImpl implements TargetService {
*/ */
@Override @Override
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) { public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) {
// 光伏/风电双票填报数据
if(HomePageConstant.WIND_POWER.equals(type) || HomePageConstant.PHOTOVOLTAIC.equals(type)){
List<CompleteTicketVo> completes = this.getcompleteFillTicket(areaName,type);
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 平台业务数据 // 平台业务数据
List<Integer> types; List<Integer> types;
if(HomePageConstant.WATER_CONSERVANCY.equals(type)){ if(HomePageConstant.WATER_CONSERVANCY.equals(type)){
@ -437,6 +441,7 @@ public class TargetServiceImpl implements TargetService {
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
} }
completes.add(completeTicketVo); completes.add(completeTicketVo);
countDownLatch.countDown();
} }
}else{ }else{
for (Dept dept: areas) { for (Dept dept: areas) {
@ -459,9 +464,9 @@ public class TargetServiceImpl implements TargetService {
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate()); completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
} }
completes.add(completeTicketVo); completes.add(completeTicketVo);
countDownLatch.countDown();
} }
} }
countDownLatch.countDown();
}); });
// 等待所有线程执行完成 // 等待所有线程执行完成
try { try {

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -39,6 +39,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -276,7 +277,7 @@ public class HomeServiceImpl implements HomeService {
target.setTaget_two(power); target.setTaget_two(power);
if(Math.abs(plan) > 0){ if(Math.abs(plan) > 0){
// 发电完成率 // 发电完成率
target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
} }
// 双票合格率 // 双票合格率
LocalDate firstDay = LocalDate.now().withDayOfYear(1); LocalDate firstDay = LocalDate.now().withDayOfYear(1);

Loading…
Cancel
Save