Browse Source

#检修流程

zhongwei
yang_shj 1 year ago
parent
commit
a8d0b8a4e6
  1. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java
  2. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WindHomeController.java
  4. 92
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WindScoreVo.java

@ -36,10 +36,18 @@ public class WindScoreVo {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon;
@ApiModelProperty(value = "年计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double planYear;
@ApiModelProperty(value = "年总发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateYear;
@ApiModelProperty(value = "年发电量完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double completeRate;
@ApiModelProperty(value = "月平均风速")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double speedRate;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -198,6 +198,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
entity.setTaskName("流程结束");
entity.setNextStepOperator("流程结束,无需人员处理");
entity.setActEndTime(new Date());
entity.setStatus(4);
// 开启检修任务
this.startTaskProcess(entity);
return this.planService.updateById(entity);
@ -228,6 +229,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
for(OperAccessContentDTO item : entity.getAccessContents()){
//任务参数
AccessTaskV4DTO task = BeanUtil.copy(item, AccessTaskV4DTO.class);
task.setStatus(1);
task.setCreateTime(new Date());
task.setCreateUser(entity.getCreateUser());
task.setProcDefId(entity.getProcDefId());

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WindHomeController.java

@ -27,7 +27,7 @@ public class WindHomeController extends BladeController {
private final WindHomeService service;
@ApiLog
@ApiOperation("电站集团/区域指标")
@ApiOperation("电站集团/区域指标")
@GetMapping("/KPIs")
@ApiOperationSupport(order = 1)
public R<WindScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {

92
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -1,11 +1,24 @@
package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.operational.fill.service.WindService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.WindHomeService;
import com.hnac.hzims.operational.main.vo.WindScoreVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@ -14,8 +27,85 @@ import org.springframework.stereotype.Service;
@Slf4j
public class WindHomeServiceImpl implements WindHomeService {
private final IStationService stationService;
private final WindService windService;
@Override
public WindScoreVo KPIs(Long deptId) {
return null;
// 查询风电站
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE);
eq(StationEntity::getType,HomePageConstant.WIND_POWER);
}});
if(CollectionUtil.isNotEmpty(stations)){
return new WindScoreVo();
}
// 查询站点年填报数据
List<WindEntity> years = windService.list(new LambdaQueryWrapper<WindEntity>() {{
like(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy"));
in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
}});
// 查询站点月填报数据
List<WindEntity> mons = windService.list(new LambdaQueryWrapper<WindEntity>() {{
like(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy-MM"));
in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
}});
// 查询站点日填报数据
List<WindEntity> days = windService.list(new LambdaQueryWrapper<WindEntity>() {{
like(WindEntity::getFillDate, DateUtil.format(new Date(), DateUtil.format(new Date(),DateUtil.PATTERN_DATE)));
in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
}});
WindScoreVo score = new WindScoreVo();
score.setStationCount(stations.size());
this.year(years,score);
this.mon(mons,score);
this.days(days,score);
return score;
}
/**
* 风电数据 -
* @param years
* @param score
*/
private void year(List<WindEntity> years, WindScoreVo score) {
if(CollectionUtil.isNotEmpty(years)){
return;
}
// 年发电量
score.setGenerateYear(years.stream().mapToDouble(WindEntity::getPower).sum());
// 年计划发电量
score.setPlanYear(years.stream().mapToDouble(WindEntity::getPlan).sum());
// 年发电完成率
if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){
score.setSpeedRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
/**
* 风电数据 -
* @param mons
* @param score
*/
private void mon(List<WindEntity> mons, WindScoreVo score) {
// 月发电量
score.setGenerateMon(mons.stream().mapToDouble(WindEntity::getPower).sum());
// 月平均风速
score.setSpeedRate(mons.stream().mapToDouble(WindEntity::getSpeed).average().getAsDouble());
// 月短期准确率
score.setAccuracy(mons.stream().mapToDouble(WindEntity::getAccuracy).average().getAsDouble());
// 月超短期准确率
score.setUltraShortAccuracyRate(mons.stream().mapToDouble(WindEntity::getUltraShortAccuracy).average().getAsDouble());
}
/**
* 风电数据 -
* @param days
* @param score
*/
private void days(List<WindEntity> days, WindScoreVo score) {
// 日发电量
score.setGenerateDay(days.stream().mapToDouble(WindEntity::getPower).sum());
}
}
Loading…
Cancel
Save