高低电压穿越功能优化
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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即可)
|
||||
|
||||
@@ -123,6 +123,8 @@ public class LineDetailDataVO {
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(name = "新能源场站信息ID")
|
||||
private String newStationId;
|
||||
private String obyId;
|
||||
|
||||
@ApiModelProperty(name = "对象类型大类")
|
||||
private String bigObjType;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DeptLineController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getLineByDeptIdAndNewStation")
|
||||
@ApiOperation("根据部门id获取绑定的监测点且再根据NewStation进行过滤")
|
||||
@ApiOperation("根据部门id获取绑定的监测点且再根据(监测点详情进行过滤)")
|
||||
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation");
|
||||
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id);
|
||||
|
||||
@@ -83,5 +83,5 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
|
||||
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
|
||||
|
||||
List<String> getLineByDeptIdAndNewStation(@Param("id") String id);
|
||||
List<String> getLineByDeptIdAndNewStation(@Param("id") String id,@Param("dictTree")List<String> dictTree);
|
||||
}
|
||||
|
||||
@@ -196,9 +196,21 @@
|
||||
</select>
|
||||
|
||||
<select id="getLineByDeptIdAndNewStation" resultType="string">
|
||||
select pdl.Line_Id from pq_dept_line pdl
|
||||
inner join pq_line_detail pld on pdl.Line_Id = pld.Id
|
||||
where pdl.Id = #{id}
|
||||
and exists (select 1 from pq_new_station pns where pns.id = pld.New_Station_Id and pns.state = 1)
|
||||
SELECT
|
||||
pld.id
|
||||
FROM
|
||||
pq_dept_line pdl
|
||||
INNER JOIN pq_line_detail pld ON pdl.Line_Id = pld.Id
|
||||
WHERE
|
||||
<if test="id !=null and id !='' ">
|
||||
pdl.Id = #{id}
|
||||
</if>
|
||||
<if test="dictTree!=null and dictTree.size!=0">
|
||||
and pld.Big_Obj_Type in
|
||||
<foreach collection="dictTree" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
and pld.Obj_Id IS NOT NULL and pld.Obj_Id !=''
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<DeptLineMapper, DeptLine> 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<DeptLineMapper, DeptLine> i
|
||||
|
||||
@Override
|
||||
public List<String> getLineByDeptIdAndNewStation(String id) {
|
||||
return this.baseMapper.getLineByDeptIdAndNewStation(id);
|
||||
List<String> 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
|
||||
|
||||
@@ -894,8 +894,16 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
@Override
|
||||
public List<LineDetailDataVO> getLineDetailList(List<String> lineIds){
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
List<LineDetailDataVO> lineDetailInfo = lineDetailMapper.getLineDetailInfo(lineIds);
|
||||
lineDetailInfo.forEach(item->{
|
||||
if(dicMap.containsKey(item.getScale())){
|
||||
item.setScale(dicMap.get(item.getScale()));
|
||||
}
|
||||
});
|
||||
return lineDetailInfo;
|
||||
|
||||
return lineDetailMapper.getLineDetailInfo(lineIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,5 +80,5 @@ public interface EventDetailFeignClient {
|
||||
* 根据开始时间及结束时间获取暂态事件信息
|
||||
*/
|
||||
@PostMapping("/getNewEventDetailByTime")
|
||||
HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false)LocalDateTime lastTime,@RequestParam("currentTime")LocalDateTime currentTime);
|
||||
HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestBody EventCountParam param);
|
||||
}
|
||||
|
||||
@@ -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<Ev
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(LocalDateTime lastTime, LocalDateTime currentTime) {
|
||||
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(EventCountParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据开始时间及结束时间获取暂态事件信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -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<List<EventDetail>> getEventDetail(@RequestBody List<String> lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetail");
|
||||
LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, lineIndexes);
|
||||
List<EventDetail> result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime, new ArrayList<>());
|
||||
List<EventDetail> 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<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false) LocalDateTime lastTime, @RequestParam("currentTime")LocalDateTime currentTime) {
|
||||
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestBody EventCountParam param) {
|
||||
String methodDescribe = getMethodDescribe("getNewEventDetailByTime");
|
||||
LambdaQueryWrapper<RmpEventDetailPO> 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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 高低电压穿越统计 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @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<List<VoltageRideThroughVo>> voltageRideThroughView(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("voltageRideThroughView");
|
||||
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughView(voltageRideThroughQueryParam), methodDescribe);
|
||||
List<VoltageRideThroughVo> 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<List<EventNewStationVo>> voltageRideThroughEventQueryPage(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("voltageRideThroughEventQueryPage");
|
||||
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam), methodDescribe);
|
||||
List<EventNewStationVo> eventNewStationVos = voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventNewStationVos, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface EventDetailService extends IService<RmpEventDetailPO> {
|
||||
/**
|
||||
* 根据监测点集合获取暂态列表
|
||||
*/
|
||||
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType);
|
||||
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 根据监测点集合以及分页信息获取暂降事件
|
||||
|
||||
@@ -75,7 +75,7 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime) {
|
||||
List<RmpEventDetailPO> info = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIndexes)
|
||||
.ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
||||
|
||||
@@ -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<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
public List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam param) {
|
||||
List<VoltageRideThroughVo> voltageRideThroughVos = new ArrayList<>();
|
||||
//根据当前选择的部门ID获取其下的子部门集合
|
||||
List<DeptDTO> deptDTOS = deptFeignClient.getDepSonDetailByDeptId(voltageRideThroughQueryParam.getAreaId()).getData();
|
||||
List<DeptDTO> deptDTOS = deptFeignClient.getDepSonDetailByDeptId(param.getAreaId()).getData();
|
||||
for(DeptDTO deptDTO : deptDTOS){
|
||||
//子部门信息
|
||||
VoltageRideThroughVo voltageRideThroughVo = new VoltageRideThroughVo();
|
||||
@@ -75,10 +70,14 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
|
||||
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId()).getData();
|
||||
if(!lineIds.isEmpty()){
|
||||
//根据已绑定能源站的监测点获取关联的暂态事件
|
||||
List<EventDetail> eventDetails = eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null);
|
||||
List<String> eventIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList());
|
||||
if(!eventIds.isEmpty()){
|
||||
SpThroughParam spThroughParam = new SpThroughParam(eventIds,voltageRideThroughQueryParam.getType());
|
||||
List<EventDetail> eventDetails = eventDetailService.getEventDetail(lineIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
if(CollUtil.isNotEmpty(eventDetails)){
|
||||
List<String> eventDetailIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList());
|
||||
SpThroughParam spThroughParam = new SpThroughParam(eventDetailIds,param.getType());
|
||||
List<String> 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<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
public List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam param) {
|
||||
List<EventNewStationVo> eventNewStationVos = new ArrayList<>();
|
||||
List<String> 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> 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<String> eventDetailIds = eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList());
|
||||
SpThroughParam spThroughParam = new SpThroughParam(eventDetailIds,param.getType());
|
||||
//eventNewStationVos:事件集合中是包含了所有符合条件的事件,可能有部分事件并没有被高低电压穿越记录定时任务所执行 所以需要过滤下 具体逻辑说请看spThroughFeignClient.formatEventIds
|
||||
List<String> eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData();
|
||||
//过滤掉不符合的事件(eventIds为有效事件ID)
|
||||
eventNewStationVos = eventNewStationVos.stream().filter(item->eventIds.contains(item.getEventId())).collect(Collectors.toList());
|
||||
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData();
|
||||
Map<String, String> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, LineDetailDataVO::getObyId));
|
||||
//特殊处理事件集合中新能源场站名称
|
||||
List<NewUserReportVO> userReportVOS = userLedgerFeignClient.getUserReportByIds(new ArrayList<>(lineDetailDataMap.values())).getData();
|
||||
Map<String, String> userReportMap = userReportVOS.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getProjectName));
|
||||
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
|
||||
List<LineDetailDataVO> 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ApiOperation("根据监测点ID及时间获取有功功率趋势")
|
||||
public HttpResult<PowerStatisticsVO> 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<List<PowerStatisticsTargetVO>> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetLimitById");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetLimitById(powerStatisticsParam), methodDescribe);
|
||||
List<PowerStatisticsTargetVO> targetLimitById = powerStatisticsService.getTargetLimitById(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,targetLimitById , methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +66,8 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ApiOperation("点击越限列表时间查询指标的详细数据")
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetByTime");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getTargetByTime(powerStatisticsParam), methodDescribe);
|
||||
List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTime(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
|
||||
@@ -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<StatisticalDataDTO> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,12 @@
|
||||
<artifactId>liteflow-rule-nacos</artifactId>
|
||||
<version>2.11.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.yomahub</groupId>-->
|
||||
<!-- <artifactId>liteflow-rule-nacos</artifactId>-->
|
||||
|
||||
@@ -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<SpThroughMapper, SpThroughPO> 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<RmpEventDetailPO> evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(getLastTime(),currentTime).getData();
|
||||
//获取带新能源场站的监测点
|
||||
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData();
|
||||
Map<String, LineDetailDataVO> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
|
||||
List<String> objIds = lineDetailDataVOS.stream().map(LineDetailDataVO::getObyId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> userReportVOS = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
Map<String, Double> 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<RmpEventDetailPO> evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(param).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){
|
||||
//事件不能重复统计(除非事件的暂降类型及变电站类型发生变化)
|
||||
for (RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS) {
|
||||
if (lineDetailDataMap.containsKey(rmpEventDetailPO.getMeasurementPointId())) {
|
||||
LineDetailDataVO line = lineDetailDataMap.get(rmpEventDetailPO.getMeasurementPointId());
|
||||
LambdaQueryWrapper<SpThroughPO> 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
|
||||
@@ -86,77 +116,81 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(bis);
|
||||
//强转成WaveDataDTO
|
||||
waveDataDTO = (WaveDataDTO)ois.readObject();
|
||||
waveDataDTO = (WaveDataDTO) ois.readObject();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//标称电压
|
||||
if(lineDTO.getVoltageLevel()!=null){
|
||||
Float voltageLevel = Float.parseFloat(lineDTO.getVoltageLevel());
|
||||
if (line.getScale() != null) {
|
||||
Float voltageLevel = Float.parseFloat(line.getScale());
|
||||
//格式化数据源
|
||||
List<List<Float>> 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<List<Float>> newListRmsData){
|
||||
private boolean isThrough(WaveDataDTO waveDataDTO, int start, int end, int ms, float voltageLevel, List<List<Float>> 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<SpThroughMapper, SpThro
|
||||
return isThrough;
|
||||
}
|
||||
|
||||
private boolean isContinuity(List<List<Float>> newListRmsData,int index,int curms,int ms,int p){
|
||||
private boolean isContinuity(List<List<Float>> newListRmsData, int index, int curms, int ms, int p) {
|
||||
boolean isContinuity = false;
|
||||
//记录电压有效毫秒数
|
||||
Set<Integer> 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<SpThroughMapper, SpThro
|
||||
for (int j = 0; j < newListRmsData.get(i).size(); j++) {
|
||||
int curVallue = newListRmsData.get(i).get(0).intValue();
|
||||
//如果当前相别的电压毫秒数在有效期范围内则记录下数字
|
||||
if(effectiveMs.contains(curVallue) && checkListIsNull(newListRmsData.get(i),p)!=null){
|
||||
count ++;
|
||||
if (effectiveMs.contains(curVallue) && checkListIsNull(newListRmsData.get(i), p) != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count >= effectiveMs.size()){
|
||||
if (count >= effectiveMs.size()) {
|
||||
isContinuity = true;
|
||||
}
|
||||
return isContinuity;
|
||||
}
|
||||
|
||||
private Float checkListIsNull(List<Float> list ,int index){
|
||||
private Float checkListIsNull(List<Float> list, int index) {
|
||||
try {
|
||||
return list.get(index);
|
||||
} catch (Exception e) {
|
||||
@@ -195,13 +229,19 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
|
||||
}
|
||||
}
|
||||
|
||||
//格式化RMS数据:将listRmsData中的电压数据取出在根据pt变比组成新的RMS数据
|
||||
private List<List<Float>> listRmsDataFormat(WaveDataDTO waveDataDTO){
|
||||
/**
|
||||
* @param waveDataDTO
|
||||
* @Description: 格式化RMS数据:将listRmsData中的电压数据取出在根据pt变比组成新的RMS数据
|
||||
* @return: java.util.List<java.util.List < java.lang.Float>>
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/26 19:49
|
||||
*/
|
||||
private List<List<Float>> listRmsDataFormat(WaveDataDTO waveDataDTO) {
|
||||
List<List<Float>> newListRmsData = new ArrayList<>();
|
||||
List<Integer> 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<SpThroughMapper, SpThro
|
||||
//数组第一个为时间
|
||||
newCur.add(cur.get(0));
|
||||
//便利电压数据的索引
|
||||
for(Integer index : indexs){
|
||||
for (Integer index : indexs) {
|
||||
//根据PT变比算出新的数据(前端取的一次值,也是根据pt变比算出的,所以这边和前端保持一致)新增到新的数组中
|
||||
newCur.add(cur.get(index) * Float.parseFloat((waveDataDTO.getPt() / 1000F)+""));
|
||||
newCur.add(cur.get(index) * Float.parseFloat((waveDataDTO.getPt() / 1000F) + ""));
|
||||
}
|
||||
newListRmsData.add(newCur);
|
||||
}
|
||||
return newListRmsData;
|
||||
}
|
||||
|
||||
//拿到最近一次插入高低电压穿越表信息的时间
|
||||
private LocalDateTime getLastTime(){
|
||||
/**
|
||||
* 说明:
|
||||
* 此方法是专门提供给event模块-高低压穿越模块中-获取最新一条暂态事件时间使用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private LocalDateTime getLastTime() {
|
||||
LambdaQueryWrapper<SpThroughPO> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.orderByDesc(SpThroughPO::getCreateTime);
|
||||
Page<SpThroughPO> page = new Page<>(1, 1);
|
||||
List<SpThroughPO> spThroughPOS = this.baseMapper.selectPage(page,lambdaQueryWrapper).getRecords();
|
||||
if(!spThroughPOS.isEmpty()){
|
||||
List<SpThroughPO> 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<SpThroughMapper, SpThro
|
||||
@Override
|
||||
public SpThroughVO getDataByEventIds(SpThroughParam spThroughParam) {
|
||||
SpThroughVO spThroughVO = new SpThroughVO();
|
||||
LambdaQueryWrapper<SpThroughPO> 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<SpThroughPO> 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<SpThroughPO> 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<String> formatEventIds(SpThroughParam spThroughParam) {
|
||||
LambdaQueryWrapper<SpThroughPO> 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<SpThroughPO> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId);
|
||||
|
||||
@PostMapping("/getUserReportByIds")
|
||||
HttpResult<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids);
|
||||
}
|
||||
|
||||
@@ -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<Use
|
||||
log.error("{}异常,降级处理,异常为:{}", "用户电站信息绑定", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<NewUserReportVO>> getUserReportByIds(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -108,5 +108,9 @@ public class SurveyPlanController extends BaseController {
|
||||
Boolean b = surveyPlanService.deleteSurveyPlan(supervisionId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getUserReportByIds");
|
||||
List<NewUserReportVO> userReportByIds = userReportNormalService.getUserReportByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportByIds, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 服务类
|
||||
@@ -32,4 +35,6 @@ public interface IUserReportNormalService extends IBpmService<UserReportNormalPO
|
||||
String cancelUserReport(BpmProcessInstanceCancelParam cancelReqVO);
|
||||
|
||||
UserReportVO.UserReportListVO getUserReportByFangAnId(String id);
|
||||
|
||||
List<NewUserReportVO> getUserReportByIds(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -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<UserReportNormalMap
|
||||
userReportVO.setGovernReport(Collections.singletonList(governReport.orElse(null)));
|
||||
return userReportVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NewUserReportVO> getUserReportByIds(List<String> ids) {
|
||||
List<UserReportPO> userReportPOS = userReportPOService.listByIds(ids);
|
||||
List<NewUserReportVO> info = new ArrayList<>();
|
||||
for (UserReportPO userReportNormalPO : userReportPOS) {
|
||||
NewUserReportVO newUserReportVO = new NewUserReportVO();
|
||||
BeanUtil.copyProperties(userReportNormalPO, newUserReportVO);
|
||||
info.add(newUserReportVO);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user