From 4798f61fedd8159eff2472d2446599a124ac4557 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 22 Apr 2024 09:07:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99=E5=A1=AB?= =?UTF-8?q?=E6=8A=A5=E5=8F=91=E7=94=B5=E9=87=8F=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/home/impl/RealTargetServiceImpl.java | 3 +-- .../station/service/impl/RealMonitorServiceImpl.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 239a316..26b56ec 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -264,7 +264,7 @@ public class RealTargetServiceImpl implements RealTargetService { // 水电站站点 List stations = stationService.list(Wrappers.lambdaQuery() .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) - .eq(StationEntity::getDataOrigin,"0") + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) ); if(CollectionUtil.isEmpty(stations)){ return; @@ -1223,7 +1223,6 @@ public class RealTargetServiceImpl implements RealTargetService { log.info("近年发电量接口耗时测试开始======================="); // 站点查询 List stationList = stationService.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getDataOrigin,"0"); if (ObjectUtil.isNotEmpty(serveType)) { eq(StationEntity::getServeType, serveType); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java index 7da8cc2..e6aed35 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java @@ -216,7 +216,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService { @Override public TextMessage getSendMessage(MessageParamVo message) { long beginTime = System.currentTimeMillis(); - Thread thread = Thread.currentThread(); // 权限机构过滤 if(ObjectUtil.isEmpty(message) || CollectionUtil.isEmpty(message.getDeptIds())){ return null; @@ -226,7 +225,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { if(CollectionUtil.isEmpty(realStationVoList)){ return null; } - log.info(thread.getName() + "步骤1获取所有监控缓存数据 耗时 : {}",System.currentTimeMillis() - beginTime); + log.info("步骤1获取所有监控缓存数据 耗时 : {}",System.currentTimeMillis() - beginTime); beginTime = System.currentTimeMillis(); // 集中监控响应站点数据 List validList = realStationVoList.stream().filter(o -> message.getDeptIds().contains(o.getStationDeptId())).collect(Collectors.toList()); @@ -241,11 +240,11 @@ public class RealMonitorServiceImpl implements IRealMonitorService { Map nowWeather = this.weatherService.getNowWeather(codes); // 七日内天气 Map weekWeather = this.weatherService.getWeekWeather(codes); - log.info(thread.getName() + "步骤2获取天气 耗时 : {}",System.currentTimeMillis() - beginTime); + log.info("步骤2获取天气 耗时 : {}",System.currentTimeMillis() - beginTime); beginTime = System.currentTimeMillis(); // 站点水位数据 List levelList = (List) redisTemplate.opsForValue().get(loadwater_level_key); - log.info(thread.getName() + "步骤3获取水位数据 耗时 : {}",System.currentTimeMillis() - beginTime); + log.info("步骤3获取水位数据 耗时 : {}",System.currentTimeMillis() - beginTime); beginTime = System.currentTimeMillis(); // 遍历站点 validList.forEach(item->{ @@ -256,8 +255,12 @@ public class RealMonitorServiceImpl implements IRealMonitorService { // 总有功率 this.activePower(item); }); - log.info(thread.getName() + "步骤4站点数据处理 耗时 : {}",System.currentTimeMillis() - beginTime); - return new TextMessage(JSONObject.toJSONString(validList.stream().sorted(Comparator.comparing((RealStationVo::getSort))).collect(Collectors.toList()))); + log.info("步骤4站点数据处理 耗时 : {}",System.currentTimeMillis() - beginTime); + return new TextMessage(JSONObject.toJSONString(validList.stream().peek(o->{ + if(ObjectUtil.isEmpty(o.getSort())){ + o.setSort(999); + } + }).sorted(Comparator.comparing((RealStationVo::getSort))).collect(Collectors.toList()))); } /** From a86b43f606e1c2b88213ee71b53b9d87ad2f2115 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Mon, 22 Apr 2024 11:40:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E4=BA=BA=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduled/MaintenanceTaskSchedule.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java index d16208a..c318d5a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java @@ -21,6 +21,7 @@ import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.secure.utils.AuthUtil; @@ -28,6 +29,8 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.entity.BladeFlow; import org.springblade.flow.core.feign.IFlowClient; +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.data.redis.core.RedisTemplate; @@ -84,6 +87,15 @@ public class MaintenanceTaskSchedule { OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class); taskEntity.setPlanId(plan.getId()); taskEntity.setDisposer(Optional.ofNullable(plan.getDisposer()).map(String::valueOf).orElse(null)); + taskEntity.setDisposerName(Optional.ofNullable(plan.getDisposer()).map(s -> + { + User user = UserCache.getUser(s); + if (ObjectUtil.isNotEmpty(user)){ + return user.getName(); + }else { + return ""; + } + }).filter(s->StringUtils.isNotBlank(s)).orElse(null)); LocalDateTime disposeTime = taskEntity.getDisposeTime().toInstant() .atZone(ZoneId.systemDefault()).toLocalDateTime(); taskEntity.setPlanEndTime(disposeTime.plusHours(taskEntity.getHours())); @@ -137,7 +149,20 @@ public class MaintenanceTaskSchedule { ImsDutyMainEntity entity = dutyMainService.getOne(dutyQuery); if (ObjectUtil.isNotEmpty(entity) && StringUtils.isNotEmpty(entity.getDutyPersonIds())) { String userId = entity.getDutyPersonIds(); + String[] split = userId.split("\\^"); task.setDisposer(userId.replaceAll("\\^", ",")); + if (ArrayUtils.isNotEmpty(split)){ + List list = Arrays.asList(split); + String disposerName= list.stream().map(s->{ + User user = UserCache.getUser(Long.valueOf(s)); + if (ObjectUtil.isNotEmpty(user)){ + return user.getName();} + return ""; + }).filter(s->StringUtils.isNotBlank(s)).collect(Collectors.joining(",")); + if (StringUtils.isNotBlank(disposerName)) { + task.setDisposerName(disposerName); + } + } } else { XxlJobLogger.log("ID为:"+plan.getId()+"的日常维护计划未获取到值班人员,未生成任务。");