Browse Source

#风电

zhongwei
yang_shj 1 year ago
parent
commit
f62c1a8224
  1. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java
  2. 64
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java
  3. 18
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java
  4. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  5. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java
  6. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java
  7. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/SolveController.java
  8. 69
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/WindController.java
  9. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java
  10. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml
  11. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java
  12. 93
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java
  13. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java
  14. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.ecology.vo;
import com.hnac.hzims.operational.main.vo.WaterLevelVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -25,6 +24,9 @@ public class StationVo {
@ApiModelProperty(value = "水位")
private Double damWater;
@ApiModelProperty(value = "下泄流量")
private Double dischargeFlow;
@ApiModelProperty(value = "设备集合")
private List<DeviceVo> devices;

64
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java

@ -0,0 +1,64 @@
package com.hnac.hzims.operational.fill.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* @author ysj
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_fill_wind")
@ApiModel(value="WindEntity", description="风电填报数据对象")
public class WindEntity extends TenantEntity implements Serializable {
@ApiModelProperty("站点编号")
private String stationCode;
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("填报日期")
private String fillDate;
@ApiModelProperty("计划发电量")
private Double plan;
@ApiModelProperty("发电量")
private Double power;
@ApiModelProperty("平均风速: m/s")
private Double speed;
@ApiModelProperty("上网电量")
private Double surfPower;
@ApiModelProperty("下网电量")
private Double belowPower;
@ApiModelProperty("可用时长")
private Double available;
@ApiModelProperty("综合用电量")
private Double comprehensivePower;
@ApiModelProperty("峰值功率")
private Double peakPower;
@ApiModelProperty("故障时长: 单位-小时")
private Double faultHours;
@ApiModelProperty("短期预测准确率")
private Double accuracy;
@ApiModelProperty("超短准确率")
private Double ultraShortAccuracy;
}

18
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java

@ -0,0 +1,18 @@
package com.hnac.hzims.operational.fill.vo;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class WindVo extends WindEntity {
@ApiModelProperty("用户名称")
private String userName;
}

1
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -162,6 +162,7 @@ public interface HomePageConstant {
// 水利-站点实时属性名称
String FRONT_WATER_LEVEL = "front_water_level"; // 前水位
String REAR_WATER_LEVEL = "rear_water_level"; // 后水位
String DISCHARGE_FLOW = "discharge_flow"; // 下泄流量
// 水电站实时属性名称
String HYDROPOWER_GENERATE_POWER = "generation_capacity"; // 发电量

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java

@ -19,6 +19,9 @@ public class WaterLevelVo {
@ApiModelProperty(value = "闸后水位")
private Double rearWaterLevel;
@ApiModelProperty(value = "下泄流量")
private Double dischargeFlow;
@ApiModelProperty(value = "前水位曲线数据")
private Map<Integer,String> frontCurveMap;

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java

@ -193,9 +193,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
StationVo station = new StationVo();
station.setStationId(item.getCode());
station.setStationName(item.getName());
station.setDevices(this.devices(item,realList,targetList));
// 实时水位
this.handleWaterLeve(item.getCode(),station);
station.setDevices(this.devices(item,station.getDischargeFlow(),realList,targetList));
// 查询站点模型列表
HzimsAnalyzeModelStationEntity model = modelStationService.getOne(new LambdaQueryWrapper<HzimsAnalyzeModelStationEntity>() {{
eq(HzimsAnalyzeModelStationEntity::getStationId, item.getCode());
@ -213,7 +213,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
* @param station
* @return
*/
private List<DeviceVo> devices(StationEntity station, List<HydropowerUnitRealVo> realList, List<HydropowerUnitTargetVo> targetList) {
private List<DeviceVo> devices(StationEntity station,double dischargeFlow, List<HydropowerUnitRealVo> realList, List<HydropowerUnitTargetVo> targetList) {
if(CollectionUtil.isEmpty(realList) || CollectionUtil.isEmpty(targetList)){
return null;
}
@ -230,9 +230,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
device.setState(real.getState());
device.setActive(real.getActivePower());
device.setReactive(real.getReactivePower());
device.setDischarge(dischargeFlow);
device.setEcology(0.0);
device.setAdjust(0.0);
device.setDischarge(0.0);
device.setGenerate(0.0);
list.add(device);
}
@ -258,6 +258,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl<EcologyFlowSt
WaterLevelVo level = validList.get(0);
station.setWater(level.getFrontWaterLevel());
station.setDamWater(level.getFrontWaterLevel());
station.setDischargeFlow(level.getDischargeFlow());
}
/**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/SolveController.java

@ -22,6 +22,9 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/solve")

69
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/WindController.java

@ -0,0 +1,69 @@
package com.hnac.hzims.operational.fill.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.operational.fill.service.WindService;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.WindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/wind")
@Api(value = "风电填报", tags = "风电填报")
public class WindController extends BladeController {
private final WindService service;
/**
* 新增
*/
@PostMapping("/saveOrUpdate")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增", notes = "传入WindEntity对象")
public R saveOrUpdate(@RequestBody WindEntity entity) {
return R.status(service.saveUpdate(entity));
}
/**
* 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "逻辑删除", notes = "传入id字符串以逗号分隔")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(service.deleteLogic(Func.toLongList(ids)));
}
/**
* 分页
*/
@ApiLog
@GetMapping("/list")
@ApiOperationSupport(order = 4)
@OperationAnnotation(moduleName = "数据填报",
title = "风电填报数据查询",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页")
@ApiOperation(value = "分页", notes = "查询条件::startTime,endTime,stationCode")
public R<IPage<WindVo>> list(QueryVo filter, Query query) {
return service.pageCondition(filter, query);
}
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java

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

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.fill.mapper.WindMapper">
</mapper>

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java

@ -0,0 +1,23 @@
package com.hnac.hzims.operational.fill.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.WindVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
/**
* @author ysj
*/
public interface WindService extends BaseService<WindEntity> {
// 分页查询发电量填报数据
R<IPage<WindVo>> pageCondition(QueryVo filter, Query query);
// 新增/修改发电量填报数据
boolean saveUpdate(WindEntity entity);
}

93
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java

@ -0,0 +1,93 @@
package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.operational.fill.mapper.GenerateMapper;
import com.hnac.hzims.operational.fill.mapper.WindMapper;
import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.service.WindService;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.WindVo;
import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Slf4j
@Service
@AllArgsConstructor
public class WindServiceImpl extends BaseServiceImpl<WindMapper, WindEntity> implements WindService {
/**
* 分页查询风电填报数据
* @param filter
* @param query
* @return
*/
@Override
public R<IPage<WindVo>> pageCondition(QueryVo filter, Query query) {
QueryWrapper<WindEntity> queryWrapper = new QueryWrapper<WindEntity>() {{
if(!StringUtil.isEmpty(filter.getStationCode())){
eq("STATION_CODE",filter.getStationCode());
}
if(!ObjectUtil.isEmpty(filter.getDate())){
likeRight("FILL_DATE",filter.getDate());
}
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = GenerateWrapper.build().listVO(pages.getRecords());
return R.data(pages.setRecords(list));
}
/**
* 新增/修改发电量填报数据
* @param entity
* @return
*/
@Override
public boolean saveUpdate(WindEntity entity) {
// 查询是否存在历史记录
WindEntity query = this.getOne(new LambdaQueryWrapper<WindEntity>(){{
eq(WindEntity::getStationCode, entity.getStationCode());
eq(WindEntity::getFillDate,entity.getFillDate());
}});
if(ObjectUtil.isNotEmpty(query) && (ObjectUtil.isEmpty(entity.getId()) || !entity.getId().equals(query.getId()))){
throw new ServiceException("日期已经存在填报数据!");
}
if(ObjectUtil.isEmpty(query)){
return this.save(entity);
}
return this.updateById(entity);
}
}

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java

@ -0,0 +1,32 @@
package com.hnac.hzims.operational.fill.wrapper;
import com.hnac.hzims.operational.fill.entity.WindEntity;
import com.hnac.hzims.operational.fill.vo.WindVo;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
/**
* @author ysj
*/
public class WindWrapper extends BaseEntityWrapper<WindEntity, WindVo> {
public static WindWrapper build() {
return new WindWrapper();
}
@Override
public WindVo entityVO(WindEntity entity) {
WindVo vo = BeanUtil.copy(entity, WindVo.class);
User createUser = UserCache.getUser(entity.getCreateUser());
if(ObjectUtil.isEmpty(createUser)){
return vo;
}
assert vo != null;
vo.setUserName(createUser.getName());
return vo;
}
}

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

@ -220,6 +220,9 @@ public class WaterServiceImpl implements IWaterService {
// 后水位
double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL);
waterLevelVo.setRearWaterLevel(rearWaterLevel);
// 下泄流量
double dischargeFlow = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW);
waterLevelVo.setDischargeFlow(dischargeFlow);
// 前水位当日曲线
Map<Integer,String> frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL);
waterLevelVo.setFrontCurveMap(frontCurveMap);

Loading…
Cancel
Save