Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
e734d38896
  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. 12
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java
  4. 2
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  5. 14
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  6. 8
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  7. 46
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  8. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  9. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/RealTargetService.java
  10. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  11. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java
  12. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.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_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";
}

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 {
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";

12
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java

@ -1,6 +1,5 @@
package com.hnac.hzims.alarm.show.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.alarm.entity.AlarmEntity;
@ -15,14 +14,9 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* @author ysj
@ -40,7 +34,7 @@ public class ShowAlarmController extends BladeController {
@GetMapping("/broadcast")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "播报告警", notes = "传入:时间区间")
public R<List<AlarmEntity>> broadcast(@ApiParam(value = "开始时间", required = false) String startTime,
public R<List<AlarmEntity>> broadcast(@ApiParam(value = "开始时间") String startTime,
@ApiParam(value = "结束时间", required = true) String endTime) {
return R.data(alarmService.broadcast(startTime,endTime));
}
@ -55,8 +49,8 @@ public class ShowAlarmController extends BladeController {
@PostMapping("/count")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "告警分类数量", notes = "不需要传入参数")
public R<List<AlarmCountVo>> counts() {
return R.data(alarmService.counts());
public R<List<AlarmCountVo>> counts(@RequestBody AlarmEntity alarm) {
return R.data(alarmService.counts(alarm));
}
}

2
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -14,7 +14,7 @@ public interface AlarmService extends BaseService<AlarmEntity> {
IPage<AlarmEntity> alarms(AlarmEntity alarm, IPage<AlarmEntity> page);
List<AlarmCountVo> counts();
List<AlarmCountVo> counts(AlarmEntity alarm);
List<AlarmEntity> broadcast(String startTime, String endTime);
}

14
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -62,6 +62,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
// 参数过滤 :站点、告警来源、告警子类
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.orderByDesc("CREATE_TIME");
wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){
@ -98,7 +99,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
* @return
*/
@Override
public List<AlarmCountVo> counts() {
public List<AlarmCountVo> counts(AlarmEntity alarm) {
// 站点查询
List<StationEntity> stations = this.stations();
if(CollectionUtil.isEmpty(stations)){
@ -114,13 +115,22 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){
wrapper.eq("STATION_ID",alarm.getStationId());
}
if(!StringUtil.isEmpty(alarm.getAlarmSource())){
wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource());
}
if(!StringUtil.isEmpty(alarm.getAlarmType())){
wrapper.eq("ALARM_TYPE",alarm.getAlarmType());
}
// 查询告警数据
List<AlarmEntity> alarms = this.list(wrapper);
// 查询数量
return AlarmConstants.ALARAM_SOURCE.stream().map(source->{
AlarmCountVo count = new AlarmCountVo();
count.setType(source);
if(CollectionUtil.isNotEmpty(alarms)){
if(CollectionUtil.isEmpty(alarms)){
count.setCount(0L);
}else{
count.setCount(alarms.stream().filter(o->o.getAlarmSource().equals(source)).count());

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.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<String>
*/
@XxlJob(REAL_TIME_DATA)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
@ -55,8 +55,10 @@ public class MonitorScheduledTask {
* 集中监控数据处理
* @return ReturnT<String>
*/
@XxlJob(CENTRALIZED_MONITORING)
public ReturnT<String> loadMonitoring(String param) {
//@XxlJob(CENTRALIZED_MONITORING)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadMonitoring() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

46
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -8,7 +8,6 @@ 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;
@ -33,10 +32,13 @@ public class RealTargetScheduledTask {
* @return
* @throws Exception
*/
// @XxlJob(LOAD_EM_INFO)
// @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo() {
service.loadEmInfo();
@XxlJob(LOAD_EM_INFO)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadEmInfo(String param) {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.loadEmInfo(param);
return new ReturnT<>("SUCCESS");
}
@ -128,26 +130,24 @@ public class RealTargetScheduledTask {
/**
* 获取站点近3年发电量数据
*/
// @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPowerData() {
// if (Func.isBlank(param)) {
// param = DateUtil.format(new Date(), "yyyy-MM");
// }
service.loadPowerData("", Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),2,3);
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> 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<String> 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);
@XxlJob(WIND_POWER_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> 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");
}
}

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 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<AlarmQueryMapper, Ala
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>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<>();

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 {
void loadEmInfo();
void loadEmInfo(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
public void loadEmInfo() {
public void loadEmInfo(String param) {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.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());
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;

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.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);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -153,6 +153,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
}
if(ObjectUtil.isNotEmpty(req.getPlanId())){
eq(OperMaintenanceTaskEntity::getPlanId,req.getPlanId());
}
}};
return queryWrapper;
}

Loading…
Cancel
Save