1.公共方法新增变电站信息查询

2.调整技术监督变电站查询方法
This commit is contained in:
wr
2024-03-21 13:23:47 +08:00
parent 72bb397cbf
commit 082b27720b
19 changed files with 254 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ import com.njcn.device.biz.commApi.fallback.CommTerminalGeneralClientFallbackFac
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.MonitorGetParam; import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -193,6 +194,16 @@ public interface CommTerminalGeneralClient {
@PostMapping("/tagOrIdGetMonitorList") @PostMapping("/tagOrIdGetMonitorList")
HttpResult<List<CommMonitorInfoDTO>> tagOrIdGetMonitorList(@RequestBody MonitorGetParam monitorGetParam); HttpResult<List<CommMonitorInfoDTO>> tagOrIdGetMonitorList(@RequestBody MonitorGetParam monitorGetParam);
/**
* 获取变电站信息
* @param substationParam
* @return
*/
@PostMapping("/tagOrIdGetSub")
HttpResult<List<SubGetBase>> tagOrIdGetSub(@RequestBody SubstationParam substationParam);
/** /**
* 用于返回pq 还是pms系统 * 用于返回pq 还是pms系统
* *

View File

@@ -8,6 +8,7 @@ import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.MonitorGetParam; import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.biz.utils.DeviceEnumUtil; import com.njcn.device.biz.utils.DeviceEnumUtil;
@@ -162,6 +163,12 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<SubGetBase>> tagOrIdGetSub(SubstationParam substationParam) {
log.error("{}异常,降级处理,异常为:{}", "根据获取变电站信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public HttpResult<String> isPqOrPms() { public HttpResult<String> isPqOrPms() {
log.error("{}异常,降级处理,异常为:{}", "返回pq还是pms系统", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "返回pq还是pms系统", throwable.toString());

View File

@@ -30,6 +30,16 @@ public class SubGetBase implements Serializable {
*/ */
private String voltageLevel; private String voltageLevel;
/**
* 部门
*/
private String orgId;
/**
* 部门名称
*/
private String orgName;
/** /**
* 所有子级监测点信息 * 所有子级监测点信息
*/ */

View File

@@ -11,6 +11,7 @@ import com.njcn.device.biz.pojo.dto.StatisticsMonitor;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.MonitorGetParam; import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
@@ -407,6 +408,16 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, busBarAndHisMonitorDTOList, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, busBarAndHisMonitorDTOList, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/tagOrIdGetSub")
@ApiOperation("获取变电站信息")
public HttpResult<List<SubGetBase>> tagOrIdGetSub(@RequestBody SubstationParam substationParam) {
String methodDescribe = getMethodDescribe("tagOrIdGetSub");
List<SubGetBase> subGetBases = commTerminalService.tagOrIdGetSub(substationParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subGetBases, methodDescribe);
}
/** /**
* 用于返回pq 还是pms系统 * 用于返回pq 还是pms系统
* @author cdf * @author cdf

View File

@@ -1,8 +1,12 @@
package com.njcn.device.pms.mapper.majornetwork; package com.njcn.device.pms.mapper.majornetwork;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO; import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam; import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.param.TerminalQueryParam; import com.njcn.device.pms.pojo.param.TerminalQueryParam;
@@ -41,4 +45,5 @@ public interface StatationStatMapper extends BaseMapper<StatationStat> {
Page<StatationStatVO> getStatationStatPageList(Page<StatationStatVO> page, @Param("baseParam") TerminalQueryParam baseParam, @Param("orgIds")List<String> orgIds); Page<StatationStatVO> getStatationStatPageList(Page<StatationStatVO> page, @Param("baseParam") TerminalQueryParam baseParam, @Param("orgIds")List<String> orgIds);
List<SubGetBase> selectStatationStatList(@Param("param") SubstationParam param);
} }

View File

@@ -68,5 +68,39 @@
order by a.org_name,a.Power_Name asc order by a.org_name,a.Power_Name asc
</select> </select>
<select id="selectStatationStatList" resultType="com.njcn.device.biz.pojo.dto.SubGetBase">
SELECT
Power_Id AS id,
Power_Name AS name,
Org_Id AS orgId,
Org_Name AS orgName,
Voltage_Level AS voltageLevel
FROM
pms_statation_stat
<where>
<if test="param.orgIds!=null and param.orgIds.size!=0">
and pms_statation_stat.Org_Id in
<foreach collection="param.orgIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.powerIds!=null and param.powerIds.size!=0">
and pms_statation_stat.Power_Id in
<foreach collection="param.powerIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.powerName !=null and param.powerName!='' ">
and pms_statation_stat.Power_Name like CONCAT(CONCAT('%', #{param.powerName}), '%')
</if>
<if test="param.powerVoltageLevel!=null and param.powerVoltageLevel.size!=0">
and pms_statation_stat.Voltage_Level in
<foreach collection="param.powerVoltageLevel" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -598,39 +598,66 @@ public class MonitorSendServiceImpl implements MonitorSendService {
public void exportSend(HttpServletResponse response) throws IOException { public void exportSend(HttpServletResponse response) throws IOException {
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), WindSourceDto.class).build(); ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), WindSourceDto.class).build();
List<WindSourceDto> wind = this.windSend(getMonitors(dictTreeFeignClient.queryByCode("1401").getData().getId())); List<WindSourceDto> wind = this.windSend(getMonitors(dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData().getId()));
WriteSheet writeSheet = EasyExcel.writerSheet(0, "风电场" ).head(WindSourceDto.class).build(); WriteSheet writeSheet = EasyExcel.writerSheet(0, "风电场" ).head(WindSourceDto.class).build();
excelWriter.write(wind, writeSheet); excelWriter.write(wind, writeSheet);
List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(getMonitors(dictTreeFeignClient.queryByCode("1402").getData().getId())); List<PhotovoltaicDto> photovoltaic = this.photovoltaicSend(getMonitors(dictTreeFeignClient.queryByCode(DicTreeEnum.Power_Station.getCode()).getData().getId()));
WriteSheet writeSheet2 = EasyExcel.writerSheet(1, "光伏电站" ).head(PhotovoltaicDto.class).build(); WriteSheet writeSheet2 = EasyExcel.writerSheet(1, "光伏电站" ).head(PhotovoltaicDto.class).build();
excelWriter.write(photovoltaic, writeSheet2); excelWriter.write(photovoltaic, writeSheet2);
List<SensitiveUserDto> sensitive = this.sensitiveUserSend(getMonitors(dictTreeFeignClient.queryByCode("2400").getData().getId())); List<SensitiveUserDto> sensitive = this.sensitiveUserSend(getMonitors(dictTreeFeignClient.queryByCode(DicTreeEnum.Imp_Users.getCode()).getData().getId()));
WriteSheet writeSheet3 = EasyExcel.writerSheet(2, "重要或敏感用户" ).head(SensitiveUserDto.class).build(); WriteSheet writeSheet3 = EasyExcel.writerSheet(2, "重要或敏感用户" ).head(SensitiveUserDto.class).build();
excelWriter.write(sensitive, writeSheet3); excelWriter.write(sensitive, writeSheet3);
List<TractionStationDTO> traction = this.tractionStationSend(getMonitors(dictTreeFeignClient.queryByCode("1300").getData().getId())); List<TractionStationDTO> traction = this.tractionStationSend(getMonitors(dictTreeFeignClient.queryByCode(DicTreeEnum.Ele_Railways.getCode()).getData().getId()));
WriteSheet writeSheet4 = EasyExcel.writerSheet(3, "牵引站" ).head(TractionStationDTO.class).build(); WriteSheet writeSheet4 = EasyExcel.writerSheet(3, "牵引站" ).head(TractionStationDTO.class).build();
excelWriter.write(traction, writeSheet4); excelWriter.write(traction, writeSheet4);
List<OtherUserDto> other = this.otherUserSend(getMonitors(dictTreeFeignClient.queryByCode("2300").getData().getId())); List<OtherUserDto> other = this.otherUserSend(getMonitors("987654321"));
WriteSheet writeSheet5 = EasyExcel.writerSheet(4, "干扰用户" ).head(OtherUserDto.class).build(); WriteSheet writeSheet5 = EasyExcel.writerSheet(4, "干扰用户" ).head(OtherUserDto.class).build();
excelWriter.write(other, writeSheet5); excelWriter.write(other, writeSheet5);
excelWriter.finish(); excelWriter.finish();
} }
private List<Monitor> getMonitors(String id) { private List<Monitor> getMonitors(String id) {
List<DictTreeVO> objType = dictTreeFeignClient.query(id).getData(); SysDicTreePO dicTree;
List<String> objTypeIds=new ArrayList<>(); List<String> objTypeIds=new ArrayList<>();
LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(id.equals("987654321")){
dicTree = new SysDicTreePO();
dicTree.setCode("987654321");
dicTree.setName("其他");
//特殊处理
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
List<SysDicTreePO> typicDic =sysDicTreePOList.stream().filter(item-> Objects.equals(DicTreeEnum.Power_Station.getCode(),item.getCode())||Objects.equals(DicTreeEnum.Ele_Railways.getCode(),item.getCode())||
Objects.equals(DicTreeEnum.Wind_Farms.getCode(),item.getCode())||Objects.equals(DicTreeEnum.Imp_Users.getCode(),item.getCode())).collect(Collectors.toList());
for(SysDicTreePO sysDicTreePO : typicDic){
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getId()).getData();
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList());
objTypeIds.addAll(ids);
objTypeIds.add(sysDicTreePO.getId());
}
lambdaQueryWrapper.notIn(Monitor::getObjType, objTypeIds);
}else {
dicTree = dictTreeFeignClient.queryById(id).getData();
if(ObjectUtil.isNull(dicTree)){
throw new BusinessException("请检查监测对象类型是否存在");
}
List<DictTreeVO> objType = dictTreeFeignClient.query(id).getData();
objTypeIds.add(id); objTypeIds.add(id);
if(CollUtil.isNotEmpty(objType)){ if(CollUtil.isNotEmpty(objType)){
objTypeIds.addAll(objType.stream().map(DictTreeVO::getId).collect(Collectors.toList())); objTypeIds.addAll(objType.stream().map(DictTreeVO::getId).collect(Collectors.toList()));
} }
lambdaQueryWrapper.in(Monitor::getObjType, objTypeIds);
}
//获取监测点信息 //获取监测点信息
List<Monitor> monitorList = monitorService.list(new LambdaQueryWrapper<Monitor>() lambdaQueryWrapper
.in(Monitor::getObjType, objTypeIds) .eq(Monitor::getIsUpToGrid,1);
);
List<Monitor> monitorList = monitorService.list(lambdaQueryWrapper);
List<String> powerIds= monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList()); List<String> powerIds= monitorList.stream().map(Monitor::getPowerrId).distinct().collect(Collectors.toList());
List<StatationStat> statationStats = statationStatService.listByIds(powerIds); List<StatationStat> statationStats = statationStatService.listByIds(powerIds);
Map<String, StatationStat> powerMap = statationStats.stream().collect(Collectors Map<String, StatationStat> powerMap = statationStats.stream().collect(Collectors

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.pojo.dto.StatisticsMonitor; import com.njcn.device.biz.pojo.dto.StatisticsMonitor;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@@ -119,4 +120,13 @@ public interface CommTerminalService {
* @return * @return
*/ */
List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam); List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam);
/**
* 变电站信息
* @param
* @return
*/
List<SubGetBase> tagOrIdGetSub(SubstationParam substationParam);
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pms.service.ledgerManger.impl; package com.njcn.device.pms.service.ledgerManger.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.ObjUtil;
@@ -15,6 +16,7 @@ import com.njcn.device.biz.pojo.dto.StatisticsMonitor;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.utils.COverlimitUtil; import com.njcn.device.biz.utils.COverlimitUtil;
import com.njcn.device.pms.mapper.majornetwork.*; import com.njcn.device.pms.mapper.majornetwork.*;
@@ -876,4 +878,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
return result; return result;
} }
@Override
public List<SubGetBase> tagOrIdGetSub(SubstationParam param) {
return statationStatMapper.selectStatationStatList(param);
}
} }

