From d7283c56289928cee486ca0c6a5a01e25c5d6aae Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 27 Mar 2025 10:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E4=BD=8E=E7=94=B5=E5=8E=8B=E7=A9=BF?= =?UTF-8?q?=E8=B6=8A=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/device/biz/pojo/dto/LineDTO.java | 4 +- .../com/njcn/device/pq/constant/Param.java | 16 +- .../device/pq/pojo/vo/LineDetailDataVO.java | 4 +- .../pq/controller/DeptLineController.java | 2 +- .../njcn/device/pq/mapper/DeptLineMapper.java | 2 +- .../pq/mapper/mapping/DeptLineMapper.xml | 20 +- .../pq/mapper/mapping/LineDetailMapper.xml | 4 +- .../device/pq/mapper/mapping/LineMapper.xml | 5 +- .../pq/service/impl/DeptLineServiceImpl.java | 23 +- .../pq/service/impl/LineServiceImpl.java | 10 +- .../event/api/EventDetailFeignClient.java | 2 +- ...EventDetailFeignClientFallbackFactory.java | 3 +- pqs-event/event-boot/pom.xml | 5 + .../majornetwork/EventDetailController.java | 12 +- .../VoltageRideThroughEventController.java | 14 +- .../majornetwork/EventDetailService.java | 2 +- .../Impl/EventDetailServiceImpl.java | 2 +- .../VoltageRideThroughEventServiceImpl.java | 58 +++-- .../com/njcn/harmonic/pojo/vo/ThdDataVO.java | 1 - .../PowerStatisticsController.java | 9 +- .../impl/PowerStatisticsServiceImpl.java | 80 ++++-- pqs-prepare/prepare-boot/pom.xml | 6 + .../Impl/event/SpThroughServiceImpl.java | 242 +++++++++++------- .../api/UserLedgerFeignClient.java | 7 +- .../UserLedgerFeignClientFallbackFactory.java | 10 +- .../pojo/vo/user/NewUserReportVO.java | 39 +++ .../survey/SurveyPlanController.java | 4 + .../user/UserReportManageController.java | 10 +- .../user/IUserReportNormalService.java | 5 + .../impl/UserReportNormalServiceImpl.java | 13 + 30 files changed, 428 insertions(+), 186 deletions(-) create mode 100644 pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/NewUserReportVO.java diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDTO.java index 553be587c..bd8672f2f 100644 --- a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDTO.java +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/LineDTO.java @@ -35,6 +35,6 @@ public class LineDTO { @ApiModelProperty(name = "objType",value = "对象类型") private String objType; - @ApiModelProperty(name = "新能源场站信息ID") - private String newStationId; + @ApiModelProperty(name = "用户非网侧") + private String objId; } diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/constant/Param.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/constant/Param.java index c98708bcc..801094845 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/constant/Param.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/constant/Param.java @@ -24,14 +24,14 @@ public interface Param { Integer DAY = 5; //以下四个固定ID用于某些业务判断 - //字典(sys_dict_data):电压暂升的ID - String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0"; - //字典(sys_dict_data):电压暂降的ID - String LOWEREVENT = "c37861896dafab0883321e1d508caa51"; - //字典(sys_dict_data):光伏电站的ID - String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e"; - //字典(sys_dict_data):风电场的ID - String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583"; +// //字典(sys_dict_data):电压暂升的ID +// String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0"; +// //字典(sys_dict_data):电压暂降的ID +// String LOWEREVENT = "c37861896dafab0883321e1d508caa51"; +// //字典(sys_dict_data):光伏电站的ID +// String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e"; +// //字典(sys_dict_data):风电场的ID +// String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583"; /** * 以下的四个Map为有功功率页面查看指标详情的四个指标分组下的具体指标(指标对应的可能不对 到时候直接改map里的key即可) diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/LineDetailDataVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/LineDetailDataVO.java index 8e1680a41..e303cfe8b 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/LineDetailDataVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/LineDetailDataVO.java @@ -123,6 +123,8 @@ public class LineDetailDataVO { private LocalDateTime updateTime; @ApiModelProperty(name = "新能源场站信息ID") - private String newStationId; + private String obyId; + @ApiModelProperty(name = "对象类型大类") + private String bigObjType; } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeptLineController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeptLineController.java index b2898bb6d..5e633d2fe 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeptLineController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeptLineController.java @@ -114,7 +114,7 @@ public class DeptLineController extends BaseController { @OperateInfo(info = LogEnum.SYSTEM_COMMON) @PostMapping("/getLineByDeptIdAndNewStation") - @ApiOperation("根据部门id获取绑定的监测点且再根据NewStation进行过滤") + @ApiOperation("根据部门id获取绑定的监测点且再根据(监测点详情进行过滤)") public HttpResult> getLineByDeptIdAndNewStation(@RequestParam("id") String id) { String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation"); List list = deptLineService.getLineByDeptIdAndNewStation(id); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java index 9d203ae51..d66a8ce06 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java @@ -83,5 +83,5 @@ public interface DeptLineMapper extends BaseMapper { List selectSubStationList(@Param("param") SubstationParam substationParam); - List getLineByDeptIdAndNewStation(@Param("id") String id); + List getLineByDeptIdAndNewStation(@Param("id") String id,@Param("dictTree")List dictTree); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml index 8b7a31dcb..1e521ec37 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml @@ -196,9 +196,21 @@ diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml index dc595ccba..2e3ebb47b 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml @@ -43,7 +43,9 @@ a.name lineName, c.Time_Interval, e.name scale, - c.New_Station_Id newStationId + c.Obj_Id obyId, + c.Big_Obj_Type bigObjType, + d.Scale AS scale from pq_line a inner join pq_line b on a.pid = b.id inner join pq_line_detail c on a.id = c.id diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml index 4eb5e725b..82ce9e376 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml @@ -1435,7 +1435,7 @@ pqd.Run_Flag as runFlag, detail.PT_Type AS ptType, detail.PT_Phase_Type AS ptPhaseType, - detail.New_Station_Id AS newStationId + detail.Obj_Id AS objId FROM pq_line line, pq_line_detail detail, @@ -1460,7 +1460,8 @@ vg.Scale AS voltageLevel, pqd.Run_Flag as runFlag, detail.PT_Type AS ptType, - detail.PT_Phase_Type AS ptPhaseType + detail.PT_Phase_Type AS ptPhaseType, + detail.Obj_Id AS objId FROM pq_line line, pq_line_detail detail, diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java index 032fe7cb1..23086b8c2 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeptLineServiceImpl.java @@ -1,5 +1,7 @@ package com.njcn.device.pq.service.impl; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -13,6 +15,9 @@ import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.vo.LineDeviceStateVO; import com.njcn.device.pq.service.DeptLineService; import com.njcn.device.pq.constant.Param; +import com.njcn.system.api.DictTreeFeignClient; +import com.njcn.system.enums.DicTreeEnum; +import com.njcn.system.pojo.vo.DictTreeVO; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.web.pojo.param.DeptLineParam; @@ -22,6 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -37,9 +43,10 @@ import java.util.stream.Collectors; public class DeptLineServiceImpl extends ServiceImpl implements DeptLineService { private final DeptLineMapper deptLineMapper; - private final DeptFeignClient deptFeignClient; private final LineMapper lineMapper; + private final DictTreeFeignClient dictTreeFeignClient; + @Override @Transactional(rollbackFor = Exception.class) @@ -91,7 +98,19 @@ public class DeptLineServiceImpl extends ServiceImpl i @Override public List getLineByDeptIdAndNewStation(String id) { - return this.baseMapper.getLineByDeptIdAndNewStation(id); + List dictTree = new ArrayList<>(); + DictTreeVO powerStation = dictTreeFeignClient.queryByCode(DicTreeEnum.Power_Station.getCode()).getData(); + if(ObjectUtil.isNotNull(powerStation)){ + dictTree.add(powerStation.getId()); + } + DictTreeVO windFarms = dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData(); + if(ObjectUtil.isNotNull(windFarms)){ + dictTree.add(windFarms.getId()); + } + if(CollUtil.isNotEmpty(dictTree)){ + return this.baseMapper.getLineByDeptIdAndNewStation(id,dictTree); + } + return new ArrayList<>(); } @Override diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java index 33cf3751b..b5986372d 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java @@ -894,8 +894,16 @@ public class LineServiceImpl extends ServiceImpl implements Li @Override public List getLineDetailList(List lineIds){ + List data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData(); + Map dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue)); + List lineDetailInfo = lineDetailMapper.getLineDetailInfo(lineIds); + lineDetailInfo.forEach(item->{ + if(dicMap.containsKey(item.getScale())){ + item.setScale(dicMap.get(item.getScale())); + } + }); + return lineDetailInfo; - return lineDetailMapper.getLineDetailInfo(lineIds); } /** diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/api/EventDetailFeignClient.java b/pqs-event/event-api/src/main/java/com/njcn/event/api/EventDetailFeignClient.java index a6594ca81..02d6dc27d 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/api/EventDetailFeignClient.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/api/EventDetailFeignClient.java @@ -80,5 +80,5 @@ public interface EventDetailFeignClient { * 根据开始时间及结束时间获取暂态事件信息 */ @PostMapping("/getNewEventDetailByTime") - HttpResult> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false)LocalDateTime lastTime,@RequestParam("currentTime")LocalDateTime currentTime); + HttpResult> getNewEventDetailByTime(@RequestBody EventCountParam param); } diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/api/fallback/EventDetailFeignClientFallbackFactory.java b/pqs-event/event-api/src/main/java/com/njcn/event/api/fallback/EventDetailFeignClientFallbackFactory.java index e1734b168..f12778665 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/api/fallback/EventDetailFeignClientFallbackFactory.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/api/fallback/EventDetailFeignClientFallbackFactory.java @@ -12,7 +12,6 @@ import com.njcn.event.utils.EventlEnumUtil; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -83,7 +82,7 @@ public class EventDetailFeignClientFallbackFactory implements FallbackFactory> getNewEventDetailByTime(LocalDateTime lastTime, LocalDateTime currentTime) { + public HttpResult> getNewEventDetailByTime(EventCountParam param) { log.error("{}异常,降级处理,异常为:{}", "根据开始时间及结束时间获取暂态事件信息", throwable.toString()); throw new BusinessException(finalExceptionEnum); } diff --git a/pqs-event/event-boot/pom.xml b/pqs-event/event-boot/pom.xml index 1c3ef7d78..217042a16 100644 --- a/pqs-event/event-boot/pom.xml +++ b/pqs-event/event-boot/pom.xml @@ -84,6 +84,11 @@ 1.0.0 compile + + com.njcn + supervision-api + ${project.version} + diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/EventDetailController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/EventDetailController.java index 49456a0d3..0c9c447f7 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/EventDetailController.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/EventDetailController.java @@ -27,7 +27,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -108,7 +107,7 @@ public class EventDetailController extends BaseController { public HttpResult> getEventDetail(@RequestBody List lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) { String methodDescribe = getMethodDescribe("getEventDetail"); LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, lineIndexes); - List result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime, new ArrayList<>()); + List result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } @@ -222,12 +221,13 @@ public class EventDetailController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getNewEventDetailByTime") @ApiOperation("根据开始时间及结束时间获取暂态事件信息") - public HttpResult> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false) LocalDateTime lastTime, @RequestParam("currentTime")LocalDateTime currentTime) { + public HttpResult> getNewEventDetailByTime(@RequestBody EventCountParam param) { String methodDescribe = getMethodDescribe("getNewEventDetailByTime"); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper(); - lambdaQueryWrapper.le(RmpEventDetailPO::getStartTime,currentTime); - if(lastTime != null){ - lambdaQueryWrapper.gt(RmpEventDetailPO::getStartTime,lastTime); + lambdaQueryWrapper.in(RmpEventDetailPO::getMeasurementPointId,param.getIds()); + lambdaQueryWrapper.le(RmpEventDetailPO::getStartTime,param.getEndTime()); + if(param.getStartTime() != null){ + lambdaQueryWrapper.gt(RmpEventDetailPO::getStartTime,param.getStartTime()); } return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailService.list(lambdaQueryWrapper), methodDescribe); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/VoltageRideThroughEventController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/VoltageRideThroughEventController.java index 7f67af55c..93486eb94 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/VoltageRideThroughEventController.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/VoltageRideThroughEventController.java @@ -21,12 +21,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + import java.util.List; /** *

- * 高低电压穿越统计 前端控制器 + * 高低电压穿越统计 前端控制器 *

+ * * @author guofeihu * @since 2024-08-14 */ @@ -39,22 +41,24 @@ public class VoltageRideThroughEventController extends BaseController { private final VoltageRideThroughEventService voltageRideThroughEventService; - @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY) + @OperateInfo(info = LogEnum.SYSTEM_COMMON) @PostMapping("/view") @ApiOperation("查询高低电压穿越视图") public HttpResult> voltageRideThroughView(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) { String methodDescribe = getMethodDescribe("voltageRideThroughView"); LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughView(voltageRideThroughQueryParam), methodDescribe); + List voltageRideThroughVos = voltageRideThroughEventService.voltageRideThroughView(voltageRideThroughQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughVos, methodDescribe); } - @OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY) + @OperateInfo(info = LogEnum.SYSTEM_COMMON) @PostMapping("/voltageRideThroughEventQueryPage") @ApiOperation("查询高低电压穿越暂态事件列表") public HttpResult> voltageRideThroughEventQueryPage(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) { String methodDescribe = getMethodDescribe("voltageRideThroughEventQueryPage"); LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam), methodDescribe); + List eventNewStationVos = voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventNewStationVos, methodDescribe); } } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java index f871c1fe8..f2df8912a 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventDetailService.java @@ -33,7 +33,7 @@ public interface EventDetailService extends IService { /** * 根据监测点集合获取暂态列表 */ - List getEventDetail(List lineIndexes, String startTime, String endTime, List waveType); + List getEventDetail(List lineIndexes, String startTime, String endTime); /** * 根据监测点集合以及分页信息获取暂降事件 diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java index b06f73032..e2355433a 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java @@ -75,7 +75,7 @@ public class EventDetailServiceImpl extends ServiceImpl getEventDetail(List lineIndexes, String startTime, String endTime, List waveType) { + public List getEventDetail(List lineIndexes, String startTime, String endTime) { List info = this.list(new LambdaQueryWrapper() .in(RmpEventDetailPO::getMeasurementPointId, lineIndexes) .ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime))) diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/VoltageRideThroughEventServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/VoltageRideThroughEventServiceImpl.java index 4fbdc4b8b..4fc988ad2 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/VoltageRideThroughEventServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/VoltageRideThroughEventServiceImpl.java @@ -1,12 +1,11 @@ package com.njcn.event.service.majornetwork.Impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; import com.njcn.device.pq.api.DeptLineFeignClient; import com.njcn.device.pq.api.LineFeignClient; -import com.njcn.device.pq.api.NewStationClient; -import com.njcn.device.pq.pojo.po.NewStation; import com.njcn.device.pq.pojo.vo.LineDetailDataVO; -import com.njcn.event.pojo.constant.Param; import com.njcn.event.pojo.param.VoltageRideThroughQueryParam; import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.vo.EventNewStationVo; @@ -15,6 +14,8 @@ import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.event.service.majornetwork.VoltageRideThroughEventService; import com.njcn.prepare.harmonic.api.event.SpThroughFeignClient; import com.njcn.prepare.harmonic.pojo.param.SpThroughParam; +import com.njcn.supervision.api.UserLedgerFeignClient; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.system.api.AreaFeignClient; import com.njcn.system.pojo.po.Area; import com.njcn.user.api.DeptFeignClient; @@ -24,8 +25,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -41,24 +42,18 @@ import java.util.stream.Collectors; public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEventService { private final AreaFeignClient areaFeignClient; - private final DeptFeignClient deptFeignClient; - private final DeptLineFeignClient deptLineFeignClient; - private final LineFeignClient lineFeignClient; - private final EventDetailService eventDetailService; - - private final NewStationClient newStationClient; - private final SpThroughFeignClient spThroughFeignClient; + private final UserLedgerFeignClient userLedgerFeignClient; @Override - public List voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) { + public List voltageRideThroughView(VoltageRideThroughQueryParam param) { List voltageRideThroughVos = new ArrayList<>(); //根据当前选择的部门ID获取其下的子部门集合 - List deptDTOS = deptFeignClient.getDepSonDetailByDeptId(voltageRideThroughQueryParam.getAreaId()).getData(); + List deptDTOS = deptFeignClient.getDepSonDetailByDeptId(param.getAreaId()).getData(); for(DeptDTO deptDTO : deptDTOS){ //子部门信息 VoltageRideThroughVo voltageRideThroughVo = new VoltageRideThroughVo(); @@ -75,10 +70,14 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve List lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId()).getData(); if(!lineIds.isEmpty()){ //根据已绑定能源站的监测点获取关联的暂态事件 - List eventDetails = eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null); - List eventIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList()); - if(!eventIds.isEmpty()){ - SpThroughParam spThroughParam = new SpThroughParam(eventIds,voltageRideThroughQueryParam.getType()); + List eventDetails = eventDetailService.getEventDetail(lineIds, + DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(), + DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())).toString()); + if(CollUtil.isNotEmpty(eventDetails)){ + List eventDetailIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList()); + SpThroughParam spThroughParam = new SpThroughParam(eventDetailIds,param.getType()); + List eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData(); + spThroughParam.setEventIds(eventIds); //赋值子部门高低电压穿越次数 BeanUtils.copyProperties(spThroughFeignClient.getDataByEventIds(spThroughParam).getData(),voltageRideThroughVo); } @@ -89,26 +88,35 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve } @Override - public List voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam) { + public List voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam param) { List eventNewStationVos = new ArrayList<>(); List lineIds = new ArrayList<>(); //获取当前部门下所有的已绑定能源站的监测点 - lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId()).getData()); + lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(param.getAreaId()).getData()); if(!lineIds.isEmpty()){ //根据监测点获取监测点下所有的事件集合 - eventNewStationVos = BeanUtil.copyToList(eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null), EventNewStationVo.class); + List eventDetail = eventDetailService.getEventDetail(lineIds, + DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(), + DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())).toString()); + eventNewStationVos = BeanUtil.copyToList(eventDetail, EventNewStationVo.class); if(!eventNewStationVos.isEmpty()){ - SpThroughParam spThroughParam = new SpThroughParam(eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList()),voltageRideThroughQueryParam.getType()); + List eventDetailIds = eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList()); + SpThroughParam spThroughParam = new SpThroughParam(eventDetailIds,param.getType()); //eventNewStationVos:事件集合中是包含了所有符合条件的事件,可能有部分事件并没有被高低电压穿越记录定时任务所执行 所以需要过滤下 具体逻辑说请看spThroughFeignClient.formatEventIds List eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData(); //过滤掉不符合的事件(eventIds为有效事件ID) eventNewStationVos = eventNewStationVos.stream().filter(item->eventIds.contains(item.getEventId())).collect(Collectors.toList()); + List lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData(); + Map lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, LineDetailDataVO::getObyId)); //特殊处理事件集合中新能源场站名称 + List userReportVOS = userLedgerFeignClient.getUserReportByIds(new ArrayList<>(lineDetailDataMap.values())).getData(); + Map userReportMap = userReportVOS.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getProjectName)); for(EventNewStationVo eventNewStationVo : eventNewStationVos){ - List lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData(); - if(!lineDetailDataVOS.isEmpty()){ - NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData(); - eventNewStationVo.setNewStationName(newStation.getName()); + if(lineDetailDataMap.containsKey(eventNewStationVo.getLineId())){ + String lineID = lineDetailDataMap.get(eventNewStationVo.getLineId()); + if(userReportMap.containsKey(lineID)){ + eventNewStationVo.setNewStationName(userReportMap.get(lineID)); + } } } } diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/ThdDataVO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/ThdDataVO.java index c6ea738ba..a7ad7eaf6 100644 --- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/ThdDataVO.java +++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/ThdDataVO.java @@ -1,6 +1,5 @@ package com.njcn.harmonic.pojo.vo; -import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/powerstatistics/PowerStatisticsController.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/powerstatistics/PowerStatisticsController.java index 3044cd53b..74a9f902f 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/powerstatistics/PowerStatisticsController.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/powerstatistics/PowerStatisticsController.java @@ -42,7 +42,8 @@ public class PowerStatisticsController extends BaseController { @ApiOperation("根据监测点ID及时间获取有功功率趋势") public HttpResult getDataByLineId(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { String methodDescribe = getMethodDescribe("getDataByLineId"); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getDataByLineId(powerStatisticsParam), methodDescribe); + PowerStatisticsVO dataByLineId = powerStatisticsService.getDataByLineId(powerStatisticsParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,dataByLineId , methodDescribe); } /** @@ -53,7 +54,8 @@ public class PowerStatisticsController extends BaseController { @ApiOperation("根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表") public HttpResult> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { String methodDescribe = getMethodDescribe("getTargetLimitById"); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetLimitById(powerStatisticsParam), methodDescribe); + List targetLimitById = powerStatisticsService.getTargetLimitById(powerStatisticsParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,targetLimitById , methodDescribe); } /** @@ -64,7 +66,8 @@ public class PowerStatisticsController extends BaseController { @ApiOperation("点击越限列表时间查询指标的详细数据") public HttpResult> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { String methodDescribe = getMethodDescribe("getTargetByTime"); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetByTime(powerStatisticsParam), methodDescribe); + List targetByTime = powerStatisticsService.getTargetByTime(powerStatisticsParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe); } @ResponseBody diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/activepowerrange/impl/PowerStatisticsServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/activepowerrange/impl/PowerStatisticsServiceImpl.java index 2bb0eb8a0..dd00ea9cc 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/activepowerrange/impl/PowerStatisticsServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/activepowerrange/impl/PowerStatisticsServiceImpl.java @@ -30,6 +30,8 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; import java.util.stream.Collectors; @@ -84,16 +86,17 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService { + powerStatisticsVO.getMinsNum6() + powerStatisticsVO.getMinsNum7() + powerStatisticsVO.getMinsNum8() + powerStatisticsVO.getMinsNum9(); if(total != 0){ - powerStatisticsVO.setProportion0(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum0().intValue() / total * 100))); - powerStatisticsVO.setProportion1(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum1().intValue() / total * 100))); - powerStatisticsVO.setProportion2(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum2().intValue() / total * 100))); - powerStatisticsVO.setProportion3(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum3().intValue() / total * 100))); - powerStatisticsVO.setProportion4(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum4().intValue() / total * 100))); - powerStatisticsVO.setProportion5(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum5().intValue() / total * 100))); - powerStatisticsVO.setProportion6(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum6().intValue() / total * 100))); - powerStatisticsVO.setProportion7(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum7().intValue() / total * 100))); - powerStatisticsVO.setProportion8(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum8().intValue() / total * 100))); - powerStatisticsVO.setProportion9(Double.parseDouble(dftwo.format((double)powerStatisticsVO.getMinsNum9().intValue() / total * 100))); + BigDecimal totalData = BigDecimal.valueOf(total); + powerStatisticsVO.setProportion0(BigDecimal.valueOf(powerStatisticsVO.getMinsNum0()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion1(BigDecimal.valueOf(powerStatisticsVO.getMinsNum1()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion2(BigDecimal.valueOf(powerStatisticsVO.getMinsNum2()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion3(BigDecimal.valueOf(powerStatisticsVO.getMinsNum3()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion4(BigDecimal.valueOf(powerStatisticsVO.getMinsNum4()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion5(BigDecimal.valueOf(powerStatisticsVO.getMinsNum5()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion6(BigDecimal.valueOf(powerStatisticsVO.getMinsNum6()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion7(BigDecimal.valueOf(powerStatisticsVO.getMinsNum7()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion8(BigDecimal.valueOf(powerStatisticsVO.getMinsNum8()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); + powerStatisticsVO.setProportion9(BigDecimal.valueOf(powerStatisticsVO.getMinsNum9()* 100.0).divide(totalData, 4, RoundingMode.HALF_UP).doubleValue()); } return powerStatisticsVO; } @@ -121,7 +124,14 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService { } - //反射获取值 + /** + * @Description: 反射获取值 + * @param obj + * @param fieldName + * @return: java.lang.Object + * @Author: wr + * @Date: 2025/3/26 19:24 + */ private Object reflexObjValue(Object obj, String fieldName) { try { Class clazz = obj.getClass(); @@ -233,64 +243,88 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService { commonQueryParams.add(commonQueryParam); List deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setAVGPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(0)); commonQueryParam.setPhasic(PHASE.get(1)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setAVGPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(0)); commonQueryParam.setPhasic(PHASE.get(2)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setAVGPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(1)); commonQueryParam.setPhasic(PHASE.get(0)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setCP95PhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(1)); commonQueryParam.setPhasic(PHASE.get(1)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setCP95PhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(1)); commonQueryParam.setPhasic(PHASE.get(2)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setCP95PhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(2)); commonQueryParam.setPhasic(PHASE.get(0)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMINPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(2)); commonQueryParam.setPhasic(PHASE.get(1)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMINPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(2)); commonQueryParam.setPhasic(PHASE.get(2)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMINPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(3)); commonQueryParam.setPhasic(PHASE.get(0)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMAXPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(3)); commonQueryParam.setPhasic(PHASE.get(1)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMAXPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } commonQueryParam.setDataType(METHODS.get(3)); commonQueryParam.setPhasic(PHASE.get(2)); deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams); - if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + if(!deviceRtData.isEmpty()) { + thdDataVO.setMAXPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue()))+""); + } return thdDataVO; } diff --git a/pqs-prepare/prepare-boot/pom.xml b/pqs-prepare/prepare-boot/pom.xml index d312b54a1..9a3aa3860 100644 --- a/pqs-prepare/prepare-boot/pom.xml +++ b/pqs-prepare/prepare-boot/pom.xml @@ -129,6 +129,12 @@ liteflow-rule-nacos 2.11.2 + + com.njcn + supervision-api + 1.0.0 + compile + diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/event/SpThroughServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/event/SpThroughServiceImpl.java index a38ad49ae..89e821d64 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/event/SpThroughServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/event/SpThroughServiceImpl.java @@ -1,35 +1,51 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.event; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.device.biz.commApi.CommLineClient; -import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.pms.pojo.param.MonitorTerminalParam; +import com.njcn.device.pq.api.DeptLineFeignClient; +import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.api.NewStationClient; -import com.njcn.device.pq.constant.Param; -import com.njcn.device.pq.pojo.po.NewStation; +import com.njcn.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.event.api.EventDetailFeignClient; import com.njcn.event.api.TransientFeignClient; import com.njcn.event.file.pojo.dto.WaveDataDTO; +import com.njcn.event.pojo.param.EventCountParam; import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.prepare.harmonic.mapper.mysql.event.SpThroughMapper; import com.njcn.prepare.harmonic.pojo.param.SpThroughParam; import com.njcn.prepare.harmonic.pojo.po.SpThroughPO; import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO; import com.njcn.prepare.harmonic.service.mysql.event.SpThroughService; +import com.njcn.supervision.api.UserLedgerFeignClient; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.api.DictTreeFeignClient; +import com.njcn.system.enums.DicDataEnum; +import com.njcn.system.enums.DicTreeEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.system.pojo.vo.DictTreeVO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** * 高低电压穿越 服务实现类 + * * @author guofeihu * @since 2024-08-22 */ @@ -38,43 +54,57 @@ import java.util.stream.Collectors; public class SpThroughServiceImpl extends MppServiceImpl implements SpThroughService { private final EventDetailFeignClient eventDetailFeignClient; - private final CommLineClient commLineClient; - private final NewStationClient newStationClient; - private final TransientFeignClient transientFeignClient; - + private final DeptLineFeignClient deptLineFeignClient; + private final UserLedgerFeignClient userLedgerFeignClient; + private final LineFeignClient lineFeignClient; + private final DictTreeFeignClient dictTreeFeignClient; + private final DicDataFeignClient dicDataFeignClient; @Override @Transactional(rollbackFor = Exception.class) public void record() { + DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData(); + DictTreeVO windFarms = dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData(); + DictTreeVO powerStation = dictTreeFeignClient.queryByCode(DicTreeEnum.Power_Station.getCode()).getData(); LocalDateTime currentTime = LocalDateTime.now(); //获取最新的暂态事件信息(截至目前为止) - List evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(getLastTime(),currentTime).getData(); - MonitorTerminalParam monitorTerminalParam = new MonitorTerminalParam(); - monitorTerminalParam.setSystemType(0); - monitorTerminalParam.setType(0); - for(RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS){ - //获取监测点 - LineDTO lineDTO = commLineClient.getLineDetail(rmpEventDetailPO.getMeasurementPointId()).getData(); - if(lineDTO != null && lineDTO.getNewStationId() != null){ - //监测点必须绑定新能源场站 - NewStation newStation = newStationClient.selectById(lineDTO.getNewStationId()).getData(); - if(newStation != null){ - //事件不能重复统计(除非事件的暂降类型及变电站类型发生变化) + //获取带新能源场站的监测点 + List lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData(); + if (CollUtil.isNotEmpty(lineIds)) { + List lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData(); + Map lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity())); + List objIds = lineDetailDataVOS.stream().map(LineDetailDataVO::getObyId).distinct().collect(Collectors.toList()); + List userReportVOS = userLedgerFeignClient.getUserReportByIds(objIds).getData(); + Map userReportMap = userReportVOS.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getRatePower)); + + + EventCountParam param = new EventCountParam(); + param.setIds(lineIds); + param.setStartTime(getLastTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); + param.setEndTime(currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); + List evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(param).getData(); + MonitorTerminalParam monitorTerminalParam = new MonitorTerminalParam(); + monitorTerminalParam.setSystemType(0); + monitorTerminalParam.setType(0); + for (RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS) { + if (lineDetailDataMap.containsKey(rmpEventDetailPO.getMeasurementPointId())) { + LineDetailDataVO line = lineDetailDataMap.get(rmpEventDetailPO.getMeasurementPointId()); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper(); - lambdaQueryWrapper.eq(SpThroughPO::getEventId,rmpEventDetailPO.getEventId()) - .eq(SpThroughPO::getEventType,rmpEventDetailPO.getEventType()) - .eq(SpThroughPO::getStationType,newStation.getStationType()) - .eq(SpThroughPO::getState,1); - if(this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()){ + lambdaQueryWrapper.eq(SpThroughPO::getEventId, rmpEventDetailPO.getEventId()) + .eq(SpThroughPO::getEventType, rmpEventDetailPO.getEventType()) + .eq(SpThroughPO::getStationType, line.getBigObjType()) + .eq(SpThroughPO::getState, 1); + if (this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()) { //准备高低电压穿越实体bean SpThroughPO spThroughPO = new SpThroughPO(); spThroughPO.setId(IdUtil.simpleUUID()); spThroughPO.setEventId(rmpEventDetailPO.getEventId()); spThroughPO.setEventType(rmpEventDetailPO.getEventType()); - spThroughPO.setStationType(newStation.getStationType()); + spThroughPO.setStationType(line.getBigObjType()); //默认该事件没有穿越 spThroughPO.setIsOrNot(0); //设置波形查询的条件:事件ID @@ -84,79 +114,83 @@ public class SpThroughServiceImpl extends MppServiceImpl> newListRmsData = listRmsDataFormat(waveDataDTO); //暂升事件 - if(Param.UPPEREVENT.equals(rmpEventDetailPO.getEventType())){ + if (rmpEventDetailPO.getEventType().equals(rise.getId())) { //风电场 - if(Param.WINDFARM.equals(newStation.getStationType())){ - if(isThrough(waveDataDTO,125,130,500,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,120,125,1000,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,110,120,10000,voltageLevel.floatValue(),newListRmsData)){ + if (line.getBigObjType().equals(windFarms.getId())) { + if (isThrough(waveDataDTO, 125, 130, 500, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 120, 125, 1000, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) { spThroughPO.setIsOrNot(1); } } //光伏电站 - if(Param.PHOTOVOLTAICPOWER.equals(newStation.getStationType())){ - if(isThrough(waveDataDTO,125,130,500,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,120,125,1000,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,110,120,10000,voltageLevel.floatValue(),newListRmsData)){ + if (line.getBigObjType().equals(powerStation.getId())) { + if (isThrough(waveDataDTO, 125, 130, 500, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 120, 125, 1000, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) { spThroughPO.setIsOrNot(1); } } } //暂降事件 - if(Param.LOWEREVENT.equals(rmpEventDetailPO.getEventType())){ + if (rmpEventDetailPO.getEventType().equals(dip.getId())) { //风电场 - if(Param.WINDFARM.equals(newStation.getStationType())){ - if(isThrough(waveDataDTO,20,-1,625,voltageLevel.floatValue(),newListRmsData)){ + if (line.getBigObjType().equals(windFarms.getId())) { + if (isThrough(waveDataDTO, 20, -1, 625, voltageLevel.floatValue(), newListRmsData)) { spThroughPO.setIsOrNot(1); } } //光伏电站 - if(Param.PHOTOVOLTAICPOWER.equals(newStation.getStationType())){ - if(isThrough(waveDataDTO,0,-1,150,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,20,-1,625,voltageLevel.floatValue(),newListRmsData) - && isThrough(waveDataDTO,20,90,-1,voltageLevel.floatValue(),newListRmsData)){ + if (line.getBigObjType().equals(powerStation.getId())) { + if (isThrough(waveDataDTO, 0, -1, 150, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 20, -1, 625, voltageLevel.floatValue(), newListRmsData) + && isThrough(waveDataDTO, 20, 90, -1, voltageLevel.floatValue(), newListRmsData)) { spThroughPO.setIsOrNot(1); } } } spThroughPO.setCreateTime(currentTime); this.baseMapper.insert(spThroughPO); - }; + } + ; + + } } + } } } - private boolean isThrough(WaveDataDTO waveDataDTO,int start,int end,int ms,float voltageLevel,List> newListRmsData){ + private boolean isThrough(WaveDataDTO waveDataDTO, int start, int end, int ms, float voltageLevel, List> newListRmsData) { boolean isThrough = false; //格式化RMS源数据 float startVoltageLevel = voltageLevel * (start / 100F); float endVoltageLevel = -1; - if(end!=-1){ + if (end != -1) { endVoltageLevel = voltageLevel * (end / 100F); } for (int i = 0; i < newListRmsData.size(); i++) { for (int j = 1; j < newListRmsData.get(i).size(); j++) { float curValue = newListRmsData.get(i).get(j); //当电压达到目标值时 - if(endVoltageLevel != -1 && startVoltageLevel < curValue && curValue <= endVoltageLevel){ - isContinuity(newListRmsData,i+1,newListRmsData.get(i).get(0).intValue(),ms,j); + if (endVoltageLevel != -1 && startVoltageLevel < curValue && curValue <= endVoltageLevel) { + isContinuity(newListRmsData, i + 1, newListRmsData.get(i).get(0).intValue(), ms, j); isThrough = true; - }else if(startVoltageLevel == curValue){ - isContinuity(newListRmsData,i+1,newListRmsData.get(i).get(0).intValue(),ms,j); + } else if (startVoltageLevel == curValue) { + isContinuity(newListRmsData, i + 1, newListRmsData.get(i).get(0).intValue(), ms, j); isThrough = true; } } @@ -164,11 +198,11 @@ public class SpThroughServiceImpl extends MppServiceImpl> newListRmsData,int index,int curms,int ms,int p){ + private boolean isContinuity(List> newListRmsData, int index, int curms, int ms, int p) { boolean isContinuity = false; //记录电压有效毫秒数 Set effectiveMs = new HashSet<>(); - for (int k = curms + 1 ; k <= curms + ms; k++) { + for (int k = curms + 1; k <= curms + ms; k++) { effectiveMs.add(k); } int count = 0; @@ -176,18 +210,18 @@ public class SpThroughServiceImpl extends MppServiceImpl= effectiveMs.size()){ + if (count >= effectiveMs.size()) { isContinuity = true; } return isContinuity; } - private Float checkListIsNull(List list ,int index){ + private Float checkListIsNull(List list, int index) { try { return list.get(index); } catch (Exception e) { @@ -195,13 +229,19 @@ public class SpThroughServiceImpl extends MppServiceImpl> listRmsDataFormat(WaveDataDTO waveDataDTO){ + /** + * @param waveDataDTO + * @Description: 格式化RMS数据:将listRmsData中的电压数据取出在根据pt变比组成新的RMS数据 + * @return: java.util.List> + * @Author: wr + * @Date: 2025/3/26 19:49 + */ + private List> listRmsDataFormat(WaveDataDTO waveDataDTO) { List> newListRmsData = new ArrayList<>(); List indexs = new ArrayList<>(); //根据channelNames取出电压对应listRmsData数据中的数据索引 for (int i = 0; i < waveDataDTO.getChannelNames().size(); i++) { - if(waveDataDTO.getChannelNames().get(i).indexOf("电压")!=-1){ + if (waveDataDTO.getChannelNames().get(i).indexOf("电压") != -1) { indexs.add(i); } } @@ -212,22 +252,27 @@ public class SpThroughServiceImpl extends MppServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper(); lambdaQueryWrapper.orderByDesc(SpThroughPO::getCreateTime); Page page = new Page<>(1, 1); - List spThroughPOS = this.baseMapper.selectPage(page,lambdaQueryWrapper).getRecords(); - if(!spThroughPOS.isEmpty()){ + List spThroughPOS = this.baseMapper.selectPage(page, lambdaQueryWrapper).getRecords(); + if (!spThroughPOS.isEmpty()) { return spThroughPOS.get(0).getCreateTime(); } return null; @@ -236,42 +281,63 @@ public class SpThroughServiceImpl extends MppServiceImpl upperLambdaQueryWrapper = new LambdaQueryWrapper(); - upperLambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds()) - .eq(SpThroughPO::getIsOrNot,1) - .eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER) - .eq(SpThroughPO::getState,1) - .eq(SpThroughPO::getEventType,Param.UPPEREVENT); - Integer upperCount = this.baseMapper.selectCount(upperLambdaQueryWrapper); - spThroughVO.setHighPressure(upperCount == 0?"0":upperCount.toString()); - - LambdaQueryWrapper lowLambdaQueryWrapper = new LambdaQueryWrapper(); - lowLambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds()) - .eq(SpThroughPO::getIsOrNot,1) - .eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER) - .eq(SpThroughPO::getState,1) - .eq(SpThroughPO::getEventType,Param.LOWEREVENT); - Integer lowCount = this.baseMapper.selectCount(lowLambdaQueryWrapper); - spThroughVO.setLowPressure(lowCount == 0?"0":lowCount.toString()); + spThroughVO.setLowPressure("0"); + spThroughVO.setHighPressure("0"); + String treeId = dicTreeId(spThroughParam); + DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + if (ObjectUtil.isNotNull(dip)) { + spThroughVO.setHighPressure(eventCount(spThroughParam, treeId, dip) + ""); + } + DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData(); + if (ObjectUtil.isNotNull(rise)) { + spThroughVO.setLowPressure(eventCount(spThroughParam, treeId, rise) + ""); + } return spThroughVO; } + private Integer eventCount(SpThroughParam spThroughParam, String dictTreeId, DictData rise) { + LambdaQueryWrapper lowLambdaQueryWrapper = new LambdaQueryWrapper(); + lowLambdaQueryWrapper.in(SpThroughPO::getEventId, spThroughParam.getEventIds()) + .eq(SpThroughPO::getIsOrNot, 1) + .eq(SpThroughPO::getStationType, dictTreeId) + .eq(SpThroughPO::getState, 1) + .eq(SpThroughPO::getEventType, rise.getId()); + return this.baseMapper.selectCount(lowLambdaQueryWrapper); + } + /** * 说明: * 此方法是专门提供给event模块-高低压穿越模块中-根据区域获取暂态事件列表使用 * 根据区域获取各个子区域高低电压穿越次数是基于sp_through表中记录来的 那么在根据区域获取暂态事件列表数据也应该基于sp_through表中记录来 * 因为如果不基于sp_through表中记录来 那么根据区域获取暂态事件可能数据非常多且可能一部分的事件数据并没有被定时任务(record方法)所执行 + * * @param spThroughParam * @return */ @Override public List formatEventIds(SpThroughParam spThroughParam) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper(); - lambdaQueryWrapper.in(SpThroughPO::getEventId,spThroughParam.getEventIds()) - .eq(SpThroughPO::getIsOrNot,1) - .eq(SpThroughPO::getStationType,spThroughParam.getStationType().equals("1")?Param.WINDFARM:Param.PHOTOVOLTAICPOWER) - .eq(SpThroughPO::getState,1); + lambdaQueryWrapper.in(SpThroughPO::getEventId, spThroughParam.getEventIds()) + .eq(SpThroughPO::getIsOrNot, 1) + .eq(SpThroughPO::getStationType, dicTreeId(spThroughParam)) + .eq(SpThroughPO::getState, 1); List spThroughPOS = this.baseMapper.selectList(lambdaQueryWrapper); return spThroughPOS.stream().map(SpThroughPO::getEventId).collect(Collectors.toList()); } + + private String dicTreeId(SpThroughParam spThroughParam) { + String dictTreeId = ""; + if (spThroughParam.getStationType().equals("1")) { + DictTreeVO windFarms = dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData(); + if (ObjectUtil.isNotNull(windFarms)) { + dictTreeId = windFarms.getId(); + } + } else { + DictTreeVO powerStation = dictTreeFeignClient.queryByCode(DicTreeEnum.Power_Station.getCode()).getData(); + if (ObjectUtil.isNotNull(powerStation)) { + dictTreeId = powerStation.getId(); + } + } + return dictTreeId; + } } diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserLedgerFeignClient.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserLedgerFeignClient.java index 10a10b1b5..a86e0bb25 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserLedgerFeignClient.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserLedgerFeignClient.java @@ -2,12 +2,10 @@ package com.njcn.supervision.api; import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; -import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory; import com.njcn.supervision.api.fallback.UserLedgerFeignClientFallbackFactory; import com.njcn.supervision.pojo.param.user.UserReportParam; -import com.njcn.supervision.pojo.po.user.UserReportPO; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.supervision.pojo.vo.user.UserLedgerVO; -import com.njcn.supervision.pojo.vo.user.UserReportVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -33,4 +31,7 @@ public interface UserLedgerFeignClient { @PostMapping(value = "/bindUserStation") HttpResult> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId); + + @PostMapping("/getUserReportByIds") + HttpResult> getUserReportByIds(@RequestBody List ids); } diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserLedgerFeignClientFallbackFactory.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserLedgerFeignClientFallbackFactory.java index a450c4ee7..54abad975 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserLedgerFeignClientFallbackFactory.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserLedgerFeignClientFallbackFactory.java @@ -3,12 +3,10 @@ package com.njcn.supervision.api.fallback; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; -import com.njcn.supervision.api.TempLineRunTestFeignClient; import com.njcn.supervision.api.UserLedgerFeignClient; import com.njcn.supervision.pojo.param.user.UserReportParam; -import com.njcn.supervision.pojo.po.user.UserReportPO; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.supervision.pojo.vo.user.UserLedgerVO; -import com.njcn.supervision.pojo.vo.user.UserReportVO; import com.njcn.supervision.utils.SupervisionEnumUtil; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; @@ -48,6 +46,12 @@ public class UserLedgerFeignClientFallbackFactory implements FallbackFactory> getUserReportByIds(List ids) { + log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/NewUserReportVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/NewUserReportVO.java new file mode 100644 index 000000000..f60b83781 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/NewUserReportVO.java @@ -0,0 +1,39 @@ +package com.njcn.supervision.pojo.vo.user; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +/** + * @author web2023 + */ +@Data +public class NewUserReportVO { + + /** + * id + */ + @ApiModelProperty(value = "id") + private String id; + + /** + * 监测点id + */ + @ApiModelProperty(value = "lineId") + private String lineId; + + /** + * 工程名称 + */ + @ApiModelProperty(value = "工程名称") + private String projectName; + + /** + * 额定功率 单位MW + */ + @ApiModelProperty(value = "额定功率 单位MW") + private Double ratePower; + + + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyPlanController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyPlanController.java index 5be53786d..e083a2f5a 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyPlanController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyPlanController.java @@ -108,5 +108,9 @@ public class SurveyPlanController extends BaseController { Boolean b = surveyPlanService.deleteSurveyPlan(supervisionId); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe); } + + + + } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportManageController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportManageController.java index 394229ed1..d2a7598fb 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportManageController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportManageController.java @@ -10,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.po.user.UserReportPO; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.supervision.pojo.vo.user.UserLedgerVO; import com.njcn.supervision.pojo.vo.user.UserReportVO; import com.njcn.supervision.service.user.IUserReportNormalService; @@ -283,7 +284,14 @@ public class UserReportManageController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); } - + @PostMapping("/getUserReportByIds") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("根据ids获取非电网侧用户信息") + public HttpResult> getUserReportByIds(@RequestBody List ids) { + String methodDescribe = getMethodDescribe("getUserReportByIds"); + List userReportByIds = userReportNormalService.getUserReportByIds(ids); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportByIds, methodDescribe); + } } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java index 4a3c661ef..7c3f92bed 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java @@ -6,8 +6,11 @@ import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.bpm.service.IBpmService; import com.njcn.supervision.pojo.param.user.UserReportNormalParam; import com.njcn.supervision.pojo.po.user.UserReportNormalPO; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.supervision.pojo.vo.user.UserReportVO; +import java.util.List; + /** *

* 干扰源用户常态化管理 服务类 @@ -32,4 +35,6 @@ public interface IUserReportNormalService extends IBpmService getUserReportByIds(List ids); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java index 720d05fe0..25074a935 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java @@ -20,6 +20,7 @@ import com.njcn.supervision.enums.UserNatureEnum; import com.njcn.supervision.mapper.user.UserReportNormalMapper; import com.njcn.supervision.pojo.param.user.UserReportNormalParam; import com.njcn.supervision.pojo.po.user.*; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; import com.njcn.supervision.pojo.vo.user.UserReportVO; import com.njcn.supervision.service.user.*; import com.njcn.supervision.utils.InstanceUtil; @@ -281,4 +282,16 @@ public class UserReportNormalServiceImpl extends ServiceImpl getUserReportByIds(List ids) { + List userReportPOS = userReportPOService.listByIds(ids); + List info = new ArrayList<>(); + for (UserReportPO userReportNormalPO : userReportPOS) { + NewUserReportVO newUserReportVO = new NewUserReportVO(); + BeanUtil.copyProperties(userReportNormalPO, newUserReportVO); + info.add(newUserReportVO); + } + return info; + } }