diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java index b382278..a05cfa2 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerStationVo.java @@ -47,6 +47,9 @@ public class AppHydropowerStationVo { @JsonSerialize(nullsUsing = NullSerializer.class) private Double output; + @ApiModelProperty(value = "排序") + private Integer sort; + @ApiModelProperty(value = "运行天数") @JsonSerialize(nullsUsing = NullSerializer.class) private Integer runDay; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index f0b3863..6a04a74 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -1563,6 +1563,12 @@ public class HydropowerServiceImpl implements HydropowerService { List reals = (List) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); return stations.stream().map(station -> { AppHydropowerStationVo hydropower = new AppHydropowerStationVo(); + R dept = sysClient.getDept(station.getRefDept()); + if(dept.isSuccess() && !ObjectUtil.isEmpty(dept.getData())){ + hydropower.setSort(dept.getData().getSort()); + }else{ + hydropower.setSort(1); + } hydropower.setDeptId(station.getRefDept()); hydropower.setDeptName(station.getName()); // 天气区间 @@ -1615,7 +1621,7 @@ public class HydropowerServiceImpl implements HydropowerService { // 负荷单位 hydropower.setLoadUnit("kW"); return hydropower; - }).collect(Collectors.toList()); + }).sorted(Comparator.comparing(AppHydropowerStationVo::getSort)).collect(Collectors.toList()); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 6479253..f9b8d6b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -722,4 +722,19 @@ public class StationServiceImpl extends BaseServiceImpl projectClient.delete()); // } } + + /** + * 批量更新站点排序 + */ + @Override + public boolean updateBatchSort(List req) { + List stations = new ArrayList<>(); + for (StationEntity stationEntity : req) { + // 获取当前的站点信息 + StationEntity station = this.getById(stationEntity.getId()); + station.setSort(stationEntity.getSort()); + stations.add(station); + } + return this.updateBatchById(stations); + } }