diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java index 8a194ab..631f90b 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java +++ b/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 FAULT = "2"; + /**故障**/ + String FAULT = "3"; - String WEBSOCKET_FAULT = "0"; + String WEBSOCKET_FAULT = "3"; List ALARM_WARN_TYPES = Arrays.asList("0","1","2"); diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java index 1cc360a..74a49b0 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java +++ b/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; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -25,12 +28,14 @@ public class AlarmMergeVo{ @ApiModelProperty("告警编号") private String alarmCode; - @ApiModelProperty("告警类型: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") + @ApiModelProperty("告警类型") private String type; - @ApiModelProperty("告警内容: 0 - 事故 、 1 - 一级告警、 2 - 二级告警") + @ApiModelProperty("告警内容") private String content; @ApiModelProperty("告警时间") + @DateTimeFormat(pattern = DateUtil.PATTERN_DATE) + @JsonFormat(pattern = DateUtil.PATTERN_DATE) private Date date; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java index b90418e..4d95083 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java +++ b/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"; + /** + * 交流电压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"; // 开机 diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java index 68bf536..e307b31 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java +++ b/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) 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") @JsonSerialize(nullsUsing = NullSerializer.class) private Double co2; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java index 3bdd639..862a5c1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java +++ b/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) 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") @JsonSerialize(nullsUsing = NullSerializer.class) private Double load; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java index 39d317d..7bcb706 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmHandler.java +++ b/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; 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.config.vo.MessageParamVo; 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.StringUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -51,9 +51,9 @@ public class AlarmHandler extends TextWebSocketHandler { @Override public void handleTransportError(WebSocketSession session, Throwable exception) { // 移除会话 - SessionManager.removeAndClose(session.getId()); + AlarmSessionManager.removeAndClose(session.getId()); // 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)){ return; } - MessageParamVo depts = JSONObject.parseObject(message, MessageParamVo.class); - if(ObjectUtil.isEmpty(depts)){ + MessageParamVo param = JSONObject.parseObject(message, MessageParamVo.class); + if(ObjectUtil.isEmpty(param) || CollectionUtil.isEmpty(param.getDeptIds())){ return; } - TextMessage sendMessage = alarmMergeService.getSendMessage(depts); + TextMessage sendMessage = alarmMergeService.getSendMessage(param); if(ObjectUtil.isEmpty(sendMessage)){ return; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java index 33fbd36..707c0cf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/ws/AlarmSessionManager.java +++ b/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 public class AlarmSessionManager { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java new file mode 100644 index 0000000..bf7a8e8 --- /dev/null +++ b/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> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) { + List stationList = homePageService.getStationCount(deptId,serveType); + return R.data(stationList); + } + + @ApiLog + @ApiOperation("关键指标:水电站、风电站、光伏站") + @GetMapping("/powerStation") + @ApiOperationSupport(order = 2) + public R> powerStation(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true)Integer serveType,Long deptId) { + List powerTargetVoList = homePageService.powerTarget(serveType,deptId); + return R.data(powerTargetVoList); + } + + @ApiLog + @ApiOperation("关键指标:储能站、水利") + @GetMapping("/storageConservancy") + @ApiOperationSupport(order = 3) + public R> storageConservancy(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) { + List crucialTargetVoList = homePageService.storageConservancy(serveType,deptId); + return R.data(crucialTargetVoList); + } + + @ApiLog + @ApiOperation("关键指标:暂定其他站") + @GetMapping("/waterAffairs") + @ApiOperationSupport(order = 4) + public R 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> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) { + List 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> planActualTrend(@ApiParam(value = "区域机构ID") Long deptId) { + return R.data(homePageService.planActualTrend(deptId)); + } + + + + @ApiLog + @ApiOperation("计划发电趋势") + @GetMapping("/planGenerationTrend") + @ApiOperationSupport(order = 7) + public R>> planGenerationTrend(@ApiParam(value = "区域机构ID") Long deptId) { + return homePageService.planGenerationTrend(deptId, 0, 2); + } + + @ApiLog + @ApiOperation("区域发电占比") + @GetMapping("/areaGenerationMakeUp") + @ApiOperationSupport(order = 9) + public R>> areaGenerationMakeUp(@ApiParam(value = "区域机构ID") Long deptId) { + return homePageService.areaGenerationMakeUp(deptId, 0, 2); + } + + + @ApiLog + @ApiOperation("统计") + @GetMapping("/getCount") + @ApiOperationSupport(order = 10) + public R>> getCount(@ApiParam(value = "区域机构ID") Long deptId) { + return homePageService.getCount(deptId, 0, 2); + } + + + @ApiLog + @ApiOperation("获取区域") + @GetMapping("/getArea") + @ApiOperationSupport(order = 11) + public R> getArea(@ApiParam(value = "区域机构ID") Long deptId) { + return homePageService.getArea(deptId); + } + + + @ApiLog + @ApiOperation("站点首页") + @GetMapping("/stationHome") + @ApiOperationSupport(order = 11) + public R> homeStation(@ApiParam(value = "区域机构ID") Long deptId) { + return R.data(homePageService.homeStation(deptId)); + } + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java index 666b45c..7b10091 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java +++ b/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; 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 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; @@ -17,118 +15,53 @@ 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 = "水电站-首页") +@RequestMapping("/webHome") +@Api(value = "app首页", tags = "app-首页") @AllArgsConstructor public class HydropowerController extends BladeController { - @NotNull - private final IHomePageService homePageService; + private final HydropowerService service; - @ApiLog - @ApiOperation("服务厂站统计") - @GetMapping("/stationCensus") - @ApiOperationSupport(order = 1) - public R> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) { - List stationList = homePageService.getStationCount(deptId,serveType); - return R.data(stationList); - } - - @ApiLog - @ApiOperation("关键指标:水电站、风电站、光伏站") - @GetMapping("/powerStation") - @ApiOperationSupport(order = 2) - public R> powerStation(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true)Integer serveType,Long deptId) { - List powerTargetVoList = homePageService.powerTarget(serveType,deptId); - return R.data(powerTargetVoList); - } - - @ApiLog - @ApiOperation("关键指标:储能站、水利") - @GetMapping("/storageConservancy") - @ApiOperationSupport(order = 3) - public R> storageConservancy(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType,Long deptId) { - List crucialTargetVoList = homePageService.storageConservancy(serveType,deptId); - return R.data(crucialTargetVoList); - } - - @ApiLog - @ApiOperation("关键指标:暂定其他站") - @GetMapping("/waterAffairs") - @ApiOperationSupport(order = 4) - public R 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> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) { - List 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> planActualTrend(@ApiParam(value = "区域机构ID") Long deptId) { - return R.data(homePageService.planActualTrend(deptId)); - } - - - - @ApiLog - @ApiOperation("计划发电趋势") - @GetMapping("/planGenerationTrend") - @ApiOperationSupport(order = 7) - public R>> planGenerationTrend(@ApiParam(value = "区域机构ID") Long deptId) { - return homePageService.planGenerationTrend(deptId, 0, 2); - } @ApiLog - @ApiOperation("区域发电占比") - @GetMapping("/areaGenerationMakeUp") - @ApiOperationSupport(order = 9) - public R>> areaGenerationMakeUp(@ApiParam(value = "区域机构ID") Long deptId) { - return homePageService.areaGenerationMakeUp(deptId, 0, 2); + @ApiOperation("水电站区域指标") + @GetMapping("/area/target") + @ApiOperationSupport(order = 1) + public R area_target(@ApiParam(value = "站点机构ID") Long deptId) { + HydropowerStationVo response = service.area_target(deptId); + return R.data(response); } - @ApiLog - @ApiOperation("统计") - @GetMapping("/getCount") - @ApiOperationSupport(order = 10) - public R>> getCount(@ApiParam(value = "区域机构ID") Long deptId) { - return homePageService.getCount(deptId, 0, 2); + @ApiOperation("水电站站点指标") + @GetMapping("/station") + @ApiOperationSupport(order = 1) + public R hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) { + HydropowerStationVo response = service.station(deptId); + return R.data(response); } - @ApiLog - @ApiOperation("获取区域") - @GetMapping("/getArea") - @ApiOperationSupport(order = 11) - public R> getArea(@ApiParam(value = "区域机构ID") Long deptId) { - return homePageService.getArea(deptId); + @ApiOperation("水电站机组列表") + @GetMapping("/getPumpList") + @ApiOperationSupport(order = 2) + public R> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) { + List list = service.hydropowerDevice(deptId); + return R.data(list); } - @ApiLog - @ApiOperation("站点首页") - @GetMapping("/stationHome") - @ApiOperationSupport(order = 11) - public R> homeStation(@ApiParam(value = "区域机构ID") Long deptId) { - return R.data(homePageService.homeStation(deptId)); + @ApiOperation("水电站站点列表") + @GetMapping("/webStationList") + @ApiOperationSupport(order = 2) + public R> webStationList(@ApiParam(value = "站点机构ID") Long deptId) { + return R.data(service.webStationList(deptId)); } -} +} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java deleted file mode 100644 index 1f53f74..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java +++ /dev/null @@ -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 hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) { - HydropowerStationVo response = service.station(deptId); - return R.data(response); - } - @ApiLog - @ApiOperation("水电站机组列表") - @GetMapping("/getPumpList") - @ApiOperationSupport(order = 2) - public R> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) { - List list = service.hydropowerDevice(deptId); - return R.data(list); - } - @ApiLog - @ApiOperation("水电站站点列表") - @GetMapping("/webStationList") - @ApiOperationSupport(order = 2) - public R> webStationList(@ApiParam(value = "站点机构ID") Long deptId) { - return R.data(service.webStationList(deptId)); - } - -} \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java index 08e591d..58654ec 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java +++ b/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.Func; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Arrays; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java index 6ccae65..62c0dba 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java @@ -7,6 +7,7 @@ import java.util.List; /** * WEB水电站首页接口 + * @author ysj */ public interface HydropowerService { @@ -19,4 +20,6 @@ public interface HydropowerService { List hydropowerDevice(Long deptId); List webStationList(Long deptId); + + HydropowerStationVo area_target(Long deptId); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 38f74be..88170de 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/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; }).collect(Collectors.toList()); } + + /** + * 水电站区域指标 + * @param deptId + * @return + */ + @Override + public HydropowerStationVo area_target(Long deptId) { + return null; + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java index dcead7c..3f4290e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java +++ b/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.setLoad(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_LOAD))); - // 电压 + // 交流电压 real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE))); - // 电流 + // 交流电流 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 real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE))); // 直流电流2 @@ -296,7 +304,20 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { * @return */ private List 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 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); List records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { @@ -308,7 +329,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { load.setHour(DateUtil.format(time,"yyyy-mm-dd HH")); load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0")); 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.setVoltage(mateReals.get(0).getVoltage()); 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 item.setDirect_one(mateReals.get(0).getDirect_one()); // 直流电流2 @@ -1665,7 +1694,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService { } // 指标数据 - List mateTargets = targets.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); + List mateTargets = targets.stream().filter(o -> o.getDeptId().equals(device.getCreateDept())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(mateTargets)) { // 年发电量、月发电量、日发电量、co2减排、节约标准煤、收益、30天发电量、当日功率、环比日发电量 item.setGenerateYear(mateTargets.get(0).getGenerationYear()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/DeptController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/DeptController.java index 8a619a8..4b0b279 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/DeptController.java +++ b/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.OperatorType; import com.hnac.hzims.operational.report.service.IDeptService; +import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; @@ -36,4 +37,12 @@ public class DeptController extends BladeController { public R> getCurrentUserDept(@RequestParam(required = false) String name,@RequestParam(required = false) String type){ return R.data(deptService.getCurrentUserDept(name,type)); } + + + @ApiLog + @ApiOperation(value = "智能告警权限机构",notes = "智能告警") + @GetMapping("/alarmDeptByCurrentUser") + public R> alarmDeptByCurrentUser(){ + return R.data(deptService.alarmDeptByCurrentUser()); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java index 0597d02..52c51d7 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IDeptService.java @@ -27,4 +27,6 @@ public interface IDeptService { * @return */ List getCurrentUserDept(String name,String type); + + List alarmDeptByCurrentUser(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java index 84df2a5..d71b0bf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java +++ b/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; +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.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationService; import lombok.RequiredArgsConstructor; @@ -16,10 +19,7 @@ import org.springblade.system.vo.DeptVO; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; 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 + */ + @Override + public List alarmDeptByCurrentUser() { + List stations = stationService.list(Wrappers.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()); + } }