Browse Source

#集中监控铃铛设置

zhongwei
yang_shj 12 months ago
parent
commit
4f0a24e4f1
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java
  2. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java
  3. 8
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  4. 35
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  5. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  6. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java
  7. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  8. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

6
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_HOME_TARGET = "loadHomeTarget";
// 水利-泵站实时数据 // 水利-泵站实时数据
String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal"; String LOAD_WATER_PUMP_REAL = "loadWaterPumpReal";
// 水利-站点水位数据 // 水利-站点水位数据
String LOAD_WATER_LEVEL = "loadWaterLevel"; String LOAD_WATER_LEVEL = "loadWaterLevel";
@ -86,4 +86,8 @@ public interface MainConstants {
String DUTY_NOTICE = "dutyNotice"; String DUTY_NOTICE = "dutyNotice";
String PROJECT_MANAGER = "projectManager"; String PROJECT_MANAGER = "projectManager";
String LOAD_EM_INFO = "loadEmInfo";
String WIND_RECENT_YEAR_POWER_DATA = "hzims:operation:wind:power:data";
} }

2
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 { public interface IPushMsgClient {
String API_PREFIX = "/feign/message"; 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_SMS = API_PREFIX + "/sendSms";
String PUSH_MESSAGE_APP = API_PREFIX + "/sendPush"; String PUSH_MESSAGE_APP = API_PREFIX + "/sendPush";
String PUSH_MESSAGE_WEB = API_PREFIX + "/sendWebsocket"; String PUSH_MESSAGE_WEB = API_PREFIX + "/sendWebsocket";

8
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.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
@ -42,7 +43,6 @@ public class MonitorScheduledTask {
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(REAL_TIME_DATA) @XxlJob(REAL_TIME_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData(String param) { public ReturnT<String> loadRealData(String param) {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -55,8 +55,10 @@ public class MonitorScheduledTask {
* 集中监控数据处理 * 集中监控数据处理
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(CENTRALIZED_MONITORING) //@XxlJob(CENTRALIZED_MONITORING)
public ReturnT<String> loadMonitoring(String param) { @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadMonitoring() {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

35
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.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.fdp.constants.ScheduledConstant.LOAD_EM_INFO;
import static com.hnac.hzims.operational.main.constant.MainConstants.*; import static com.hnac.hzims.operational.main.constant.MainConstants.*;
@ -36,8 +34,11 @@ public class RealTargetScheduledTask {
*/ */
@XxlJob(LOAD_EM_INFO) @XxlJob(LOAD_EM_INFO)
//@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo() { public ReturnT<String> loadEmInfo(String param) {
service.loadEmInfo(); if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadEmInfo(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -131,24 +132,22 @@ public class RealTargetScheduledTask {
*/ */
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPowerData() { public ReturnT<String> loadPowerData(String param) {
// if (Func.isBlank(param)) { if (Func.isBlank(param)) {
// param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
// } }
service.loadPowerData("", Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3); service.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3);
return new ReturnT<>("SUCCESS"); 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) @XxlJob(WIND_POWER_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadWindPowerData() { public ReturnT<String> loadWindPowerData(String param) {
// if (Func.isBlank(param)) { if (Func.isBlank(param)) {
// param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
// } }
service.loadPowerDataByWindEnergy("", Arrays.asList(HomePageConstant.WIND_POWER,HomePageConstant.ENERGY_STORAGE),2,3,wind_recent_year_power_data); service.loadPowerDataByWindEnergy(param, Arrays.asList(HomePageConstant.WIND_POWER,HomePageConstant.ENERGY_STORAGE),2,3,WIND_RECENT_YEAR_POWER_DATA);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
} }

7
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 lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -39,6 +37,7 @@ public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, Ala
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>lambdaQuery() List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>lambdaQuery()
.in(AlarmEntity::getStationId,codes) .in(AlarmEntity::getStationId,codes)
.eq(AlarmEntity::getIsSmallBell,0) .eq(AlarmEntity::getIsSmallBell,0)
.like(AlarmEntity::getAlarmTime, DateUtil.format(new Date(),DateUtil.PATTERN_DATE))
); );
if(CollectionUtil.isEmpty(alarms)){ if(CollectionUtil.isEmpty(alarms)){
return new ArrayList<>(); return new ArrayList<>();

2
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 { public interface RealTargetService {
void loadEmInfo(); void loadEmInfo(String param);
// 水电站实时数据加载 // 水电站实时数据加载
void loadHydropowerReal(String param); void loadHydropowerReal(String param);

12
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 @Override
public void loadEmInfo() { public void loadEmInfo(String param) {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getDataOrigin,"0")); .eq(StationEntity::getDataOrigin,"0"));
// 查询所有首页展示/状态非删除设备 // 查询所有首页展示/状态非删除设备
@ -148,17 +148,17 @@ public class RealTargetServiceImpl implements RealTargetService {
List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList()); List<EmParamEntity> itemParamList = paramList.stream().filter(o->item.getId().equals(o.getInfoId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(itemParamList)){ if(CollectionUtil.isNotEmpty(itemParamList)){
// 遍历设备配置参数 // 遍历设备配置参数
for(EmParamEntity param : itemParamList){ for(EmParamEntity paramEntity : itemParamList){
String param_name = param.getParamName(); String param_name = paramEntity.getParamName();
switch (param_name){ switch (param_name){
case "ct": case "ct":
item.setCt(Integer.valueOf(param.getParamValue())); item.setCt(Integer.valueOf(paramEntity.getParamValue()));
break; break;
case "pt": case "pt":
item.setPt(Integer.valueOf(param.getParamValue())); item.setPt(Integer.valueOf(paramEntity.getParamValue()));
break; break;
case "installedCapacity": case "installedCapacity":
item.setInstalledCapacity(Double.valueOf(param.getParamValue())); item.setInstalledCapacity(Double.valueOf(paramEntity.getParamValue()));
break; break;
default: default:
break; break;

15
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.AccessService;
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService; 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.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.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.MonthService;
import com.hnac.hzims.scheduled.service.safeproduct.TrialService; import com.hnac.hzims.scheduled.service.safeproduct.TrialService;
import com.hnac.hzims.scheduled.service.ticket.TicketService; 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 org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
@ -329,7 +330,7 @@ public class ReportServiceImpl implements ReportService {
areaMonthReport.setPowerFinishRate(0.0); areaMonthReport.setPowerFinishRate(0.0);
} else { } 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); areaMonthReport.setPowerFinishRate(powerFinishRate);
} }
// 同比 // 同比
@ -338,7 +339,7 @@ public class ReportServiceImpl implements ReportService {
areaMonthReport.setComparePowerRate(0.0); areaMonthReport.setComparePowerRate(0.0);
return; 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); areaMonthReport.setComparePowerRate(comparePowerRate);
} }
@ -365,7 +366,7 @@ public class ReportServiceImpl implements ReportService {
if (operateQualify <= 0) { if (operateQualify <= 0) {
areaMonthReport.setOperaQualifyRate(0.0); areaMonthReport.setOperaQualifyRate(0.0);
} else { } 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); areaMonthReport.setOperaQualifyRate(operateQualifyRate);
} }
//工作票 //工作票
@ -375,7 +376,7 @@ public class ReportServiceImpl implements ReportService {
if (workQualify <= 0) { if (workQualify <= 0) {
areaMonthReport.setWorkQualifyRate(0.0); areaMonthReport.setWorkQualifyRate(0.0);
} else { } 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); areaMonthReport.setWorkQualifyRate(workQualifyRate);
} }
} }
@ -421,7 +422,7 @@ public class ReportServiceImpl implements ReportService {
if (defectSum <= 0) { if (defectSum <= 0) {
areaMonthReport.setDefectRate(0.0); areaMonthReport.setDefectRate(0.0);
} else { } 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); areaMonthReport.setDefectRate(deletionRate);
} }
countDownLatch.countDown(); countDownLatch.countDown();
@ -464,7 +465,7 @@ public class ReportServiceImpl implements ReportService {
if(Math.abs(oldActualPower) <= 0 && Math.abs(oldOldActualPower) <= 0 ){ if(Math.abs(oldActualPower) <= 0 && Math.abs(oldOldActualPower) <= 0 ){
return; 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); areaMonthReport.setPredictPlanPower(predictPlanPower);
} }

Loading…
Cancel
Save