台账算法支持
This commit is contained in:
@@ -17,11 +17,21 @@ public class PmsMonitorBaseDTO implements Serializable {
|
||||
*/
|
||||
private String monitorId;
|
||||
|
||||
/***
|
||||
* 电压等级
|
||||
*/
|
||||
private String voltageLevel;
|
||||
|
||||
/***
|
||||
* 运维单位ID
|
||||
*/
|
||||
private String operationId;
|
||||
|
||||
/***
|
||||
* 单位ID
|
||||
*/
|
||||
private String orgId;
|
||||
|
||||
/***
|
||||
* 电站ID
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.pms.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
@@ -38,4 +39,7 @@ public class GeneratrixWire extends BaseEntity {
|
||||
private String generatrixName;
|
||||
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orgId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.njcn.device.pms.controller.ledgerManger;
|
||||
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/4/26 10:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/commTerminal")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(tags = "通用台账-所有子孙部门以及监测点")
|
||||
public class CommTerminalController extends BaseController {
|
||||
|
||||
private final IMonitorService monitorService;
|
||||
|
||||
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
/**
|
||||
* 通过部门获取所有子集部门所拥有的监测点
|
||||
*
|
||||
* @author wr
|
||||
* @date 2023/4/26
|
||||
*/
|
||||
@PostMapping("/deptGetLineIds")
|
||||
@ApiOperation("通过部门获取所有子集部门所拥有的监测点")
|
||||
@ApiImplicitParam(name = "param", value = "请求参数", required = true)
|
||||
public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam param) {
|
||||
String methodDescribe = getMethodDescribe("deptGetLineList");
|
||||
List<DeptGetChildrenDTO> monitor = monitorService.deptMonitor(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有子单位信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("getDeptChildrenByParent")
|
||||
@ApiOperation("根据单位获取所有子单位信息")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetBase>> getDeptChildrenByParent(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("getDeptChildrenByParent");
|
||||
List<DeptGetBase> result = commTerminalService.getDeptChildrenByParent(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单位获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("deptGetLine")
|
||||
@ApiOperation("根据单位获取监测点信息")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("deptGetLine");
|
||||
List<DeptGetChildrenMoreDTO> result = commTerminalService.deptGetLine(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有变电站
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("deptGetSubStation")
|
||||
@ApiOperation("根据单位获取所有变电站")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetSubStationDTO>> deptSubStation(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("deptSubStation");
|
||||
List<DeptGetSubStationDTO> result = commTerminalService.deptSubStation(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单位获取所有变电站
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("deptGetBusBar")
|
||||
@ApiOperation("根据单位获取所有母线")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetBusBarDTO>> deptBusBar(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("deptBusBar");
|
||||
List<DeptGetBusBarDTO> result = commTerminalService.deptBusBar(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有装置
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("deptGetDevice")
|
||||
@ApiOperation("根据单位获取所有装置")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("deptGetDevice");
|
||||
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据单站id获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("substationGetLine")
|
||||
@ApiOperation("根据电站获取所有监测点")
|
||||
@ApiImplicitParam(name = "substationId", value = "请求体", required = true)
|
||||
public HttpResult<LineDevGetBandDTO> substationGetLine(@RequestParam("substationId")String substationId) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("substationGetLine");
|
||||
LineDevGetBandDTO result = commTerminalService.substationGetLine(substationId);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据母线id获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@PostMapping("busBarGetLine")
|
||||
@ApiOperation("根据母线id获取监测点信息")
|
||||
@ApiImplicitParam(name = "busBarId", value = "请求体", required = true)
|
||||
public HttpResult<LineDevGetBandDTO> busBarGetLine(@RequestParam("busBarId")String busBarId) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("busBarGetLine");
|
||||
LineDevGetBandDTO result = commTerminalService.busBarGetLine(busBarId);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.njcn.device.pms.controller.ledgerManger;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/4/26 10:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/commTerminal")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(tags = "通用台账-所有子孙部门以及监测点")
|
||||
public class DeptMonitorController extends BaseController {
|
||||
|
||||
private final IMonitorService monitorService;
|
||||
|
||||
/**
|
||||
* 通过部门获取所有子集部门所拥有的监测点
|
||||
*
|
||||
* @author wr
|
||||
* @date 2023/4/26
|
||||
*/
|
||||
@PostMapping("/deptGetLineIds")
|
||||
@ApiImplicitParam(name = "param", value = "请求参数", required = true)
|
||||
public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam param) {
|
||||
String methodDescribe = getMethodDescribe("deptGetLineList");
|
||||
List<DeptGetChildrenDTO> monitor = monitorService.deptMonitor(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,4 +75,7 @@ public interface DistributionMonitorMapper extends BaseMapper<DistributionMonito
|
||||
List<PmsSimpleDTO> getOnlineRate(@Param("list") List<String> terminalIds);
|
||||
|
||||
List<PmsSimpleDTO> getIntegrity(@Param("list") List<String> terminalIds);
|
||||
|
||||
|
||||
List<PmsMonitorBaseDTO> getDisMonitorAllList(@Param("subId") String subId,@Param("type") Integer type);
|
||||
}
|
||||
|
||||
@@ -48,4 +48,10 @@ public interface PmsGeneratrixWireMapper extends BaseMapper<GeneratrixWire> {
|
||||
*/
|
||||
List<GeneratrixAndPowerStationSonDTO> getGeneratrixByCondition(@Param("orgList")List<String> data, @Param("param") ConditionParam param);
|
||||
|
||||
/**
|
||||
* 根据单位分组线路
|
||||
* @author cdf
|
||||
* @date 2023/5/11
|
||||
*/
|
||||
List<GeneratrixWire> getGeneratrixWireList();
|
||||
}
|
||||
|
||||
@@ -5,54 +5,62 @@
|
||||
|
||||
<select id="getIdByOrgId" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO">
|
||||
SELECT
|
||||
t.Operation_Id operationId,t.Power_Station_Id powerrId,t.Line_Id lineId,t.id monitorId,b.Terminal_Id terminalId
|
||||
t.Operation_Id operationId,t.Power_Station_Id powerrId,t.Line_Id lineId,t.id monitorId,b.Terminal_Id terminalId
|
||||
FROM
|
||||
(
|
||||
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_client WHERE org_id IN
|
||||
(
|
||||
(
|
||||
SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM
|
||||
pms_power_client WHERE org_id IN
|
||||
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 ) UNION ALL
|
||||
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_generation_user WHERE org_id IN
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 )
|
||||
UNION ALL
|
||||
(
|
||||
SELECT id, Operation_Id, Power_Station_Id, Line_Id
|
||||
FROM pms_power_generation_user WHERE org_id IN
|
||||
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 ) UNION ALL
|
||||
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_distributionarea WHERE org_id IN
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 )
|
||||
UNION ALL
|
||||
( SELECT id, Operation_Id, Power_Station_Id, Line_Id
|
||||
FROM pms_power_distributionarea WHERE org_id IN
|
||||
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 ) UNION ALL
|
||||
( SELECT id, Operation_Id, Powerr_Id, Line_Id FROM pms_monitor WHERE org_id IN
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 )
|
||||
UNION ALL
|
||||
( SELECT id, Operation_Id, Powerr_Id, Line_Id FROM pms_monitor WHERE org_id IN
|
||||
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 )
|
||||
) t
|
||||
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
|
||||
AND Is_Up_To_Grid = 1 AND STATUS = 1 )
|
||||
) t
|
||||
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDoubleUserByDept" resultType="DoubleUserVO">
|
||||
(
|
||||
select yong.name,yong.id,0 as type from pms_power_client yong
|
||||
inner join pms_distribution_monitor dis on yong.id = dis.Monitor_Id and dis.If_Power_User = 0
|
||||
where yong.org_id = #{orgId}
|
||||
and dis.status = 1
|
||||
select yong.name,yong.id,0 as type from pms_power_client yong
|
||||
inner join pms_distribution_monitor dis on yong.id = dis.Monitor_Id and dis.If_Power_User = 0
|
||||
where yong.org_id = #{orgId}
|
||||
and dis.status = 1
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
select fa.name,fa.id,1 as type from pms_power_generation_user fa
|
||||
inner join pms_distribution_monitor dis on fa.id = dis.Monitor_Id and dis.If_Power_User = 1
|
||||
where fa.org_id = #{orgId}
|
||||
and dis.status = 1
|
||||
select fa.name,fa.id,1 as type from pms_power_generation_user fa
|
||||
inner join pms_distribution_monitor dis on fa.id = dis.Monitor_Id and dis.If_Power_User = 1
|
||||
where fa.org_id = #{orgId}
|
||||
and dis.status = 1
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getMonitorByOrg" resultType="Monitor">
|
||||
select a.* from pms_monitor a
|
||||
inner join pms_distribution_monitor b on a.id = b.Monitor_Id
|
||||
and b.Monitor_Sort = #{taiZhangParam.lineType}
|
||||
inner join pms_distribution_monitor b on a.id = b.Monitor_Id
|
||||
and b.Monitor_Sort = #{taiZhangParam.lineType}
|
||||
where a.org_id in
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
@@ -74,22 +82,22 @@
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="taiZhangParam.searchValue!='' and taiZhangParam.searchValue !=null">
|
||||
and a.name like concat('%',#{taiZhangParam.searchValue},'%')
|
||||
</if>
|
||||
<if test="taiZhangParam.monitorState!='' and taiZhangParam.monitorState !=null">
|
||||
and b.monitor_state = #{taiZhangParam.monitorState}
|
||||
</if>
|
||||
<if test="taiZhangParam.searchValue!='' and taiZhangParam.searchValue !=null">
|
||||
and a.name like concat('%',#{taiZhangParam.searchValue},'%')
|
||||
</if>
|
||||
<if test="taiZhangParam.monitorState!='' and taiZhangParam.monitorState !=null">
|
||||
and b.monitor_state = #{taiZhangParam.monitorState}
|
||||
</if>
|
||||
and a.status = 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getThreeMonitorByOrgIdYong" resultType="PmsPowerTreeMonitorVO">
|
||||
|
||||
select yong.*,0 as type
|
||||
from pms_power_client yong
|
||||
inner join pms_distribution_monitor dis on yong.id = dis.Monitor_Id and dis.If_Power_User = 0
|
||||
where yong.org_id in
|
||||
select yong.*,0 as type
|
||||
from pms_power_client yong
|
||||
inner join pms_distribution_monitor dis on yong.id = dis.Monitor_Id and dis.If_Power_User = 0
|
||||
where yong.org_id in
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
@@ -99,7 +107,7 @@
|
||||
<if test="taiZhangParam.monitorState!='' and taiZhangParam.monitorState !=null">
|
||||
and dis.Monitor_State = #{taiZhangParam.monitorState}
|
||||
</if>
|
||||
and dis.status = 1
|
||||
and dis.status = 1
|
||||
</select>
|
||||
|
||||
|
||||
@@ -122,59 +130,59 @@
|
||||
and dis.status = 1
|
||||
</select>
|
||||
<select id="distributionMonitorListByCondition" resultType="com.njcn.device.pms.pojo.po.DistributionMonitor">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
pms_distribution_monitor a
|
||||
WHERE
|
||||
1 = 1
|
||||
and a.Monitor_State in (select id from sys_dict_data sdd where sdd.code='Run' )
|
||||
<if test="monitorSort!='' and monitorSort !=null">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
pms_distribution_monitor a
|
||||
WHERE
|
||||
1 = 1
|
||||
and a.Monitor_State in (select id from sys_dict_data sdd where sdd.code='Run' )
|
||||
<if test="monitorSort!='' and monitorSort !=null">
|
||||
|
||||
AND a.Monitor_Sort = #{monitorSort}
|
||||
</if>
|
||||
AND EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_monitor b
|
||||
WHERE
|
||||
b.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
AND a.Monitor_Sort = #{monitorSort}
|
||||
</if>
|
||||
AND EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_monitor b
|
||||
WHERE
|
||||
b.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_client c
|
||||
WHERE
|
||||
c.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_client c
|
||||
WHERE
|
||||
c.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_distributionarea d
|
||||
WHERE
|
||||
d.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_distributionarea d
|
||||
WHERE
|
||||
d.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_generation_user e
|
||||
WHERE
|
||||
e.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
UNION
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
pms_power_generation_user e
|
||||
WHERE
|
||||
e.Org_Id IN
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
) temp
|
||||
@@ -237,5 +245,41 @@ AND EXISTS (
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDisMonitorAllList" resultType="com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO">
|
||||
SELECT
|
||||
t.org_id orgId,t.id monitorId,b.Terminal_Id terminalId,t.Voltage_Level voltageLevel,t.powerrId,t.Line_Id
|
||||
FROM
|
||||
(
|
||||
(
|
||||
SELECT id, org_id, 3 as lineType,Power_Station_Id as powerrId,Line_Id,Voltage_Level
|
||||
FROM pms_power_client
|
||||
where STATUS = 1 )
|
||||
UNION ALL
|
||||
(
|
||||
SELECT id, org_id, 3 as lineType,Power_Station_Id as powerrId,Line_Id,Voltage_Level
|
||||
FROM pms_power_generation_user
|
||||
WHERE
|
||||
STATUS = 1 )
|
||||
UNION ALL
|
||||
( SELECT id, org_id, 2 as lineType,Power_Station_Id as powerrId,Line_Id,Voltage_Level
|
||||
FROM pms_power_distributionarea
|
||||
WHERE STATUS = 1 )
|
||||
UNION ALL
|
||||
( SELECT id, org_id, 1 as lineType,Powerr_Id as powerrId,Line_Id,Voltage_Level
|
||||
FROM pms_monitor
|
||||
WHERE STATUS = 1 )
|
||||
) t
|
||||
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
|
||||
<where>
|
||||
<if test="type == 1">
|
||||
powerrId = #{subId}
|
||||
</if>
|
||||
<if test="type == 2">
|
||||
Line_Id = #{subId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -118,6 +118,13 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getGeneratrixWireList" resultType="GeneratrixWire">
|
||||
select pms_generatrix_wire.*,pms_statation_stat.Org_Id
|
||||
from pms_generatrix_wire pms_generatrix_wire
|
||||
inner join pms_statation_stat pms_statation_stat
|
||||
on pms_generatrix_wire.Station_Id = pms_statation_stat.Power_Id
|
||||
where pms_generatrix_wire.status = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.device.pms.service.ledgerManger;
|
||||
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
|
||||
public interface CommTerminalService {
|
||||
|
||||
|
||||
/**
|
||||
*通过部门获取所有子集部门所拥有的监测点
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetChildrenDTO> deptGetLineList(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
/**
|
||||
* 根据单位获取所有子单位信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetBase> getDeptChildrenByParent(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
/**
|
||||
* 根据单位获取单位监测点
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
/**
|
||||
* 根据单位获取所有变电站
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有变电站
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetBusBarDTO> deptBusBar(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有装置
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
/**
|
||||
* 根据单位获取所有装置
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
LineDevGetBandDTO substationGetLine(String substationId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据母线获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
LineDevGetBandDTO busBarGetLine(String busBarId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,437 @@
|
||||
package com.njcn.device.pms.service.ledgerManger.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
|
||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||
import com.njcn.device.pms.pojo.po.GeneratrixWire;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pms.pojo.po.PmsTerminal;
|
||||
import com.njcn.device.pms.pojo.po.StatationStat;
|
||||
import com.njcn.device.pms.service.DeptLineService;
|
||||
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
|
||||
private final String commTerminal = "commTerminal#";
|
||||
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final MonitorMapper monitorMapper;
|
||||
|
||||
private final StatationStatMapper statationStatMapper;
|
||||
|
||||
private final PmsGeneratrixWireMapper pmsGeneratrixWireMapper;
|
||||
|
||||
private final TerminalMapper terminalMapper;
|
||||
|
||||
private final DistributionMonitorMapper distributionMonitorMapper;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 基础获取单位信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Override
|
||||
public List<DeptGetBase> getDeptChildrenByParent(DeptGetLineParam deptGetLineParam) {
|
||||
/*List<DeptGetBase> redisResult = (List<DeptGetBase>) redisUtil.getObjectByKey(commTerminal + deptGetLineParam.getDeptId());
|
||||
if (CollectionUtil.isNotEmpty(redisResult)) {
|
||||
return redisResult;
|
||||
}*/
|
||||
List<DeptGetBase> result = new ArrayList<>();
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
deptDTOList.forEach(it -> {
|
||||
DeptGetBase deptGetBase = new DeptGetBase();
|
||||
deptGetBase.setUnitId(it.getCode());
|
||||
deptGetBase.setUnitName(it.getName());
|
||||
List<String> deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
deptChildren.add(it.getId());
|
||||
deptGetBase.setUnitChildrenList(deptChildren);
|
||||
result.add(deptGetBase);
|
||||
});
|
||||
//redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(),result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
//电压等级
|
||||
List<DictData> voltageDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> mapVoltage = voltageDic.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//监测点状态
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(),DicDataEnum.RUN.getName()).getData();
|
||||
List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().eq(Monitor::getStatus,1).eq(Monitor::getMonitorState,dictData.getId()));
|
||||
Map<String, List<Monitor>> map = monitorList.stream().collect(Collectors.groupingBy(Monitor::getOrgId));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(null,0);
|
||||
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||
|
||||
temDept.forEach(item -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
deptGetChildrenMoreDTO.setUnitName(item.getUnitName());
|
||||
deptGetChildrenMoreDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
List<LineDevGetDTO> lineListPw = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(it->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(it.getId());
|
||||
lineDevGetDTO.setInterval(it.getStatisticalInterval());
|
||||
lineDevGetDTO.setDevId(it.getTerminalId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setVoltageLevel(mapVoltage.get(it.getVoltageLevel()).getValue());
|
||||
lineList.add(lineDevGetDTO);
|
||||
});
|
||||
}
|
||||
if (mapPms.containsKey(i)) {
|
||||
mapPms.get(i).forEach(it->{
|
||||
LineDevGetDTO lineDevGetDTOPms = new LineDevGetDTO();
|
||||
lineDevGetDTOPms.setPointId(it.getMonitorId());
|
||||
lineDevGetDTOPms.setInterval(10);
|
||||
lineDevGetDTOPms.setDevId(it.getTerminalId());
|
||||
lineDevGetDTOPms.setType(1);
|
||||
lineDevGetDTOPms.setVoltageLevel(mapVoltage.get(it.getVoltageLevel()).getValue());
|
||||
lineListPw.add(lineDevGetDTOPms);
|
||||
});
|
||||
}
|
||||
});
|
||||
deptGetChildrenMoreDTO.setLineBaseList(lineList);
|
||||
deptGetChildrenMoreDTO.setPwMonitorIds(lineListPw);
|
||||
}
|
||||
result.add(deptGetChildrenMoreDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetSubStationDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().eq(StatationStat::getStatus,1));
|
||||
Map<String, List<StatationStat>> map = statationStatList.stream().collect(Collectors.groupingBy(StatationStat::getOrgId));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(null,0);
|
||||
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||
|
||||
|
||||
temDept.forEach(item -> {
|
||||
DeptGetSubStationDTO deptGetSubStationDTO = new DeptGetSubStationDTO();
|
||||
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
||||
deptGetSubStationDTO.setUnitName(item.getUnitName());
|
||||
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<String> lineList = new ArrayList<>();
|
||||
List<String> lineListPw = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineList.addAll(map.get(i).stream().map(StatationStat::getPowerId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
if (mapPms.containsKey(i)) {
|
||||
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getPowerrId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
deptGetSubStationDTO.setStationIds(lineList.stream().distinct().collect(Collectors.toList()));
|
||||
deptGetSubStationDTO.setPwStationIds(lineListPw.stream().distinct().collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
result.add(deptGetSubStationDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetBusBarDTO> deptBusBar(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetBusBarDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
|
||||
List<GeneratrixWire> generatrixWireList = pmsGeneratrixWireMapper.getGeneratrixWireList();
|
||||
Map<String, List<GeneratrixWire>> map = generatrixWireList.stream().collect(Collectors.groupingBy(GeneratrixWire::getOrgId));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(null,0);
|
||||
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||
|
||||
|
||||
temDept.forEach(item -> {
|
||||
DeptGetBusBarDTO deptGetBusBarDTO = new DeptGetBusBarDTO();
|
||||
deptGetBusBarDTO.setUnitId(item.getUnitId());
|
||||
deptGetBusBarDTO.setUnitName(item.getUnitName());
|
||||
deptGetBusBarDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<String> lineList = new ArrayList<>();
|
||||
List<String> lineListPw = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineList.addAll(map.get(i).stream().map(GeneratrixWire::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if (mapPms.containsKey(i)) {
|
||||
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getLineId).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
deptGetBusBarDTO.setBusBarIds(lineList);
|
||||
deptGetBusBarDTO.setPwBusBarIds(lineListPw);
|
||||
}
|
||||
result.add(deptGetBusBarDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetDeviceDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
|
||||
List<PmsTerminal> pmsTerminalList = terminalMapper.selectList(new LambdaQueryWrapper<PmsTerminal>().eq(PmsTerminal::getStatus,1));
|
||||
Map<String, List<PmsTerminal>> map = pmsTerminalList.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(null,0);
|
||||
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||
|
||||
|
||||
temDept.forEach(item -> {
|
||||
DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO();
|
||||
deptGetDeviceDTO.setUnitId(item.getUnitId());
|
||||
deptGetDeviceDTO.setUnitName(item.getUnitName());
|
||||
deptGetDeviceDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<LineDevGetDTO> devGetDTOList = new ArrayList<>();
|
||||
List<LineDevGetDTO> devGetDTOListPw = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(dev->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setDevId(dev.getId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setUpdateTime(dev.getUpdateTime());
|
||||
devGetDTOList.add(lineDevGetDTO);
|
||||
});
|
||||
}
|
||||
|
||||
if (mapPms.containsKey(i)) {
|
||||
mapPms.get(i).forEach(dev->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setDevId(dev.getTerminalId());
|
||||
lineDevGetDTO.setType(1);
|
||||
|
||||
devGetDTOListPw.add(lineDevGetDTO);
|
||||
});
|
||||
}
|
||||
});
|
||||
deptGetDeviceDTO.setDeviceList(devGetDTOList);
|
||||
deptGetDeviceDTO.setPwDeviceList(devGetDTOListPw);
|
||||
}
|
||||
result.add(deptGetDeviceDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LineDevGetBandDTO substationGetLine(String substationId) {
|
||||
LineDevGetBandDTO result = new LineDevGetBandDTO();
|
||||
|
||||
//电压等级
|
||||
List<DictData> voltageDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> mapVoltage = voltageDic.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().eq(Monitor::getStatus,1).eq(Monitor::getPowerrId,substationId));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(substationId,1);
|
||||
|
||||
|
||||
if(CollectionUtil.isNotEmpty(monitorList)){
|
||||
List<LineDevGetDTO> temZw = new ArrayList<>();
|
||||
monitorList.forEach(item->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(item.getId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setDevId(item.getTerminalId());
|
||||
lineDevGetDTO.setVoltageLevel(mapVoltage.get(item.getVoltageLevel()).getValue());
|
||||
temZw.add(lineDevGetDTO);
|
||||
});
|
||||
result.setZwList(temZw);
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(pmsMonitorBaseDTOList)){
|
||||
List<LineDevGetDTO> temPw = new ArrayList<>();
|
||||
pmsMonitorBaseDTOList.forEach(item->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(item.getMonitorId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setDevId(item.getTerminalId());
|
||||
lineDevGetDTO.setVoltageLevel(mapVoltage.get(item.getVoltageLevel()).getValue());
|
||||
temPw.add(lineDevGetDTO);
|
||||
});
|
||||
result.setPwList(temPw);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LineDevGetBandDTO busBarGetLine(String busBarId) {
|
||||
LineDevGetBandDTO result = new LineDevGetBandDTO();
|
||||
//电压等级
|
||||
List<DictData> voltageDic = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> mapVoltage = voltageDic.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList =distributionMonitorMapper.getDisMonitorAllList(busBarId,1);
|
||||
|
||||
List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().eq(Monitor::getStatus,1).eq(Monitor::getLineId,busBarId));
|
||||
if(CollectionUtil.isNotEmpty(monitorList)){
|
||||
List<LineDevGetDTO> temZw = new ArrayList<>();
|
||||
|
||||
monitorList.forEach(item->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(item.getId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setDevId(item.getTerminalId());
|
||||
lineDevGetDTO.setVoltageLevel(mapVoltage.get(item.getVoltageLevel()).getValue());
|
||||
temZw.add(lineDevGetDTO);
|
||||
});
|
||||
result.setZwList(temZw);
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(pmsMonitorBaseDTOList)){
|
||||
List<LineDevGetDTO> temPw = new ArrayList<>();
|
||||
pmsMonitorBaseDTOList.forEach(item->{
|
||||
LineDevGetDTO lineDevGetDTO = new LineDevGetDTO();
|
||||
lineDevGetDTO.setPointId(item.getMonitorId());
|
||||
lineDevGetDTO.setType(1);
|
||||
lineDevGetDTO.setDevId(item.getTerminalId());
|
||||
lineDevGetDTO.setVoltageLevel(mapVoltage.get(item.getVoltageLevel()).getValue());
|
||||
temPw.add(lineDevGetDTO);
|
||||
});
|
||||
result.setPwList(temPw);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Override
|
||||
public List<DeptGetChildrenDTO> deptGetLineList(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetChildrenDTO> all = new ArrayList<>();
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
getAllChildren(deptGetLineParam.getDeptId(), deptDTOList, all);
|
||||
Map<String, List<String>> map = deptLineService.getLineByDeptRelation(filterDataType(deptGetLineParam.getServerName()));
|
||||
all.forEach(item -> {
|
||||
List<String> itemDeptChildren = item.getDeptChildren();
|
||||
if (CollectionUtil.isNotEmpty(itemDeptChildren)) {
|
||||
List<String> lineIds = new ArrayList<>();
|
||||
itemDeptChildren.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineIds.addAll(map.get(i));
|
||||
}
|
||||
});
|
||||
item.setLineIds(lineIds);
|
||||
}
|
||||
});
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
* 筛选数据类型
|
||||
*/
|
||||
private Integer filterDataType(String serverName) {
|
||||
ServerEnum serverEnum = EnumUtils.getServerEnumByName(serverName);
|
||||
switch (serverEnum) {
|
||||
case EVENT:
|
||||
return 0;
|
||||
case HARMONIC:
|
||||
return 1;
|
||||
default:
|
||||
throw new BusinessException(CommonResponseEnum.INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定部门所有子孙部门id
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
private void getAllChildren(String deptId, List<DeptDTO> deptAllList, List<DeptGetChildrenDTO> res) {
|
||||
deptAllList.stream().filter(item -> item.getPid().equals(deptId)).forEach(it -> {
|
||||
List<String> deptChildren = deptAllList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList());
|
||||
deptChildren.add(it.getId());
|
||||
DeptGetChildrenDTO generalDeviceDTO = new DeptGetChildrenDTO();
|
||||
generalDeviceDTO.setDeptId(it.getId());
|
||||
generalDeviceDTO.setDeptName(it.getName());
|
||||
generalDeviceDTO.setDeptChildren(deptChildren);
|
||||
res.add(generalDeviceDTO);
|
||||
getAllChildren(it.getId(), deptAllList, res);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -158,6 +158,8 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
.or()
|
||||
.like(Monitor::getId, baseParam.getSearchValue())
|
||||
.or()
|
||||
.like(Monitor::getPowerrName, baseParam.getSearchValue())
|
||||
.or()
|
||||
.like(Monitor::getOrgName, baseParam.getSearchValue()))
|
||||
.eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(Monitor::getCreateTime);
|
||||
@@ -239,6 +241,16 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
specialMonitor.setType(1);
|
||||
specialMonitorMapper.updateById(specialMonitor);
|
||||
|
||||
//修改主网监测点如何配网表中也存在需要同时修改
|
||||
DistributionMonitor distributionMonitor = iDistributionMonitorService.getById(monitor.getId());
|
||||
if(Objects.nonNull(distributionMonitor)){
|
||||
distributionMonitor.setTerminalId(monitor.getTerminalId());
|
||||
distributionMonitor.setTerminalWiringMethod(monitor.getTerminalWiringMethod());
|
||||
distributionMonitor.setVoltageLevel(monitor.getVoltageLevel());
|
||||
distributionMonitor.setMonitorState(monitor.getMonitorState());
|
||||
iDistributionMonitorService.updateById(distributionMonitor);
|
||||
}
|
||||
|
||||
//主网测点限值计算
|
||||
DictData dictData = dicDataFeignClient.getDicDataById(monitor.getVoltageLevel()).getData();
|
||||
float standShort = COverlimit.getStandShortCap(dictData.getValue());
|
||||
|
||||
Reference in New Issue
Block a user