From 62ae021ac443324692e68e5cf710a5f34daf3af1 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 28 Feb 2024 14:17:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#=E7=A9=BA=E6=8C=87=E9=92=88bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/main/service/impl/HydropowerServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 796f347..266387d 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 @@ -1549,10 +1549,13 @@ public class HydropowerServiceImpl implements HydropowerService { // 天气区间 hydropower.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true)); hydropower.setMinTemp(this.intervalTemp(weekWeather,station.getCode(),false)); + if(CollectionUtil.isEmpty(reals)){ + return hydropower; + } // 装机容量 - hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); + hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getInstalledCapacity())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); // 负荷 - hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum()); + hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept()) && !ObjectUtil.isEmpty(real.getActivePower())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum()); // 出力 if(Math.abs(hydropower.getCapacity()) > 0){ hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); From c46b7fc523c062bc5a3c52ca7d4611edb1ca948a Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Wed, 28 Feb 2024 19:36:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=A4=BE=E4=BC=9A=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E5=BA=93=E6=96=B0=E5=A2=9E=E6=97=A5=E5=B8=B8=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/scheduled/MaintenancePlanCreateTask.java | 6 +++++- .../maintenance/service/impl/MaintenanceServiceImpl.java | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenancePlanCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenancePlanCreateTask.java index 96dff59..5c1fcc9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenancePlanCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenancePlanCreateTask.java @@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.*; import org.springblade.system.cache.DictCache; import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -151,7 +152,10 @@ public class MaintenancePlanCreateTask { planEntity.setImsDutyClassId(libraryEntity.getImsDutyClassId()); planEntity.setImsDutyGroupId(libraryEntity.getImsDutyGroupId()); if(ObjectUtil.isEmpty(libraryEntity.getMaintenanceModel()) || libraryEntity.getMaintenanceModel() == 1){ - planEntity.setDisposer(Long.valueOf(disposers.get((i + startIndex) % disposers.size()))); + Long disposer = Long.valueOf(disposers.get((i + startIndex) % disposers.size())); + planEntity.setDisposer(disposer); + User user = UserCache.getUser(disposer); + planEntity.setDisposerName(user.getName()); } planEntity.setDisposeTime(planDates.get(i)); planEntities.add(planEntity); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index d8de898..a540cf2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -34,6 +34,8 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.feign.IFlowClient; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; @@ -342,7 +344,16 @@ public class MaintenanceServiceImpl implements MaintenanceService { ImsDutyMainEntity entity = mainService.getOne(entityLambdaQueryWrapper); if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) { String userId = entity.getDutyPersonIds(); + String[] split = userId.split("\\^"); + String disposerName=""; + for (int i = 0; i < split.length; i++) { + User user = UserCache.getUser(Long.valueOf(split[i])); + if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())){ + disposerName=disposerName+user.getName(); + } + } taskEntity.setDisposer(userId.replaceAll("\\^", ",")); + taskEntity.setDisposerName(disposerName); } else { log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId()); // LambdaUpdateWrapper planQueryWrapper = Wrappers.lambdaUpdate()