From 4a3c51c71a42c871332fc3e4ed76295ca87d3537 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 29 Mar 2024 11:44:14 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=8C=BA=E5=9F=9F=E7=AB=99=E7=82=B9=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/vo/AppHydropowerStationVo.java | 3 +++ .../main/service/impl/HydropowerServiceImpl.java | 8 +++++++- .../station/service/impl/StationServiceImpl.java | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) 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); + } }