1.pms配网查询信息优化
This commit is contained in:
@@ -31,6 +31,14 @@ public interface PwMonitorClient {
|
|||||||
@PostMapping("/getPwMonitorList")
|
@PostMapping("/getPwMonitorList")
|
||||||
HttpResult<List<PwPmsMonitorDTO>> getPwMonitorList(@RequestBody PwPmsMonitorParam pwPmsMonitorParam);
|
HttpResult<List<PwPmsMonitorDTO>> getPwMonitorList(@RequestBody PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配网所有监测点信息(新)
|
||||||
|
* @param pwPmsMonitorParam 参数条件
|
||||||
|
* @return 配网所有监测点信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getPwNewMonitorList")
|
||||||
|
HttpResult<List<PwPmsMonitorDTO>> getPwNewMonitorList(@RequestBody PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子集配网所有监测点信息
|
* 获取子集配网所有监测点信息
|
||||||
* @param pwPmsMonitorParam 参数条件
|
* @param pwPmsMonitorParam 参数条件
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ public class PwMonitorClientFallbackFactory implements FallbackFactory<PwMonitor
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<PwPmsMonitorDTO>> getPwNewMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取配网所有监测点信息(新)", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<PwPmsMonitorDTO>> getPwSubsetMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
public HttpResult<List<PwPmsMonitorDTO>> getPwSubsetMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "获取子集配网所有监测点信息", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "获取子集配网所有监测点信息", throwable.toString());
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public class PwPmsMonitorParam {
|
|||||||
@NotBlank(message = "部门索引不可为空")
|
@NotBlank(message = "部门索引不可为空")
|
||||||
private String orgId;
|
private String orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "ids", value = "监测点id",required = true)
|
||||||
|
private List<String> ids;
|
||||||
|
|
||||||
@ApiModelProperty(name = "powerId", value = "所属变电站")
|
@ApiModelProperty(name = "powerId", value = "所属变电站")
|
||||||
private List<String> powerId;
|
private List<String> powerId;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,22 @@ public class PwMonitorController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配网所有监测点信息(新)
|
||||||
|
*
|
||||||
|
* @param pwPmsMonitorParam 参数条件
|
||||||
|
* @return 配网所有监测点信息
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getPwNewMonitorList")
|
||||||
|
@ApiOperation("获取配网所有监测点信息(新)")
|
||||||
|
@ApiImplicitParam(name = "pwPmsMonitorParam",value = "获取配网所有监测点信息条件",required = true)
|
||||||
|
public HttpResult<List<PwPmsMonitorDTO>> getPwNewMonitorList(@RequestBody @Validated PwPmsMonitorParam pwPmsMonitorParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getPwNewMonitorList");
|
||||||
|
List<PwPmsMonitorDTO> monitorList = iPwMonitorService.getPwNewMonitorList(pwPmsMonitorParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配网所有监测点信息
|
* 获取配网所有监测点信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,6 +26,29 @@ public interface PwMonitorMapper {
|
|||||||
@Param("monitorTag") List<String> monitorTag,
|
@Param("monitorTag") List<String> monitorTag,
|
||||||
@Param("pwPmsMonitorParam") PwPmsMonitorParam pwPmsMonitorParam);
|
@Param("pwPmsMonitorParam") PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配网监测点信息
|
||||||
|
*
|
||||||
|
* @param deptIdList 所有子部门索引
|
||||||
|
* @param monitorTag 监测点标签
|
||||||
|
* @param pwPmsMonitorParam 查询条件
|
||||||
|
* @return 配网监测点信息
|
||||||
|
*/
|
||||||
|
List<PwPmsMonitorDTO> getPwMonitorDataNewList(@Param("deptIdList") List<String> deptIdList,
|
||||||
|
@Param("ids") List<String> ids,
|
||||||
|
@Param("monitorTag") List<String> monitorTag,
|
||||||
|
@Param("pwPmsMonitorParam") PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配网监测点信息
|
||||||
|
*
|
||||||
|
* @param ids 监测点id
|
||||||
|
* @param name 监测点标签
|
||||||
|
* @return 配网监测点信息
|
||||||
|
*/
|
||||||
|
List<PwPmsMonitorDTO> getPwMonitorName(@Param("ids") List<String> ids,
|
||||||
|
@Param("name") String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分布式光伏配网所有监测点信息
|
* 获取分布式光伏配网所有监测点信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -228,5 +228,113 @@
|
|||||||
<select id="getPwBaseMonitorInfo">
|
<select id="getPwBaseMonitorInfo">
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getPwMonitorName" resultType="com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO">
|
||||||
|
select
|
||||||
|
id as monitorId,
|
||||||
|
`Name` as monitorName
|
||||||
|
from
|
||||||
|
((
|
||||||
|
SELECT
|
||||||
|
pm.id,
|
||||||
|
pm.`Name`
|
||||||
|
FROM
|
||||||
|
pms_monitor AS pm
|
||||||
|
) UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
ppd.id,
|
||||||
|
ppd.`Name`
|
||||||
|
FROM
|
||||||
|
pms_power_distributionarea AS ppd
|
||||||
|
) UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
ppc.id,
|
||||||
|
ppc.`Name`
|
||||||
|
FROM
|
||||||
|
pms_power_client as ppc
|
||||||
|
|
||||||
|
) UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
ppgu.id,
|
||||||
|
ppgu.`Name`
|
||||||
|
FROM
|
||||||
|
pms_power_generation_user AS ppgu
|
||||||
|
)
|
||||||
|
)as a
|
||||||
|
<where>
|
||||||
|
<if test="ids!=null and ids.size()!=0">
|
||||||
|
AND id IN
|
||||||
|
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
<if test="name !=null and name != ''">
|
||||||
|
AND `Name` LIKE CONCAT('%',#{name},'%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="getPwMonitorDataNewList" resultType="com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO">
|
||||||
|
SELECT
|
||||||
|
pdm.Org_Id AS orgId,
|
||||||
|
ps.Org_Name AS orgName,
|
||||||
|
pdm.`Power_Station_Id` AS powerId,
|
||||||
|
ps.`Power_Name` AS powerName,
|
||||||
|
pdm.Monitor_Id AS monitorId,
|
||||||
|
pdm.Line_Id,
|
||||||
|
pdm.Monitor_Sort AS monitorSort,
|
||||||
|
pdm.Voltage_Level AS voltageLevel,
|
||||||
|
pdm.If_Power_User AS if_powerUser,
|
||||||
|
pdm.Monitor_State AS monitorState,
|
||||||
|
pdm.Created_Date AS createdDate,
|
||||||
|
pdm.Terminal_Id AS terminalId,
|
||||||
|
pdm.Terminal_Wiring_Method AS terminalWiringMethod
|
||||||
|
FROM
|
||||||
|
pms_distribution_monitor pdm
|
||||||
|
INNER JOIN pms_statation_stat ps ON ps.Power_Id = pdm.Power_Station_Id
|
||||||
|
<where>
|
||||||
|
<if test="ids!=null and ids.size()!=0">
|
||||||
|
pdm.Monitor_Id IN
|
||||||
|
<foreach collection="ids" item="orgId" open="(" close=")" separator=",">
|
||||||
|
#{orgId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="deptIdList!=null and deptIdList.size()!=0">
|
||||||
|
pdm.Org_Id IN
|
||||||
|
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
|
||||||
|
#{orgId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="pwPmsMonitorParam.voltageLevels!=null and pwPmsMonitorParam.voltageLevels.size()!=0">
|
||||||
|
AND pdm.Voltage_Level IN
|
||||||
|
<foreach collection="pwPmsMonitorParam.voltageLevels" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="pwPmsMonitorParam.powerId!=null and pwPmsMonitorParam.powerId.size()!=0">
|
||||||
|
AND pdm.Power_Station_Id IN
|
||||||
|
<foreach collection="pwPmsMonitorParam.powerId" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="pwPmsMonitorParam.monitorSort!=null and pwPmsMonitorParam.monitorSort.size()!=0">
|
||||||
|
AND pdm.Monitor_Sort IN
|
||||||
|
<foreach collection="pwPmsMonitorParam.monitorSort" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="pwPmsMonitorParam.monitorState!=null and pwPmsMonitorParam.monitorState.size()!=0">
|
||||||
|
AND pdm.Monitor_State IN
|
||||||
|
<foreach collection="pwPmsMonitorParam.monitorState" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="pwPmsMonitorParam.ifPowerUser != null and pwPmsMonitorParam.ifPowerUser != ''">
|
||||||
|
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ public interface DistributionMonitorMapper extends MppBaseMapper<DistributionMon
|
|||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/10/27
|
* @date 2022/10/27
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
List<PmsMonitorBaseDTO> getIdByOrgId(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);
|
List<PmsMonitorBaseDTO> getIdByOrgId(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);
|
||||||
|
List<PmsMonitorBaseDTO> getIdByOrgIdNew(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 新获取配网配网信息
|
* @Description: 新获取配网配网信息
|
||||||
|
|||||||
@@ -410,6 +410,20 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getIdByOrgIdNew" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO">
|
||||||
|
SELECT
|
||||||
|
Monitor_Id AS monitorId,
|
||||||
|
Org_Id AS orgId,
|
||||||
|
Power_Station_Id AS terminalId,
|
||||||
|
Line_Id AS lineId
|
||||||
|
FROM
|
||||||
|
pms_distribution_monitor
|
||||||
|
WHERE
|
||||||
|
Org_Id IN
|
||||||
|
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
AND STATUS = 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,19 @@ public interface IPwMonitorService {
|
|||||||
* @param pwPmsMonitorParam 参数条件
|
* @param pwPmsMonitorParam 参数条件
|
||||||
* @return 配网所有监测点信息
|
* @return 配网所有监测点信息
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
List<PwPmsMonitorDTO> getPwMonitorList(PwPmsMonitorParam pwPmsMonitorParam);
|
List<PwPmsMonitorDTO> getPwMonitorList(PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @param pwPmsMonitorParam
|
||||||
|
* @return: java.util.List<com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/10/12 14:43
|
||||||
|
*/
|
||||||
|
List<PwPmsMonitorDTO> getPwNewMonitorList(PwPmsMonitorParam pwPmsMonitorParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分布式光伏配网所有监测点信息
|
* 获取分布式光伏配网所有监测点信息
|
||||||
* @param pwPmsMonitorParam
|
* @param pwPmsMonitorParam
|
||||||
|
|||||||
@@ -94,6 +94,22 @@ public class IPwMonitorServiceImpl implements IPwMonitorService {
|
|||||||
return pwPmsMonitorDTOS;
|
return pwPmsMonitorDTOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PwPmsMonitorDTO> getPwNewMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
||||||
|
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(pwPmsMonitorParam.getOrgId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||||
|
List<String> orgCodeList= deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||||
|
List<PwPmsMonitorDTO> pwPmsMonitorDTOS = pwMonitorMapper.getPwMonitorDataNewList(orgCodeList,pwPmsMonitorParam.getIds(),pwPmsMonitorParam.getMonitorTag(), pwPmsMonitorParam);
|
||||||
|
List<String> ids = pwPmsMonitorDTOS.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||||
|
List<PwPmsMonitorDTO> pwMonitorName = pwMonitorMapper.getPwMonitorName(ids, pwPmsMonitorParam.getMonitorName());
|
||||||
|
Map<String, PwPmsMonitorDTO> monitorMap = pwPmsMonitorDTOS.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, Function.identity()));
|
||||||
|
pwMonitorName.stream().forEach(x->{
|
||||||
|
if(monitorMap.containsKey(x.getMonitorId())){
|
||||||
|
BeanUtil.copyProperties(x,monitorMap.get(x.getMonitorId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return pwMonitorName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PwPmsMonitorDTO> getPwPhotovoltaicMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
public List<PwPmsMonitorDTO> getPwPhotovoltaicMonitorList(PwPmsMonitorParam pwPmsMonitorParam) {
|
||||||
//定义待返回终端信息
|
//定义待返回终端信息
|
||||||
@@ -153,7 +169,7 @@ public class IPwMonitorServiceImpl implements IPwMonitorService {
|
|||||||
}
|
}
|
||||||
pwPmsMonitorParam.setMonitorTag(Arrays.asList(data.getId()));
|
pwPmsMonitorParam.setMonitorTag(Arrays.asList(data.getId()));
|
||||||
pwPmsMonitorParam.setOrgId(param.getId()); //单位id
|
pwPmsMonitorParam.setOrgId(param.getId()); //单位id
|
||||||
List<PwPmsMonitorDTO> pwMonitorList = this.getPwMonitorList(pwPmsMonitorParam);
|
List<PwPmsMonitorDTO> pwMonitorList = this.getPwNewMonitorList(pwPmsMonitorParam);
|
||||||
Map<String, List<PwPmsMonitorDTO>> collect = pwMonitorList.stream().collect(Collectors.groupingBy(PwPmsMonitorDTO::getMonitorSort));
|
Map<String, List<PwPmsMonitorDTO>> collect = pwMonitorList.stream().collect(Collectors.groupingBy(PwPmsMonitorDTO::getMonitorSort));
|
||||||
//初始化对象
|
//初始化对象
|
||||||
List<Integer> monitorList=new ArrayList<>(3);
|
List<Integer> monitorList=new ArrayList<>(3);
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ public class DistributionMonitorServiceImpl extends MppServiceImpl<DistributionM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PmsMonitorBaseDTO> getMonitorByCondition(List<String> deptIdList, PmsDeviceInfoParam pmsDeviceInfoParam) {
|
public List<PmsMonitorBaseDTO> getMonitorByCondition(List<String> deptIdList, PmsDeviceInfoParam pmsDeviceInfoParam) {
|
||||||
return this.baseMapper.getIdByOrgId(deptIdList, pmsDeviceInfoParam);
|
// return this.baseMapper.getIdByOrgId(deptIdList, pmsDeviceInfoParam);
|
||||||
|
return this.baseMapper.getIdByOrgIdNew(deptIdList, pmsDeviceInfoParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,13 +33,7 @@
|
|||||||
SELECT
|
SELECT
|
||||||
event_id as eventId,
|
event_id as eventId,
|
||||||
measurement_point_id as measurementPointId,
|
measurement_point_id as measurementPointId,
|
||||||
Event_Type as eventType,
|
Event_Type as eventType
|
||||||
start_time as startTime,
|
|
||||||
Duration as duration,
|
|
||||||
feature_amplitude as featureAmplitude,
|
|
||||||
phase as phase,
|
|
||||||
event_describe as eventDescribe,
|
|
||||||
wave_path as wavePath
|
|
||||||
FROM
|
FROM
|
||||||
r_mp_event_detail
|
r_mp_event_detail
|
||||||
WHERE
|
WHERE
|
||||||
@@ -67,32 +61,29 @@
|
|||||||
SELECT
|
SELECT
|
||||||
event_id as eventId,
|
event_id as eventId,
|
||||||
measurement_point_id as measurementPointId,
|
measurement_point_id as measurementPointId,
|
||||||
Event_Type as eventType,
|
Event_Type as eventType
|
||||||
start_time as startTime,
|
|
||||||
Duration as duration,
|
|
||||||
feature_amplitude as featureAmplitude,
|
|
||||||
phase as phase,
|
|
||||||
event_describe as eventDescribe,
|
|
||||||
wave_path as wavePath
|
|
||||||
FROM
|
FROM
|
||||||
r_mp_event_detail
|
r_mp_event_detail
|
||||||
WHERE
|
<where>
|
||||||
measurement_point_id IN
|
|
||||||
<foreach collection="monitorIds" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
<if test="eventType != null and eventType.size() >0">
|
|
||||||
AND Event_Type IN
|
|
||||||
<foreach collection="eventType" item="item" open="(" close=")" separator=",">
|
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND DATE_FORMAT(start_time, '%Y-%m') >= #{startTime}
|
AND DATE_FORMAT(start_time, '%Y-%m') >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="endTime != null and endTime != ''">
|
||||||
AND DATE_FORMAT(start_time, '%Y-%m') <= #{endTime}
|
AND DATE_FORMAT(start_time, '%Y-%m') <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="monitorIds != null and monitorIds.size() != 0 ">
|
||||||
|
and measurement_point_id IN
|
||||||
|
<foreach collection="monitorIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null and eventType.size() >0">
|
||||||
|
AND Event_Type IN
|
||||||
|
<foreach collection="eventType" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByIdAndValue" resultType="com.njcn.event.pojo.po.EventDetailNew">
|
<select id="selectByIdAndValue" resultType="com.njcn.event.pojo.po.EventDetailNew">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.njcn.system.enums.DicDataEnum;
|
|||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -54,17 +55,17 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<EventMonitorReportVO> getMonitorEventCount(EventMonitorReportParam eventMonitorReportParam) {
|
public List<EventMonitorReportVO> getMonitorEventCount(EventMonitorReportParam eventMonitorReportParam) {
|
||||||
|
List<EventMonitorReportVO> resultList = new ArrayList<>();
|
||||||
//提取查询参数
|
//提取查询参数
|
||||||
|
|
||||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||||
Integer type = eventMonitorReportParam.getType(); //时间类型(日/月)
|
Integer type = eventMonitorReportParam.getType(); //时间类型(日/月)
|
||||||
|
|
||||||
//查询监测点信息
|
//查询监测点信息
|
||||||
List<PwPmsMonitorDTO> monitorList = this.getMonitorList(eventMonitorReportParam);
|
// List<PwPmsMonitorDTO> monitorList = this.getMonitorList(eventMonitorReportParam);
|
||||||
List<String> monitorIdList = monitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()); //监测点id信息
|
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||||
|
pwPmsMonitorParam.setOrgId(eventMonitorReportParam.getId());
|
||||||
Map<String, PwPmsMonitorDTO> monitorMap = monitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, Function.identity(),(kye1,key2)->kye1));
|
List<String> monitorIdList = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||||
|
|
||||||
//获取电压等级的字典
|
//获取电压等级的字典
|
||||||
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||||
@@ -85,13 +86,21 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
|||||||
detailList = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIdList, null, startTime, endTime);
|
detailList = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIdList, null, startTime, endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(detailList)) {
|
||||||
|
//todo 获取监测点信息接口
|
||||||
|
pwPmsMonitorParam.setMonitorName(eventMonitorReportParam.getMonitorName());
|
||||||
|
//台区名称(监测点名称)
|
||||||
|
pwPmsMonitorParam.setIds(detailList.stream().map(RmpEventDetailPO::getMeasurementPointId).distinct().collect(Collectors.toList()));
|
||||||
|
List<PwPmsMonitorDTO> monitorList = pwMonitorClient.getPwNewMonitorList(pwPmsMonitorParam).getData();
|
||||||
|
|
||||||
|
Map<String, PwPmsMonitorDTO> monitorMap = monitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, Function.identity(),(kye1,key2)->kye1));
|
||||||
|
|
||||||
Map<String, List<RmpEventDetailPO>> groupByMIdDetailMap = detailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.toList()));
|
Map<String, List<RmpEventDetailPO>> groupByMIdDetailMap = detailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.toList()));
|
||||||
List<EventMonitorReportVO> resultList = new ArrayList<>();
|
|
||||||
groupByMIdDetailMap.forEach((key, monitorEventDetailList) -> {
|
groupByMIdDetailMap.forEach((key, monitorEventDetailList) -> {
|
||||||
//封装返回需要返回的信息
|
//封装返回需要返回的信息
|
||||||
|
if (monitorMap.containsKey(key)) {
|
||||||
PwPmsMonitorDTO pmsMonitorDTO = monitorMap.get(key);
|
PwPmsMonitorDTO pmsMonitorDTO = monitorMap.get(key);
|
||||||
|
|
||||||
EventMonitorReportVO eventMonitorReportVO = new EventMonitorReportVO();
|
EventMonitorReportVO eventMonitorReportVO = new EventMonitorReportVO();
|
||||||
eventMonitorReportVO.setDate(startTime); //查询时间
|
eventMonitorReportVO.setDate(startTime); //查询时间
|
||||||
//监测点基本信息
|
//监测点基本信息
|
||||||
@@ -125,8 +134,9 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
|||||||
eventMonitorReportVO.setShortInterruptionCount(eventMonitorReportVO.getShortInterruptionCount() == null ? 0 : eventMonitorReportVO.getShortInterruptionCount());
|
eventMonitorReportVO.setShortInterruptionCount(eventMonitorReportVO.getShortInterruptionCount() == null ? 0 : eventMonitorReportVO.getShortInterruptionCount());
|
||||||
|
|
||||||
resultList.add(eventMonitorReportVO);
|
resultList.add(eventMonitorReportVO);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,25 +343,4 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
|||||||
list.add(entity110);
|
list.add(entity110);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* 获取单位(及子孙单位)下的监测点信息(抽取的公共方法)
|
|
||||||
* @author jianghaifei
|
|
||||||
* @date 2022-10-29 17:37
|
|
||||||
* @param eventMonitorReportParam
|
|
||||||
* @return java.util.List<com.njcn.device.pms.pojo.dto.PmsMonitorDTO>
|
|
||||||
*/
|
|
||||||
private List<PwPmsMonitorDTO> getMonitorList(EventMonitorReportParam eventMonitorReportParam) {
|
|
||||||
//提起参数
|
|
||||||
String id = eventMonitorReportParam.getId(); //单位id
|
|
||||||
String monitorName = eventMonitorReportParam.getMonitorName(); //台区名称
|
|
||||||
|
|
||||||
//根据条件查询单位下面的所有配网监测点
|
|
||||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
|
||||||
pwPmsMonitorParam.setOrgId(id); //单位id
|
|
||||||
pwPmsMonitorParam.setMonitorName(monitorName); //台区名称(监测点名称)
|
|
||||||
List<PwPmsMonitorDTO> pwMonitorList = pwMonitorClient.getPwMonitorList(pwPmsMonitorParam).getData();
|
|
||||||
|
|
||||||
return pwMonitorList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user