View File

@@ -160,7 +160,9 @@ implements RStatZwAlarmCountWService {
.le(StringUtils.isNotBlank(endTime), RMpTargetWarnD::getDataDate, endTime) .le(StringUtils.isNotBlank(endTime), RMpTargetWarnD::getDataDate, endTime)
.eq(RMpTargetWarnD::getIsEffective,1); .eq(RMpTargetWarnD::getIsEffective,1);
List<RMpTargetWarnD> measurementPointIdList = rMpTargetWarnDService.list(targetWarnWrapper); List<RMpTargetWarnD> measurementPointIdList = rMpTargetWarnDService.list(targetWarnWrapper);
if (CollUtil.isEmpty(measurementPointIdList)) {
return new ArrayList<>();
}
//获取大于四次的监测点集合 //获取大于四次的监测点集合
List<String> MonitorIdsQuartic = measurementPointIdList.stream() List<String> MonitorIdsQuartic = measurementPointIdList.stream()
.filter(obj -> obj.getIsWarn() == 1) .filter(obj -> obj.getIsWarn() == 1)

View File

@@ -10,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pq.mapper.LineDetailMapper; import com.njcn.device.pq.mapper.LineDetailMapper;
@@ -336,6 +337,14 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/tagOrIdGetSub")
@ApiOperation("获取变电站信息")
public HttpResult<List<SubGetBase>> tagOrIdGetSub(@RequestBody SubstationParam substationParam) {
String methodDescribe = getMethodDescribe("tagOrIdGetSub");
List<SubGetBase> subGetBases = commTerminalService.tagOrIdGetSub(substationParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subGetBases, methodDescribe);
}
/** /**
* 获取监测点的台账详细信息 * 获取监测点的台账详细信息
* @author cdf * @author cdf

View File

@@ -3,7 +3,9 @@ package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.dto.TerminalGetBase; import com.njcn.device.biz.pojo.dto.TerminalGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.po.DeptLine;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@@ -77,4 +79,7 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType); List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType);
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("runFlag")List<Integer> runFlag,@Param("dataType")List<Integer> dataType); List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("runFlag")List<Integer> runFlag,@Param("dataType")List<Integer> dataType);
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
} }

View File

@@ -137,4 +137,46 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="selectSubStationList" resultType="com.njcn.device.biz.pojo.dto.SubGetBase">
select
DISTINCT
substation.id id,
substation.name name,
pq_dept_line.id orgId,
sub.Scale voltageLevel
from pq_dept_line pq_dept_line
inner join pq_line point on pq_dept_line.line_id = point.id
inner join pq_line_detail lineDetail on point.id = lineDetail.id
inner join pq_line voltage on point.pid = voltage.id
inner join pq_line dev on voltage.pid = dev.id
inner join pq_device device on dev.id = device.id
inner join pq_line substation on dev.pid = substation.id
inner join pq_substation sub on sub.id = substation.id
<where>
device.Dev_Model = 1
and point.state = 1
<if test="param.orgIds!=null and param.orgIds.size!=0">
and pq_dept_line.id in
<foreach collection="param.orgIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.powerIds!=null and param.powerIds.size!=0">
and substation.id in
<foreach collection="param.powerIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="param.powerName !=null and param.powerName!='' ">
and substation.name like CONCAT(CONCAT('%', #{param.powerName}), '%')
</if>
<if test="param.powerVoltageLevel!=null and param.powerVoltageLevel.size!=0">
and sub.Scale in
<foreach collection="param.powerVoltageLevel" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper> </mapper>

View File

@@ -2,6 +2,7 @@ package com.njcn.device.pq.service;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@@ -83,4 +84,6 @@ public interface CommTerminalService {
List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam); List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam);
List<SubGetBase> tagOrIdGetSub(SubstationParam substationParam);
} }

View File

@@ -2,7 +2,9 @@ package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.dto.TerminalGetBase; import com.njcn.device.biz.pojo.dto.TerminalGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.web.pojo.param.DeptLineParam; import com.njcn.web.pojo.param.DeptLineParam;
@@ -107,6 +109,10 @@ public interface DeptLineService extends IService<DeptLine> {
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType); List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType);
List<SubGetBase> getSubStationList(SubstationParam substationParam);
/** /**
* 根据监测点id集合查询部门信息id * 根据监测点id集合查询部门信息id
* @param ids 部门ids * @param ids 部门ids

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pq.service.impl; package com.njcn.device.pq.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.pojo.enums.common.ServerEnum; import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -7,12 +8,14 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.EnumUtils; import com.njcn.common.utils.EnumUtils;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.mapper.LineMapper; import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.service.CommTerminalService; import com.njcn.device.pq.service.CommTerminalService;
import com.njcn.device.pq.service.DeptLineService; import com.njcn.device.pq.service.DeptLineService;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.user.pojo.po.Dept;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -250,6 +253,22 @@ public class CommTerminalServiceImpl implements CommTerminalService {
return result; return result;
} }
@Override
public List<SubGetBase> tagOrIdGetSub(SubstationParam substationParam) {
List<SubGetBase> subStationList = deptLineService.getSubStationList(substationParam);
if(CollUtil.isNotEmpty(subStationList)){
List<String> ids = subStationList.stream().map(SubGetBase::getOrgId).collect(Collectors.toList());
List<Dept> data = deptFeignClient.getDeptInfoListByIds(ids).getData();
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
subStationList.stream().forEach(x->{
if(deptMap.containsKey(x.getOrgId())){
x.setOrgName(deptMap.get(x.getOrgId()));
}
});
}
return subStationList;
}
private List<Integer> filterDataTypeNew(String serverName) { private List<Integer> filterDataTypeNew(String serverName) {
List<Integer> devType = new ArrayList<>(); List<Integer> devType = new ArrayList<>();

View File

@@ -3,7 +3,9 @@ package com.njcn.device.pq.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.dto.TerminalGetBase; import com.njcn.device.biz.pojo.dto.TerminalGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.mapper.DeptLineMapper; import com.njcn.device.pq.mapper.DeptLineMapper;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.po.DeptLine;
@@ -124,6 +126,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
return deptLineMapper.orgSubStationInfoGet(devType); return deptLineMapper.orgSubStationInfoGet(devType);
} }
@Override
public List<SubGetBase> getSubStationList(SubstationParam substationParam) {
return deptLineMapper.selectSubStationList(substationParam);
}
@Override @Override
public DeptLine getLineByLineIds(String ids) { public DeptLine getLineByLineIds(String ids) {
return this.getOne(new LambdaQueryWrapper<DeptLine>() return this.getOne(new LambdaQueryWrapper<DeptLine>()

View File

@@ -12,6 +12,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pms.api.StatationStatClient; import com.njcn.device.pms.api.StatationStatClient;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam; import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.po.StatationStat; import com.njcn.device.pms.pojo.po.StatationStat;
@@ -71,7 +74,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
private final RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper; private final RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
private final DeptFeignClient deptFeignClient; private final DeptFeignClient deptFeignClient;
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final StatationStatClient statationStatClient; private final CommTerminalGeneralClient commTerminalGeneralClient;
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final RSurveyCycleMapper rSurveyCycleMapper; private final RSurveyCycleMapper rSurveyCycleMapper;
private final RSurveyPlanConfigService rSurveyPlanConfigService; private final RSurveyPlanConfigService rSurveyPlanConfigService;
@@ -120,16 +123,16 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
rGeneralSurveyPlanDetailService.remove(queryWrapper); rGeneralSurveyPlanDetailService.remove(queryWrapper);
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<>(); List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<>();
PmsStatationStatInfoParam param =new PmsStatationStatInfoParam(); SubstationParam param =new SubstationParam();
param.setPowerIds(rGeneralSurveyPlanAddParm.getSubIds()); param.setPowerIds(rGeneralSurveyPlanAddParm.getSubIds());
List<StatationStat> stationList = statationStatClient.getPowerInfo(param).getData(); List<SubGetBase> stationList = commTerminalGeneralClient.tagOrIdGetSub(param).getData();
for (StatationStat stat : stationList) { for (SubGetBase stat : stationList) {
RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail(); RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail();
rGeneralSurveyPlanDetail.setPlanNo(rGeneralSurveyPlanAddParm.getPlanNo()); rGeneralSurveyPlanDetail.setPlanNo(rGeneralSurveyPlanAddParm.getPlanNo());
rGeneralSurveyPlanDetail.setOrgNo(stat.getOrgId()); rGeneralSurveyPlanDetail.setOrgNo(stat.getOrgId());
rGeneralSurveyPlanDetail.setOrgName(stat.getOrgName()); rGeneralSurveyPlanDetail.setOrgName(stat.getOrgName());
rGeneralSurveyPlanDetail.setSubId(stat.getPowerId()); rGeneralSurveyPlanDetail.setSubId(stat.getId());
rGeneralSurveyPlanDetail.setSubName(stat.getPowerName()); rGeneralSurveyPlanDetail.setSubName(stat.getName());
/*目前时间与计划开始时间,结束时间一致*/ /*目前时间与计划开始时间,结束时间一致*/
rGeneralSurveyPlanDetail.setGeneralSurveyStartTime(rGeneralSurveyPlanAddParm.getPlanStartTime()); rGeneralSurveyPlanDetail.setGeneralSurveyStartTime(rGeneralSurveyPlanAddParm.getPlanStartTime());
rGeneralSurveyPlanDetail.setGeneralSurveyTime(rGeneralSurveyPlanAddParm.getPlanStartTime()); rGeneralSurveyPlanDetail.setGeneralSurveyTime(rGeneralSurveyPlanAddParm.getPlanStartTime());
@@ -424,7 +427,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
@Override @Override
public RGeneralSurveyPlanAddParm querySubStatation(Integer statetionNum) { public RGeneralSurveyPlanAddParm querySubStatation(Integer statetionNum) {
/*查询所有电站并过滤已经参加当期普测电站*/ /*查询所有电站并过滤已经参加当期普测电站*/
List<StatationStat> list = statationStatClient.getPowerInfo(new PmsStatationStatInfoParam()).getData(); List<SubGetBase> list = commTerminalGeneralClient.tagOrIdGetSub(null).getData();
/**查出当前周期id**/ /**查出当前周期id**/
QueryWrapper<RSurveyCyclePO> rSurveyCyclePOQueryWrapper = new QueryWrapper(); QueryWrapper<RSurveyCyclePO> rSurveyCyclePOQueryWrapper = new QueryWrapper();
@@ -447,8 +451,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
List<String> finalSubIds = subIds; List<String> finalSubIds = subIds;
List<StatationStat> filterList = list.stream().filter(temp -> !finalSubIds.contains(temp.getPowerId())).collect(Collectors.toList()); List<SubGetBase> filterList = list.stream().filter(temp -> !finalSubIds.contains(temp.getId())).collect(Collectors.toList());
List<StatationStat> addList = new ArrayList<>(); List<SubGetBase> addList = new ArrayList<>();
List<RSurveyPlanConfigPO> rSurveyPlanConfigPOList = rSurveyPlanConfigService.list(); List<RSurveyPlanConfigPO> rSurveyPlanConfigPOList = rSurveyPlanConfigService.list();
Map<String, RSurveyPlanConfigPO> orgIdMap = rSurveyPlanConfigPOList.stream(). Map<String, RSurveyPlanConfigPO> orgIdMap = rSurveyPlanConfigPOList.stream().
@@ -459,7 +463,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
BeanUtils.copyProperties(temp, deptSubstationVO); BeanUtils.copyProperties(temp, deptSubstationVO);
/*如果存在电站占比配置随机抽出配置电站个数*/ /*如果存在电站占比配置随机抽出配置电站个数*/
if (orgIdMap.containsKey(temp.getId())) { if (orgIdMap.containsKey(temp.getId())) {
List<StatationStat> collect = filterList.stream().filter(statationStat -> Objects. List<SubGetBase> collect = filterList.stream().filter(statationStat -> Objects.
equals(statationStat.getOrgId(), temp.getId())).collect(Collectors.toList()); equals(statationStat.getOrgId(), temp.getId())).collect(Collectors.toList());
RSurveyPlanConfigPO rSurveyPlanConfigPO = orgIdMap.get(temp.getId()); RSurveyPlanConfigPO rSurveyPlanConfigPO = orgIdMap.get(temp.getId());
//向上取整 //向上取整
@@ -467,7 +471,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
statetionNum); statetionNum);
if (collect.size() >= v) { if (collect.size() >= v) {
Collections.shuffle(collect); Collections.shuffle(collect);
List<StatationStat> lastList = collect.stream().limit(v).collect(Collectors.toList()); List<SubGetBase> lastList = collect.stream().limit(v).collect(Collectors.toList());
addList.addAll(lastList); addList.addAll(lastList);
} else { } else {
addList.addAll(collect); addList.addAll(collect);
@@ -479,13 +483,13 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
if (statetionNum > addList.size()) { if (statetionNum > addList.size()) {
/*取差集,当通过比例抽取变电站不够时 重差集里取*/ /*取差集,当通过比例抽取变电站不够时 重差集里取*/
List<StatationStat> collect = filterList.stream().filter(o -> !addList.contains(o)).collect(Collectors.toList()); List<SubGetBase> collect = filterList.stream().filter(o -> !addList.contains(o)).collect(Collectors.toList());
int differenceCount = statetionNum - addList.size(); int differenceCount = statetionNum - addList.size();
Collections.shuffle(collect); Collections.shuffle(collect);
List<StatationStat> lastList = collect.stream().limit(differenceCount).collect(Collectors.toList()); List<SubGetBase> lastList = collect.stream().limit(differenceCount).collect(Collectors.toList());
addList.addAll(lastList); addList.addAll(lastList);
} }
List<String> result = addList.stream().map(StatationStat::getPowerId).collect(Collectors.toList()); List<String> result = addList.stream().map(SubGetBase::getId).collect(Collectors.toList());
RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm = new RGeneralSurveyPlanAddParm(); RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm = new RGeneralSurveyPlanAddParm();
rGeneralSurveyPlanAddParm.setSubIds(result); rGeneralSurveyPlanAddParm.setSubIds(result);
return rGeneralSurveyPlanAddParm; return rGeneralSurveyPlanAddParm;
@@ -547,16 +551,16 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
BeanUtils.copyProperties(temp, deptSubstationVO); BeanUtils.copyProperties(temp, deptSubstationVO);
deptSubstationVO.setDisabled(true); deptSubstationVO.setDisabled(true);
deptSubstationVO.setFlag(true); deptSubstationVO.setFlag(true);
PmsStatationStatInfoParam param =new PmsStatationStatInfoParam(); SubstationParam param =new SubstationParam();
param.setOrgIds(Arrays.asList(temp.getCode())); param.setOrgIds(Arrays.asList(temp.getCode()));
List<StatationStat> list1 = statationStatClient.getPowerInfo(param).getData(); List<SubGetBase> list1 = commTerminalGeneralClient.tagOrIdGetSub(param).getData();
List<DeptSubstationVO> children = deptSubstationVO.getChildren(); List<DeptSubstationVO> children = deptSubstationVO.getChildren();
List<DeptSubstationVO> collect = list1.stream().map(statationStat -> { List<DeptSubstationVO> collect = list1.stream().map(statationStat -> {
DeptSubstationVO deptSubstationVO1 = new DeptSubstationVO(); DeptSubstationVO deptSubstationVO1 = new DeptSubstationVO();
deptSubstationVO1.setId(statationStat.getPowerId()); deptSubstationVO1.setId(statationStat.getId());
deptSubstationVO1.setPid(temp.getId()); deptSubstationVO1.setPid(temp.getId());
deptSubstationVO1.setName(statationStat.getPowerName()); deptSubstationVO1.setName(statationStat.getName());
if (finalSubIds.contains(statationStat.getPowerId())) { if (finalSubIds.contains(statationStat.getId())) {
deptSubstationVO1.setDisabled(true); deptSubstationVO1.setDisabled(true);
} }
deptSubstationVO1.setFlag(true); deptSubstationVO1.setFlag(true);

View File

@@ -114,6 +114,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
} }
//默认为正常状态 //默认为正常状态
dept.setState(DataStateEnum.ENABLE.getCode()); dept.setState(DataStateEnum.ENABLE.getCode());
if (StrUtil.isBlank(dept.getCode())){
dept.setCode(dept.getId());
}
return this.save(dept); return this.save(dept);
} }