Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
20921c3e56
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 9
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java
  3. 18
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  4. 16
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java
  5. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java
  6. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java
  8. 137
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java
  9. 131
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  10. 55
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java
  11. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  12. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  13. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  14. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  15. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/DeptController.java
  16. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java
  17. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -13,10 +13,10 @@ public interface AbnormalAlarmConstant {
/**通讯恢复*/ /**通讯恢复*/
String ABNORMAL_STATUS = "1"; String ABNORMAL_STATUS = "1";
/**故**/ /**故**/
String FAULT = "2"; String FAULT = "3";
String WEBSOCKET_FAULT = "0"; String WEBSOCKET_FAULT = "3";
List<String> ALARM_WARN_TYPES = Arrays.asList("0","1","2"); List<String> ALARM_WARN_TYPES = Arrays.asList("0","1","2");

9
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java

@ -1,7 +1,10 @@
package com.hnac.hzims.operational.alert.vo; package com.hnac.hzims.operational.alert.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@ -25,12 +28,14 @@ public class AlarmMergeVo{
@ApiModelProperty("告警编号") @ApiModelProperty("告警编号")
private String alarmCode; private String alarmCode;
@ApiModelProperty("告警类型: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") @ApiModelProperty("告警类型")
private String type; private String type;
@ApiModelProperty("告警内容: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") @ApiModelProperty("告警内容")
private String content; private String content;
@ApiModelProperty("告警时间") @ApiModelProperty("告警时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
private Date date; private Date date;
} }

18
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -274,6 +274,24 @@ public interface HomePageConstant {
**/ **/
String PV_CURRENT = "current"; String PV_CURRENT = "current";
/**
* 交流电压2
**/
String PV_VOLTAGE_TWO = "voltage_two";
/**
* 交流电流2
**/
String PV_CURRENT_TWO = "current_two";
/**
* 交流电压3
**/
String PV_VOLTAGE_THREE = "voltage_three";
/**
* 交流电流3
**/
String PV_CURRENT_THREE = "current_three";
/*==========================================================================================*/ /*==========================================================================================*/
// 光伏指标属性 // 光伏指标属性
String PHOTOVOLTAIC_OFF = "1.0"; // 开机 String PHOTOVOLTAIC_OFF = "1.0"; // 开机

16
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java

@ -76,6 +76,22 @@ public class PhotovoltaicDeviceVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double current; private Double current;
@ApiModelProperty(value = "交流电压2: V")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double voltage_two;
@ApiModelProperty(value = "交流电流2: A")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double current_two;
@ApiModelProperty(value = "交流电压3: V")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double voltage_three;
@ApiModelProperty(value = "交流电流3: A")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double current_three;
@ApiModelProperty(value = "co2减排: kg") @ApiModelProperty(value = "co2减排: kg")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double co2; private Double co2;

17
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java

@ -43,6 +43,23 @@ public class PhotovoltaicRealVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double current; private Double current;
@ApiModelProperty(value = "交流电压2: V")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double voltage_two;
@ApiModelProperty(value = "交流电流2: A")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double current_two;
@ApiModelProperty(value = "交流电压3: V")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double voltage_three;
@ApiModelProperty(value = "交流电流3: A")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double current_three;
@ApiModelProperty(value = "功率: kW") @ApiModelProperty(value = "功率: kW")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double load; private Double load;

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java

@ -1,10 +1,10 @@
package com.hnac.hzims.operational.config.ws; package com.hnac.hzims.operational.config.ws;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.service.AlarmMergeService; import com.hnac.hzims.operational.alert.service.AlarmMergeService;
import com.hnac.hzims.operational.config.vo.MessageParamVo; import com.hnac.hzims.operational.config.vo.MessageParamVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -51,9 +51,9 @@ public class AlarmHandler extends TextWebSocketHandler {
@Override @Override
public void handleTransportError(WebSocketSession session, Throwable exception) { public void handleTransportError(WebSocketSession session, Throwable exception) {
// 移除会话 // 移除会话
SessionManager.removeAndClose(session.getId()); AlarmSessionManager.removeAndClose(session.getId());
// map移除用户 // map移除用户
SocketPool.pool.remove(session.getId()); SocketPool.alarm_pool.remove(session.getId());
} }
@ -66,11 +66,11 @@ public class AlarmHandler extends TextWebSocketHandler {
if(StringUtil.isBlank(message)){ if(StringUtil.isBlank(message)){
return; return;
} }
MessageParamVo depts = JSONObject.parseObject(message, MessageParamVo.class); MessageParamVo param = JSONObject.parseObject(message, MessageParamVo.class);
if(ObjectUtil.isEmpty(depts)){ if(ObjectUtil.isEmpty(param) || CollectionUtil.isEmpty(param.getDeptIds())){
return; return;
} }
TextMessage sendMessage = alarmMergeService.getSendMessage(depts); TextMessage sendMessage = alarmMergeService.getSendMessage(param);
if(ObjectUtil.isEmpty(sendMessage)){ if(ObjectUtil.isEmpty(sendMessage)){
return; return;
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java

@ -8,7 +8,7 @@ import java.util.concurrent.ConcurrentHashMap;
/** /**
* @author Lch * @author ysj
*/ */
@Slf4j @Slf4j
public class AlarmSessionManager { public class AlarmSessionManager {

137
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java

@ -0,0 +1,137 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
@RestController
@RequestMapping("/homePage")
@Api(value = "水电站-首页", tags = "水电站-首页")
@AllArgsConstructor
public class HomePageController extends BladeController {
@NotNull
private final IHomePageService homePageService;
@ApiLog
@ApiOperation("服务厂站统计")
@GetMapping("/stationCensus")
@ApiOperationSupport(order = 1)
public R<List<StationCountVo>> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) {
List<StationCountVo> stationList = homePageService.getStationCount(deptId,serveType);
return R.data(stationList);
}
@ApiLog
@ApiOperation("关键指标:水电站、风电站、光伏站")
@GetMapping("/powerStation")
@ApiOperationSupport(order = 2)
public R<List<PowerTargetVo>> powerStation(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true)Integer serveType,Long deptId) {
List<PowerTargetVo> powerTargetVoList = homePageService.powerTarget(serveType,deptId);
return R.data(powerTargetVoList);
}
@ApiLog
@ApiOperation("关键指标:储能站、水利")
@GetMapping("/storageConservancy")
@ApiOperationSupport(order = 3)
public R<List<StorageConservancyVo>> storageConservancy(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) {
List<StorageConservancyVo> crucialTargetVoList = homePageService.storageConservancy(serveType,deptId);
return R.data(crucialTargetVoList);
}
@ApiLog
@ApiOperation("关键指标:暂定其他站")
@GetMapping("/waterAffairs")
@ApiOperationSupport(order = 4)
public R<OtherStationVo> waterAffairs(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) {
OtherStationVo waterAffairsVoList = homePageService.otherStation(serveType,deptId);
return R.data(waterAffairsVoList);
}
@ApiLog
@ApiOperation("水电站数据获取")
@GetMapping("/getHydropowerData")
@ApiOperationSupport(order = 5)
public R<List<HydropowerScoreVo>> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) {
List<HydropowerScoreVo> hydropowerScoreVoList = homePageService.getHydropowerData(deptId);
return R.data(hydropowerScoreVoList);
}
@ApiLog
@ApiOperation("年计划发电完成趋势")
@GetMapping("/planAactualTrend")
@OperationAnnotation(moduleName = "演示大屏",title = "演示大屏", operatorType = OperatorType.MOBILE,
businessType = BusinessType.GENCODE,action = "年计划发电完成趋势")
@ApiOperationSupport(order = 6)
public R<List<PowerMonthVo>> planActualTrend(@ApiParam(value = "区域机构ID") Long deptId) {
return R.data(homePageService.planActualTrend(deptId));
}
@ApiLog
@ApiOperation("计划发电趋势")
@GetMapping("/planGenerationTrend")
@ApiOperationSupport(order = 7)
public R<Map<Long, List<PlanGenerationTrendVo>>> planGenerationTrend(@ApiParam(value = "区域机构ID") Long deptId) {
return homePageService.planGenerationTrend(deptId, 0, 2);
}
@ApiLog
@ApiOperation("区域发电占比")
@GetMapping("/areaGenerationMakeUp")
@ApiOperationSupport(order = 9)
public R<Map<Long, List<AreaGenerationMakeUpVo>>> areaGenerationMakeUp(@ApiParam(value = "区域机构ID") Long deptId) {
return homePageService.areaGenerationMakeUp(deptId, 0, 2);
}
@ApiLog
@ApiOperation("统计")
@GetMapping("/getCount")
@ApiOperationSupport(order = 10)
public R<Map<Long, List<HomePageCountVo>>> getCount(@ApiParam(value = "区域机构ID") Long deptId) {
return homePageService.getCount(deptId, 0, 2);
}
@ApiLog
@ApiOperation("获取区域")
@GetMapping("/getArea")
@ApiOperationSupport(order = 11)
public R<List<AreaVo>> getArea(@ApiParam(value = "区域机构ID") Long deptId) {
return homePageService.getArea(deptId);
}
@ApiLog
@ApiOperation("站点首页")
@GetMapping("/stationHome")
@ApiOperationSupport(order = 11)
public R<List<AreaVo>> homeStation(@ApiParam(value = "区域机构ID") Long deptId) {
return R.data(homePageService.homeStation(deptId));
}
}

131
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -1,11 +1,9 @@
package com.hnac.hzims.operational.main.controller; package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.vo.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -17,118 +15,53 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
@RestController @RestController
@RequestMapping("/homePage") @RequestMapping("/webHome")
@Api(value = "水电站-首页", tags = "水电站-首页") @Api(value = "app首页", tags = "app-首页")
@AllArgsConstructor @AllArgsConstructor
public class HydropowerController extends BladeController { public class HydropowerController extends BladeController {
@NotNull private final HydropowerService service;
private final IHomePageService homePageService;
@ApiLog
@ApiOperation("服务厂站统计")
@GetMapping("/stationCensus")
@ApiOperationSupport(order = 1)
public R<List<StationCountVo>> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) {
List<StationCountVo> stationList = homePageService.getStationCount(deptId,serveType);
return R.data(stationList);
}
@ApiLog
@ApiOperation("关键指标:水电站、风电站、光伏站")
@GetMapping("/powerStation")
@ApiOperationSupport(order = 2)
public R<List<PowerTargetVo>> powerStation(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true)Integer serveType,Long deptId) {
List<PowerTargetVo> powerTargetVoList = homePageService.powerTarget(serveType,deptId);
return R.data(powerTargetVoList);
}
@ApiLog
@ApiOperation("关键指标:储能站、水利")
@GetMapping("/storageConservancy")
@ApiOperationSupport(order = 3)
public R<List<StorageConservancyVo>> storageConservancy(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) {
List<StorageConservancyVo> crucialTargetVoList = homePageService.storageConservancy(serveType,deptId);
return R.data(crucialTargetVoList);
}
@ApiLog
@ApiOperation("关键指标:暂定其他站")
@GetMapping("/waterAffairs")
@ApiOperationSupport(order = 4)
public R<OtherStationVo> waterAffairs(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) {
OtherStationVo waterAffairsVoList = homePageService.otherStation(serveType,deptId);
return R.data(waterAffairsVoList);
}
@ApiLog
@ApiOperation("水电站数据获取")
@GetMapping("/getHydropowerData")
@ApiOperationSupport(order = 5)
public R<List<HydropowerScoreVo>> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) {
List<HydropowerScoreVo> hydropowerScoreVoList = homePageService.getHydropowerData(deptId);
return R.data(hydropowerScoreVoList);
}
@ApiLog
@ApiOperation("年计划发电完成趋势")
@GetMapping("/planAactualTrend")
@OperationAnnotation(moduleName = "演示大屏",title = "演示大屏", operatorType = OperatorType.MOBILE,
businessType = BusinessType.GENCODE,action = "年计划发电完成趋势")
@ApiOperationSupport(order = 6)
public R<List<PowerMonthVo>> planActualTrend(@ApiParam(value = "区域机构ID") Long deptId) {
return R.data(homePageService.planActualTrend(deptId));
}
@ApiLog
@ApiOperation("计划发电趋势")
@GetMapping("/planGenerationTrend")
@ApiOperationSupport(order = 7)
public R<Map<Long, List<PlanGenerationTrendVo>>> planGenerationTrend(@ApiParam(value = "区域机构ID") Long deptId) {
return homePageService.planGenerationTrend(deptId, 0, 2);
}
@ApiLog @ApiLog
@ApiOperation("区域发电占比") @ApiOperation("水电站区域指标")
@GetMapping("/areaGenerationMakeUp") @GetMapping("/area/target")
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 1)
public R<Map<Long, List<AreaGenerationMakeUpVo>>> areaGenerationMakeUp(@ApiParam(value = "区域机构ID") Long deptId) { public R<HydropowerStationVo> area_target(@ApiParam(value = "站点机构ID") Long deptId) {
return homePageService.areaGenerationMakeUp(deptId, 0, 2); HydropowerStationVo response = service.area_target(deptId);
return R.data(response);
} }
@ApiLog @ApiLog
@ApiOperation("统计") @ApiOperation("水电站站点指标")
@GetMapping("/getCount") @GetMapping("/station")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 1)
public R<Map<Long, List<HomePageCountVo>>> getCount(@ApiParam(value = "区域机构ID") Long deptId) { public R<HydropowerStationVo> hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) {
return homePageService.getCount(deptId, 0, 2); HydropowerStationVo response = service.station(deptId);
return R.data(response);
} }
@ApiLog @ApiLog
@ApiOperation("获取区域") @ApiOperation("水电站机组列表")
@GetMapping("/getArea") @GetMapping("/getPumpList")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 2)
public R<List<AreaVo>> getArea(@ApiParam(value = "区域机构ID") Long deptId) { public R<List<HydropowerUnitVo>> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) {
return homePageService.getArea(deptId); List<HydropowerUnitVo> list = service.hydropowerDevice(deptId);
return R.data(list);
} }
@ApiLog @ApiLog
@ApiOperation("站点首页") @ApiOperation("水电站站点列表")
@GetMapping("/stationHome") @GetMapping("/webStationList")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 2)
public R<List<AreaVo>> homeStation(@ApiParam(value = "区域机构ID") Long deptId) { public R<List<HydropowerStationVo>> webStationList(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(homePageService.homeStation(deptId)); return R.data(service.webStationList(deptId));
} }
} }

