diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java index f8d30e6..da88113 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/vo/StationVo.java +++ b/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 devices; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/WindEntity.java new file mode 100644 index 0000000..b7fb278 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/WindVo.java new file mode 100644 index 0000000..ab64c12 --- /dev/null +++ b/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; + +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index 2879db1..499677f 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/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"; // 发电量 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java index 585cb77..62afe4a 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/EquipmentStateCountVo.java @@ -6,6 +6,9 @@ import lombok.Data; import java.util.List; +/** + * @author ysj + */ @Data @ApiModel(value = "站点设备统计对象") public class EquipmentStateCountVo { @@ -34,6 +37,9 @@ public class EquipmentStateCountVo { @ApiModelProperty(value = "备用数量") private Long backupCount; + @ApiModelProperty(value = "排序") + private Integer sort; + @ApiModelProperty(value = "设备") private List deviceVoList; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java index 804dc09..f4d0875 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/WaterLevelVo.java +++ b/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 frontCurveMap; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java index 820a9fd..f58ea00 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java @@ -201,9 +201,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl() {{ eq(HzimsAnalyzeModelStationEntity::getStationId, item.getCode()); @@ -221,7 +221,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl devices(StationEntity station, List realList, List targetList) { + private List devices(StationEntity station,double dischargeFlow, List realList, List targetList) { if(CollectionUtil.isEmpty(realList) || CollectionUtil.isEmpty(targetList)){ return null; } @@ -238,9 +238,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl> list(QueryVo filter, Query query) { + return service.pageCondition(filter, query); + } + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.java new file mode 100644 index 0000000..50edbe1 --- /dev/null +++ b/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 { + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml new file mode 100644 index 0000000..197f8d6 --- /dev/null +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/WindMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/WindService.java new file mode 100644 index 0000000..7beb3ac --- /dev/null +++ b/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 { + + // 分页查询发电量填报数据 + R> pageCondition(QueryVo filter, Query query); + + // 新增/修改发电量填报数据 + boolean saveUpdate(WindEntity entity); +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/WindServiceImpl.java new file mode 100644 index 0000000..a8dd162 --- /dev/null +++ b/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 implements WindService { + + /** + * 分页查询风电填报数据 + * @param filter + * @param query + * @return + */ + @Override + public R> pageCondition(QueryVo filter, Query query) { + QueryWrapper queryWrapper = new QueryWrapper() {{ + 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(){{ + 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); + } + +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/wrapper/WindWrapper.java new file mode 100644 index 0000000..ab8609e --- /dev/null +++ b/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 { + + 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; + } + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java index f89bd74..adc1d46 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java @@ -1200,6 +1200,7 @@ public class SideHustleServiceImpl implements ISideHustleService { List equipmentList = new ArrayList<>(); deptMap.forEach((key, value) -> { EquipmentStateCountVo equipmentCountVo = new EquipmentStateCountVo(); + equipmentCountVo.setSort(key.getSort()); equipmentCountVo.setDeptId(key.getId()); equipmentCountVo.setDeptName(key.getDeptName()); // 根据部门查询设备 @@ -1253,7 +1254,7 @@ public class SideHustleServiceImpl implements ISideHustleService { this.setDeviceInfo(R.getData(), deviceVoList, equipmentCountVo); equipmentList.add(equipmentCountVo); }); - return equipmentList; + return equipmentList.stream().sorted(Comparator.comparing(EquipmentStateCountVo::getSort)).collect(Collectors.toList()); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java index c16822b..1b661da 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java +++ b/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 frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); waterLevelVo.setFrontCurveMap(frontCurveMap);