From 4f0a24e4f1a7989a7129f8ec5931dc2aed401291 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 6 Dec 2023 16:28:39 +0800 Subject: [PATCH] =?UTF-8?q?#=E9=9B=86=E4=B8=AD=E7=9B=91=E6=8E=A7=E9=93=83?= =?UTF-8?q?=E9=93=9B=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/constant/MainConstants.java | 6 +++- .../hnac/hzims/message/fegin/IPushMsgClient.java | 2 +- .../scheduled/scheduled/MonitorScheduledTask.java | 8 +++-- .../scheduled/RealTargetScheduledTask.java | 35 +++++++++++----------- .../service/alarm/impl/AlarmQueryServiceImpl.java | 7 ++--- .../service/operation/home/RealTargetService.java | 2 +- .../operation/home/impl/RealTargetServiceImpl.java | 12 ++++---- .../operation/report/impl/ReportServiceImpl.java | 15 +++++----- 8 files changed, 46 insertions(+), 41 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java index dcc66fc..5ac0d97 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java @@ -35,7 +35,7 @@ public interface MainConstants { String LOAD_HOME_TARGET = "loadHomeTarget"; // 水利-泵站实时数据 - String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal"; + String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal"; // 水利-站点水位数据 String LOAD_WATER_LEVEL = "loadWaterLevel"; @@ -86,4 +86,8 @@ public interface MainConstants { String DUTY_NOTICE = "dutyNotice"; String PROJECT_MANAGER = "projectManager"; + + String LOAD_EM_INFO = "loadEmInfo"; + + String WIND_RECENT_YEAR_POWER_DATA = "hzims:operation:wind:power:data"; } diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java index 3d247cd..4f780ef 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody; public interface IPushMsgClient { String API_PREFIX = "/feign/message"; - String PUSH_MESSAGE_MAIL = API_PREFIX + "/sendMail"; + String PUSH_MESSAGE_MAIL = API_PREFIX + "/sendMail"; String PUSH_MESSAGE_SMS = API_PREFIX + "/sendSms"; String PUSH_MESSAGE_APP = API_PREFIX + "/sendPush"; String PUSH_MESSAGE_WEB = API_PREFIX + "/sendWebsocket"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java index 3000218..daed33c 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Date; @@ -42,7 +43,6 @@ public class MonitorScheduledTask { * @return ReturnT */ @XxlJob(REAL_TIME_DATA) - //@Scheduled(cron = "0/40 * * * * ? ") public ReturnT loadRealData(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); @@ -55,8 +55,10 @@ public class MonitorScheduledTask { * 集中监控数据处理 * @return ReturnT */ - @XxlJob(CENTRALIZED_MONITORING) - public ReturnT loadMonitoring(String param) { + //@XxlJob(CENTRALIZED_MONITORING) + @Scheduled(cron = "0/40 * * * * ? ") + public ReturnT loadMonitoring() { + String param = ""; if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java index 990282c..951d307 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java @@ -8,13 +8,11 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.Date; -import static com.hnac.hzims.fdp.constants.ScheduledConstant.LOAD_EM_INFO; import static com.hnac.hzims.operational.main.constant.MainConstants.*; @@ -36,8 +34,11 @@ public class RealTargetScheduledTask { */ @XxlJob(LOAD_EM_INFO) //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadEmInfo() { - service.loadEmInfo(); + public ReturnT loadEmInfo(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadEmInfo(param); return new ReturnT<>("SUCCESS"); } @@ -131,24 +132,22 @@ public class RealTargetScheduledTask { */ @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadPowerData() { -// if (Func.isBlank(param)) { -// param = DateUtil.format(new Date(), "yyyy-MM"); -// } - service.loadPowerData("", Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); + public ReturnT loadPowerData(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); return new ReturnT<>("SUCCESS"); } - /** - * 获取風電和儲能站点近3年发电量数据 - */ - private final static String wind_recent_year_power_data = "hzims:operation:wind:power:data"; + + @XxlJob(WIND_POWER_GENERATION_RECENT_YEAR) //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadWindPowerData() { -// if (Func.isBlank(param)) { -// param = DateUtil.format(new Date(), "yyyy-MM"); -// } - service.loadPowerDataByWindEnergy("", Arrays.asList(HomePageConstant.WIND_POWER,HomePageConstant.ENERGY_STORAGE),2,3,wind_recent_year_power_data); + public ReturnT loadWindPowerData(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadPowerDataByWindEnergy(param, Arrays.asList(HomePageConstant.WIND_POWER,HomePageConstant.ENERGY_STORAGE),2,3,WIND_RECENT_YEAR_POWER_DATA); return new ReturnT<>("SUCCESS"); } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java index c65ebcb..d9ac8fe 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java @@ -11,13 +11,11 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -39,6 +37,7 @@ public class AlarmQueryServiceImpl extends BaseServiceImpl alarms = this.list(Wrappers.lambdaQuery() .in(AlarmEntity::getStationId,codes) .eq(AlarmEntity::getIsSmallBell,0) + .like(AlarmEntity::getAlarmTime, DateUtil.format(new Date(),DateUtil.PATTERN_DATE)) ); if(CollectionUtil.isEmpty(alarms)){ return new ArrayList<>(); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java index 8d6f2d7..d608cf5 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java @@ -9,7 +9,7 @@ import java.util.List; public interface RealTargetService { - void loadEmInfo(); + void loadEmInfo(String param); // 水电站实时数据加载 void loadHydropowerReal(String param); 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 d8ec750..588ee81 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 @@ -101,7 +101,7 @@ public class RealTargetServiceImpl implements RealTargetService { @Override - public void loadEmInfo() { + public void loadEmInfo(String param) { List stations = stationService.list(Wrappers.lambdaQuery() .eq(StationEntity::getDataOrigin,"0")); // 查询所有首页展示/状态非删除设备 @@ -148,17 +148,17 @@ public class RealTargetServiceImpl implements RealTargetService { List itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList()); if(CollectionUtil.isNotEmpty(itemParamList)){ // 遍历设备配置参数 - for(EmParamEntity param : itemParamList){ - String param_name = param.getParamName(); + for(EmParamEntity paramEntity : itemParamList){ + String param_name = paramEntity.getParamName(); switch (param_name){ case "ct": - item.setCt(Integer.valueOf(param.getParamValue())); + item.setCt(Integer.valueOf(paramEntity.getParamValue())); break; case "pt": - item.setPt(Integer.valueOf(param.getParamValue())); + item.setPt(Integer.valueOf(paramEntity.getParamValue())); break; case "installedCapacity": - item.setInstalledCapacity(Double.valueOf(param.getParamValue())); + item.setInstalledCapacity(Double.valueOf(paramEntity.getParamValue())); break; default: break; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index c38748b..38ba1a2 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -17,8 +17,8 @@ import com.hnac.hzims.scheduled.service.inspect.TaskService; import com.hnac.hzims.scheduled.service.operation.business.AccessService; import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService; import com.hnac.hzims.scheduled.service.operation.business.PhenomenonService; -import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.report.ReportService; +import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.safeproduct.MonthService; import com.hnac.hzims.scheduled.service.safeproduct.TrialService; import com.hnac.hzims.scheduled.service.ticket.TicketService; @@ -41,6 +41,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; @@ -329,7 +330,7 @@ public class ReportServiceImpl implements ReportService { areaMonthReport.setPowerFinishRate(0.0); } else { // 发电完成率 - double powerFinishRate = BigDecimal.valueOf(actualPower / planPower * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + double powerFinishRate = BigDecimal.valueOf(actualPower / planPower * 100).setScale(1, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setPowerFinishRate(powerFinishRate); } // 同比 @@ -338,7 +339,7 @@ public class ReportServiceImpl implements ReportService { areaMonthReport.setComparePowerRate(0.0); return; } - double comparePowerRate = BigDecimal.valueOf(actualPower / oldActualPower).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double comparePowerRate = BigDecimal.valueOf(actualPower / oldActualPower).setScale(2, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setComparePowerRate(comparePowerRate); } @@ -365,7 +366,7 @@ public class ReportServiceImpl implements ReportService { if (operateQualify <= 0) { areaMonthReport.setOperaQualifyRate(0.0); } else { - double operateQualifyRate = BigDecimal.valueOf(operateQualify / (double) operate * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + double operateQualifyRate = BigDecimal.valueOf(operateQualify / (double) operate * 100L).setScale(1, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setOperaQualifyRate(operateQualifyRate); } //工作票 @@ -375,7 +376,7 @@ public class ReportServiceImpl implements ReportService { if (workQualify <= 0) { areaMonthReport.setWorkQualifyRate(0.0); } else { - double workQualifyRate = BigDecimal.valueOf(workQualify / (double) work * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + double workQualifyRate = BigDecimal.valueOf(workQualify / (double) work * 100L).setScale(1, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setWorkQualifyRate(workQualifyRate); } } @@ -421,7 +422,7 @@ public class ReportServiceImpl implements ReportService { if (defectSum <= 0) { areaMonthReport.setDefectRate(0.0); } else { - double deletionRate = BigDecimal.valueOf(defect / defectSum * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + double deletionRate = BigDecimal.valueOf(defect / defectSum * 100L).setScale(1, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setDefectRate(deletionRate); } countDownLatch.countDown(); @@ -464,7 +465,7 @@ public class ReportServiceImpl implements ReportService { if(Math.abs(oldActualPower) <= 0 && Math.abs(oldOldActualPower) <= 0 ){ return; } - double predictPlanPower = BigDecimal.valueOf((oldActualPower + oldOldActualPower) / 2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + double predictPlanPower = BigDecimal.valueOf((oldActualPower + oldOldActualPower) / 2).setScale(2, RoundingMode.HALF_UP).doubleValue(); areaMonthReport.setPredictPlanPower(predictPlanPower); }