55
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java

@ -1,55 +0,0 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@RestController
@RequestMapping("/webHome")
@Api(value = "app首页", tags = "app-首页")
@AllArgsConstructor
public class WebHomeController extends BladeController {
private final HydropowerService service;
@ApiLog
@ApiOperation("水电站站点统计")
@GetMapping("/webStation")
@ApiOperationSupport(order = 1)
public R<HydropowerStationVo> hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) {
HydropowerStationVo response = service.station(deptId);
return R.data(response);
}
@ApiLog
@ApiOperation("水电站机组列表")
@GetMapping("/getPumpList")
@ApiOperationSupport(order = 2)
public R<List<HydropowerUnitVo>> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) {
List<HydropowerUnitVo> list = service.hydropowerDevice(deptId);
return R.data(list);
}
@ApiLog
@ApiOperation("水电站站点列表")
@GetMapping("/webStationList")
@ApiOperationSupport(order = 2)
public R<List<HydropowerStationVo>> webStationList(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.webStationList(deptId));
}
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -13,6 +13,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
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;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java

@ -7,6 +7,7 @@ import java.util.List;
/** /**
* WEB水电站首页接口 * WEB水电站首页接口
* @author ysj
*/ */
public interface HydropowerService { public interface HydropowerService {
@ -19,4 +20,6 @@ public interface HydropowerService {
List<HydropowerUnitVo> hydropowerDevice(Long deptId); List<HydropowerUnitVo> hydropowerDevice(Long deptId);
List<HydropowerStationVo> webStationList(Long deptId); List<HydropowerStationVo> webStationList(Long deptId);
HydropowerStationVo area_target(Long deptId);
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -788,4 +788,14 @@ public class HydropowerServiceImpl implements HydropowerService {
return hydropower; return hydropower;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 水电站区域指标
* @param deptId
* @return
*/
@Override
public HydropowerStationVo area_target(Long deptId) {
return null;
}
} }

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -125,10 +125,18 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
real.setGenerate(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY))); real.setGenerate(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY)));
// 功率 // 功率
real.setLoad(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_LOAD))); real.setLoad(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_LOAD)));
// 电压 // 交流电压
real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE))); real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE)));
// 电流 // 交流电流
real.setCurrent(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT))); real.setCurrent(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT)));
// 交流电压2
real.setVoltage_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE_TWO)));
// 交流电流2
real.setCurrent_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT_TWO)));
// 交流电压3
real.setVoltage_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE_THREE)));
// 交流电流3
real.setCurrent_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT_THREE)));
// 直流电流1 // 直流电流1
real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE))); real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE)));
// 直流电流2 // 直流电流2
@ -296,7 +304,20 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
* @return * @return
*/ */
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; // FIXME 当天功率测试数据
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
List<PhotovoltaicPowerVo> list = new ArrayList<>();
Random random = new Random();
while (start.getTime().compareTo(new Date()) <= 0){
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
load.setHour(DateUtil.format(start.getTime(),"yyyy-mm-dd HH"));
load.setActivePower(String.valueOf(random.nextDouble() * 500));
list.add(load);
start.add(Calendar.HOUR_OF_DAY,1);
}
return list;
/*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
@ -308,7 +329,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
load.setHour(DateUtil.format(time,"yyyy-mm-dd HH")); load.setHour(DateUtil.format(time,"yyyy-mm-dd HH"));
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load; return load;
}).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList()); }).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/
} }
/** /**
@ -1560,6 +1581,14 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
item.setLastLoad(mateReals.get(0).getLastLoad()); item.setLastLoad(mateReals.get(0).getLastLoad());
item.setVoltage(mateReals.get(0).getVoltage()); item.setVoltage(mateReals.get(0).getVoltage());
item.setCurrent(mateReals.get(0).getCurrent()); item.setCurrent(mateReals.get(0).getCurrent());
// 交流电流1
item.setVoltage_two(mateReals.get(0).getVoltage_two());
// 交流电流2
item.setCurrent_two(mateReals.get(0).getCurrent_two());
// 交流电流3
item.setVoltage_three(mateReals.get(0).getVoltage_three());
// 交流电流4
item.setCurrent_three(mateReals.get(0).getCurrent_three());
// 直流电流1 // 直流电流1
item.setDirect_one(mateReals.get(0).getDirect_one()); item.setDirect_one(mateReals.get(0).getDirect_one());
// 直流电流2 // 直流电流2
@ -1665,7 +1694,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
} }
// 指标数据 // 指标数据
List<PhotovoltaicTargetVo> mateTargets = targets.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); List<PhotovoltaicTargetVo> mateTargets = targets.stream().filter(o -> o.getDeptId().equals(device.getCreateDept())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(mateTargets)) { if (CollectionUtil.isNotEmpty(mateTargets)) {
// 年发电量、月发电量、日发电量、co2减排、节约标准煤、收益、30天发电量、当日功率、环比日发电量 // 年发电量、月发电量、日发电量、co2减排、节约标准煤、收益、30天发电量、当日功率、环比日发电量
item.setGenerateYear(mateTargets.get(0).getGenerationYear()); item.setGenerateYear(mateTargets.get(0).getGenerationYear());

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/DeptController.java

@ -4,6 +4,7 @@ import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.report.service.IDeptService; import com.hnac.hzims.operational.report.service.IDeptService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
@ -36,4 +37,12 @@ public class DeptController extends BladeController {
public R<List<Dept>> getCurrentUserDept(@RequestParam(required = false) String name,@RequestParam(required = false) String type){ public R<List<Dept>> getCurrentUserDept(@RequestParam(required = false) String name,@RequestParam(required = false) String type){
return R.data(deptService.getCurrentUserDept(name,type)); return R.data(deptService.getCurrentUserDept(name,type));
} }
@ApiLog
@ApiOperation(value = "智能告警权限机构",notes = "智能告警")
@GetMapping("/alarmDeptByCurrentUser")
public R<List<Long>> alarmDeptByCurrentUser(){
return R.data(deptService.alarmDeptByCurrentUser());
}
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java

@ -27,4 +27,6 @@ public interface IDeptService {
* @return * @return
*/ */
List<Dept> getCurrentUserDept(String name,String type); List<Dept> getCurrentUserDept(String name,String type);
List<Long> alarmDeptByCurrentUser();
} }

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java

@ -1,6 +1,9 @@
package com.hnac.hzims.operational.report.service.impl; package com.hnac.hzims.operational.report.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.report.service.IDeptService; import com.hnac.hzims.operational.report.service.IDeptService;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -16,10 +19,7 @@ import org.springblade.system.vo.DeptVO;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -131,4 +131,20 @@ public class DeptServiceImpl implements IDeptService {
} }
return result.getData().stream().filter(o->o.getDeptName().contains(name) && o.getDeptCategory().equals(4) && deptList.contains(o.getId())).sorted(Comparator.comparing(Dept::getSort)).collect(Collectors.toList()); return result.getData().stream().filter(o->o.getDeptName().contains(name) && o.getDeptCategory().equals(4) && deptList.contains(o.getId())).sorted(Comparator.comparing(Dept::getSort)).collect(Collectors.toList());
} }
/**
* 智能告警权限机构
* @return
*/
@Override
public List<Long> alarmDeptByCurrentUser() {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getType, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC,HomePageConstant.PUMPING))
.eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)
);
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
return stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
}
} }

Loading…
Cancel
Save