台账算法支持
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Data
|
||||
public class DeptGetBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unitName;
|
||||
|
||||
private List<String> unitChildrenList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 母线
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeptGetBusBarDTO extends DeptGetBase {
|
||||
|
||||
@ApiModelProperty(name = "busBarIds",value = "母线/线路信息")
|
||||
private List<String> busBarIds;
|
||||
|
||||
@ApiModelProperty(name = "pwBusBarIds",value = "配网母线/线路信息")
|
||||
private List<String> pwBusBarIds;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeptGetChildrenMoreDTO extends DeptGetBase {
|
||||
|
||||
@ApiModelProperty(name = "lineBaseList",value = "监测点信息")
|
||||
private List<LineDevGetDTO> lineBaseList;
|
||||
|
||||
@ApiModelProperty(name = "pwMonitorIds",value = "配网监测点信息")
|
||||
private List<LineDevGetDTO> pwMonitorIds;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 母线
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeptGetDeviceDTO extends DeptGetBase {
|
||||
|
||||
@ApiModelProperty(name = "deviceList",value = "装置信息")
|
||||
private List<LineDevGetDTO> deviceList;
|
||||
|
||||
@ApiModelProperty(name = "pwDeviceList",value = "配网装置信息")
|
||||
private List<LineDevGetDTO> pwDeviceList;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeptGetSubStationDTO extends DeptGetBase {
|
||||
|
||||
@ApiModelProperty(name = "stationIds",value = "电站信息")
|
||||
private List<String> stationIds;
|
||||
|
||||
@ApiModelProperty(name = "pwStationIds",value = "配网电站信息")
|
||||
private List<String> pwStationIds;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/11
|
||||
*/
|
||||
@Data
|
||||
public class LineDevGetBandDTO {
|
||||
|
||||
private List<LineDevGetDTO> zwList;
|
||||
|
||||
private List<LineDevGetDTO> pwList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Data
|
||||
public class LineDevGetDTO {
|
||||
/**
|
||||
* 部门索引
|
||||
*/
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 监测点索引
|
||||
*/
|
||||
private String pointId;
|
||||
|
||||
/**
|
||||
* 监测点电压等级
|
||||
*/
|
||||
private String voltageLevel;
|
||||
|
||||
/**
|
||||
* 监测点统计间隔
|
||||
*/
|
||||
private Integer interval;
|
||||
|
||||
/**
|
||||
* 装置索引
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 装置通讯状态
|
||||
*/
|
||||
private Integer comFlag;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@Data
|
||||
public class TerminalGetBase {
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 台账(监测点,母线,装置,电站,供电公司)id
|
||||
*/
|
||||
private String ledgerId;
|
||||
}
|
||||
@@ -19,13 +19,14 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--pq-device-boot和pms-device-boot只能选择一个-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-boot</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pms-device-boot</artifactId>
|
||||
<version>${project.version}</version>
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -1,34 +1,23 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
@@ -43,9 +32,7 @@ import java.util.stream.Stream;
|
||||
@Api(tags = "通用台账-所有子孙部门以及监测点")
|
||||
public class CommTerminalController extends BaseController {
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DeptLineService deptLineService;
|
||||
private final CommTerminalService commTerminalService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,65 +42,133 @@ public class CommTerminalController extends BaseController {
|
||||
* @date 2023/4/24
|
||||
*/
|
||||
@PostMapping("deptGetLineIds")
|
||||
@ApiOperation("通过部门获取所有子集部门所拥有的监测点")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("deptGetLineList");
|
||||
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);
|
||||
}
|
||||
});
|
||||
List<DeptGetChildrenDTO> result = commTerminalService.deptGetLineList(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, all, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定部门所有子孙部门id
|
||||
*
|
||||
* 根据单位获取所有子单位信息
|
||||
* @author cdf
|
||||
* @date 2023/4/24
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
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);
|
||||
});
|
||||
@PostMapping("getDeptChildrenByParent")
|
||||
@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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@PostMapping("substationGetLine")
|
||||
@ApiOperation("根据电站获取所有监测点")
|
||||
@ApiImplicitParam(name = "substationId", value = "请求体", required = true)
|
||||
public HttpResult<List<LineDevGetDTO>> substationGetLine(@RequestParam("substationId")String substationId) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("substationGetLine");
|
||||
List<LineDevGetDTO> 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<List<LineDevGetDTO>> busBarGetLine(@RequestParam("busBarId")String busBarId) {
|
||||
TimeInterval timer = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("busBarGetLine");
|
||||
List<LineDevGetDTO> result = commTerminalService.busBarGetLine(busBarId);
|
||||
log.info("运行时长" + timer.intervalRestart());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -67,4 +68,9 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
"\t\tAND pq_line.Id = pq_dept_line.Line_Id and (pq_device.Dev_Data_Type= 2 or pq_device.Dev_Data_Type = #{devDataType})\n" +
|
||||
"\t)")
|
||||
List<DeptLine> getLineByDeptRelation(@Param("devDataType")Integer devDataType);
|
||||
|
||||
|
||||
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type);
|
||||
|
||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
@@ -419,4 +420,12 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
|
||||
Page<LineFlowMealDetailVO> getNewDeviceRunStatistics (Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
||||
Page<LineFlowMealDetailVO> getNewDeviceFlowStatistics (Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
||||
|
||||
|
||||
/**
|
||||
* 通过电站id获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<LineDevGetDTO> getLineBySubStation(@Param("subId")String subId);
|
||||
}
|
||||
|
||||
@@ -17,4 +17,70 @@
|
||||
<select id="getMyselfBindLine" resultType="String">
|
||||
select line_id from pq_dept_line where Id =#{deptId}
|
||||
</select>
|
||||
|
||||
<select id="lineDevGet" resultType="com.njcn.device.biz.pojo.dto.LineDevGetDTO">
|
||||
select
|
||||
<!--监测点-->
|
||||
<if test="type == 1">
|
||||
pq_dept_line.id unitId,
|
||||
point.id pointId,
|
||||
lineDetail.Time_Interval as `interval`,
|
||||
dic.value voltageLevel,
|
||||
dev.id devId,
|
||||
device.com_flag comFlag
|
||||
</if>
|
||||
<!--母线-->
|
||||
<if test="type == 2">
|
||||
DISTINCT
|
||||
pq_dept_line.id unitId,
|
||||
dic.value voltageLevel,
|
||||
voltage.id pointId
|
||||
|
||||
</if>
|
||||
<!--装置-->
|
||||
<if test="type == 3">
|
||||
DISTINCT
|
||||
pq_dept_line.id unitId,
|
||||
dev.id devId,
|
||||
dic.value voltageLevel,
|
||||
1 as type ,
|
||||
device.update_time
|
||||
</if>
|
||||
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_voltage pq_voltage on voltage.id = pq_voltage.id
|
||||
inner join sys_dict_data dic on pq_voltage.Scale= dic.id
|
||||
inner join pq_line dev on voltage.pid = dev.id
|
||||
inner join pq_device device on dev.id = device.id
|
||||
where device.Dev_Model = 1
|
||||
and point.state = 1
|
||||
and device.Dev_Data_Type in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="orgSubStationGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase">
|
||||
select
|
||||
DISTINCT
|
||||
pq_dept_line.id unitId,
|
||||
substation.id ledgerId
|
||||
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
|
||||
where device.Dev_Model = 1
|
||||
and point.state = 1
|
||||
and device.Dev_Data_Type in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1065,4 +1065,28 @@
|
||||
and a.state = 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getLineBySubStation" resultType="com.njcn.device.biz.pojo.dto.LineDevGetDTO">
|
||||
SELECT
|
||||
pq_line.id pointId,
|
||||
lineDetail.Time_Interval `interval`,
|
||||
dev.id devId,
|
||||
device.com_flag
|
||||
FROM
|
||||
pq_line pq_line
|
||||
INNER JOIN pq_line_detail lineDetail ON pq_line.id = lineDetail.id
|
||||
INNER JOIN pq_line busBar ON pq_line.pid = busBar.id
|
||||
INNER JOIN pq_line dev ON busBar.pid = dev.id
|
||||
INNER JOIN pq_device device ON dev.id = device.id
|
||||
WHERE
|
||||
(pq_line.LEVEL = 6
|
||||
AND pq_line.state = 1
|
||||
AND device.Dev_Model = 1
|
||||
AND device.Run_Flag = 0
|
||||
)
|
||||
and FIND_IN_SET(#{subId}, pq_line.pids );
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
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
|
||||
*/
|
||||
List<LineDevGetDTO> substationGetLine(String substationId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据母线获取监测点信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
List<LineDevGetDTO> busBarGetLine(String busBarId);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
|
||||
@@ -64,4 +65,23 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取根据单位分组的监测点集合信息
|
||||
* param devType 装置类型 0暂态 1稳态 2 双类型
|
||||
* param type 装置类型 1监测点 2母线 3 装置
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
Map<String, List<LineDevGetDTO>> lineDevGet(List<Integer> devType,Integer type);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取根据单位分组的变电站集合信息
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
Map<String, List<String>> orgSubStationGet(List<Integer> devType);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
package com.njcn.device.pq.service.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.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
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.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 RedisUtil redisUtil;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 基础获取单位信息
|
||||
* @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.getId());
|
||||
deptGetBase.setUnitName(it.getName());
|
||||
List<String> deptChildren = deptDTOList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).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);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),1);
|
||||
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<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineList.addAll(map.get(i));
|
||||
}
|
||||
});
|
||||
deptGetChildrenMoreDTO.setLineBaseList(lineList);
|
||||
}
|
||||
result.add(deptGetChildrenMoreDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetSubStationDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<String>> map = deptLineService.orgSubStationGet(filterDataTypeNew(deptGetLineParam.getServerName()));
|
||||
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<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineList.addAll(map.get(i));
|
||||
}
|
||||
});
|
||||
deptGetSubStationDTO.setStationIds(lineList);
|
||||
}
|
||||
result.add(deptGetSubStationDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetBusBarDTO> deptBusBar(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetBusBarDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),2);
|
||||
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<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
lineList.addAll(map.get(i).stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
deptGetBusBarDTO.setBusBarIds(lineList);
|
||||
}
|
||||
result.add(deptGetBusBarDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetDeviceDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),3);
|
||||
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<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
devGetDTOList.addAll(map.get(i));
|
||||
}
|
||||
});
|
||||
deptGetDeviceDTO.setDeviceList(devGetDTOList);
|
||||
}
|
||||
result.add(deptGetDeviceDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineDevGetDTO> substationGetLine(String substationId) {
|
||||
return lineMapper.getLineBySubStation(substationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineDevGetDTO> busBarGetLine(String busBarId) {
|
||||
return lineMapper.getLineBySubStation(busBarId);
|
||||
}
|
||||
|
||||
|
||||
private void getChildrenByParent(List<DeptDTO> deptAllList, List<DeptGetChildrenMoreDTO> res) {
|
||||
deptAllList.forEach(it -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(it.getId());
|
||||
deptGetChildrenMoreDTO.setUnitName(it.getName());
|
||||
List<String> deptChildren = deptAllList.stream().filter(deptDTO -> deptDTO.getPids().contains(it.getId())).map(DeptDTO::getId).collect(Collectors.toList());
|
||||
deptChildren.add(it.getId());
|
||||
deptGetChildrenMoreDTO.setUnitChildrenList(deptChildren);
|
||||
res.add(deptGetChildrenMoreDTO);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private List<Integer> filterDataTypeNew(String serverName) {
|
||||
List<Integer> devType = new ArrayList<>();
|
||||
devType.add(2);
|
||||
ServerEnum serverEnum = EnumUtils.getServerEnumByName(serverName);
|
||||
switch (serverEnum) {
|
||||
case EVENT:
|
||||
devType.add(0);
|
||||
break;
|
||||
case HARMONIC:
|
||||
devType.add(1);
|
||||
break;
|
||||
default:
|
||||
devType.add(0);
|
||||
devType.add(1);
|
||||
break;
|
||||
}
|
||||
return devType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @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);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
|
||||
import com.njcn.device.pq.mapper.DeptLineMapper;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
@@ -11,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -85,5 +86,18 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
return deptLines.stream ( ).collect (Collectors.groupingBy (DeptLine::getId, Collectors.mapping (DeptLine::getLineId,Collectors.toList ())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<LineDevGetDTO>> lineDevGet(List<Integer> devDataType,Integer type) {
|
||||
List<LineDevGetDTO> deptLines = deptLineMapper.lineDevGet(devDataType,type);
|
||||
return deptLines.stream ().collect (Collectors.groupingBy (LineDevGetDTO::getUnitId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> orgSubStationGet(List<Integer> devDataType) {
|
||||
List<TerminalGetBase> deptLines = deptLineMapper.orgSubStationGet(devDataType);
|
||||
return deptLines.stream ().collect (Collectors.groupingBy (TerminalGetBase::getUnitId, Collectors.mapping (TerminalGetBase::getLedgerId,Collectors.toList ())));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user