1.冀北台账树逻辑调整
2.冀北业务中台管理
This commit is contained in:
@@ -57,7 +57,7 @@ mybatis-plus:
|
||||
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||
|
||||
#是否是冀北设备台账树
|
||||
isJb: true
|
||||
isJb: false
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-08-07
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("pq_ywzt_substation")
|
||||
public class YwZtSubstation{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 变电站序号
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 数据类型zf01:变电站 zf05:电厂
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 所属地市
|
||||
*/
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 运维单位
|
||||
*/
|
||||
private String operationName;
|
||||
|
||||
/**
|
||||
* 电站名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 电压等级Id,字典表
|
||||
*/
|
||||
private String scale;
|
||||
|
||||
/**
|
||||
* 电压等级名称
|
||||
*/
|
||||
private String scaleName;
|
||||
|
||||
/**
|
||||
* 维护班组
|
||||
*/
|
||||
private String maintenanceName;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
*/
|
||||
private String runStatus;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String deviceCoding;
|
||||
|
||||
/**
|
||||
* 投运日期
|
||||
*/
|
||||
private LocalDateTime runTime;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private BigDecimal lng;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private BigDecimal lat;
|
||||
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -191,7 +191,8 @@ public class TerminalBaseController extends BaseController {
|
||||
@DeleteMapping("delTerminal")
|
||||
public HttpResult<Object> delTerminal(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delTerminal");
|
||||
terminalBaseService.delTerminal(id);
|
||||
System.out.println(id);
|
||||
// terminalBaseService.delTerminal(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
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.pq.pojo.po.YwZtSubstation;
|
||||
import com.njcn.device.pq.service.IYwZtSubstationService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/06/23 11:36
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/ywZt")
|
||||
@Api(tags = "业务中台数据管理")
|
||||
@AllArgsConstructor
|
||||
public class YwZtSubstationController extends BaseController {
|
||||
|
||||
private final IYwZtSubstationService ywZtSubstationService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/addYwZtSubstation")
|
||||
@ApiOperation("业务中台变电站表同步")
|
||||
public HttpResult<Boolean> syncYwZtSubstation(){
|
||||
String methodDescribe = getMethodDescribe("syncYwZtSubstation");
|
||||
Boolean b = ywZtSubstationService.syncYwZtSubstation();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getYwZtSubstation")
|
||||
@ApiOperation("获取业务中台变电站")
|
||||
public HttpResult<List<YwZtSubstation>> getYwZtSubstation(@RequestParam(required =false )String orgId){
|
||||
String methodDescribe = getMethodDescribe("getYwZtSubstation");
|
||||
List<YwZtSubstation> ywZtSubstation = ywZtSubstationService.getYwZtSubstation(orgId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, ywZtSubstation, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -35,4 +35,7 @@ public interface SubstationMapper extends BaseMapper<Substation> {
|
||||
|
||||
|
||||
List<Substation> test();
|
||||
|
||||
//仅供测试冀北电网台账使用
|
||||
List<SubstationDTO> subTest();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.YwZtSubstation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-08-07
|
||||
*/
|
||||
public interface YwZtSubstationMapper extends BaseMapper<YwZtSubstation> {
|
||||
|
||||
}
|
||||
@@ -57,4 +57,48 @@
|
||||
line.Id = sub.Id
|
||||
|
||||
</select>
|
||||
<select id="subTest" resultType="com.njcn.device.pq.pojo.dto.SubstationDTO">
|
||||
SELECT DISTINCT
|
||||
pid as id,
|
||||
powerSubstationName as name ,
|
||||
( SELECT id FROM sys_dict_data WHERE NAME = CONCAT( SUBSTRING_INDEX( powerSubstationName, 'kV', 1 ), "kV" ) ) as scale
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
substation.pid AS pid,
|
||||
substation.id AS substationId,
|
||||
substation.NAME AS substationName,
|
||||
device.id AS deviceId,
|
||||
device.NAME AS deviceName,
|
||||
voltage.id AS voltageId,
|
||||
voltage.NAME AS voltageName,
|
||||
line.id AS lineId,
|
||||
line.NAME AS lineName,
|
||||
lineDetail.Power_Substation_Name AS powerSubstationName,
|
||||
( SELECT id FROM pq_line WHERE `Name` = lineDetail.Power_Substation_Name ) AS Power_Substation_id
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line voltage,
|
||||
pq_line device,
|
||||
pq_line substation,
|
||||
pq_line gd,
|
||||
pq_line area,
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail,
|
||||
pq_voltage vg
|
||||
WHERE
|
||||
line.pid = voltage.id
|
||||
AND voltage.pid = device.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.pid = gd.id
|
||||
AND gd.pid = area.id
|
||||
AND device.id = deviceDetail.id
|
||||
AND line.id = lineDetail.id
|
||||
AND vg.Id = voltage.id
|
||||
ORDER BY
|
||||
substation.`Name`
|
||||
) cc
|
||||
WHERE
|
||||
Power_Substation_id IS NULL;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.YwZtSubstationMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.po.YwZtSubstation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-08-07
|
||||
*/
|
||||
public interface IYwZtSubstationService extends IService<YwZtSubstation> {
|
||||
|
||||
|
||||
Boolean syncYwZtSubstation();
|
||||
|
||||
List<YwZtSubstation> getYwZtSubstation(String orgId);
|
||||
}
|
||||
@@ -284,6 +284,12 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
@Override
|
||||
public List<TerminalTree> getJbTerminalTree() {
|
||||
/**
|
||||
* 1.先根据监测点电网侧电站,查询是否存在变电站信息
|
||||
* 1.1 如果存在,则根据根据电网标识(Power_Flag),来进行判断是电网侧还是非电网侧
|
||||
* 1.2 不存在,则根据监测点的线路号,进行判断是电网侧还是非电网侧并以当前监测点所对应的变电站为主层级
|
||||
* 2.变电站下不存在监测点信息进行筛查出来,然后进行匹配添加
|
||||
*/
|
||||
List<TerminalTree> taiZhang = new ArrayList<>();
|
||||
List<TerminalTree> allList = lineMapper.getAllList();
|
||||
List<TerminalTree> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
@@ -324,67 +330,138 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
List<TerminalTree> subInfoList = new ArrayList<>();
|
||||
|
||||
lineObjNameMap.forEach((key, value)->{
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
//电网侧监测点
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
List<TerminalTree> powerFlag = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())).collect(Collectors.toList());
|
||||
List<TerminalTree> subChildren = getRecursionChildren(powerFlag, collect1);
|
||||
powerTree.setChildren(new ArrayList<>());
|
||||
|
||||
//非电网侧监测点
|
||||
TerminalTree notPowerTree=new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
List<TerminalTree> powerFlagNot = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())).collect(Collectors.toList());
|
||||
List<TerminalTree> notSubChildren = getRecursionChildren(powerFlagNot, collect1);
|
||||
notPowerTree.setChildren(new ArrayList<>());
|
||||
valueList.add(powerTree);
|
||||
valueList.add(notPowerTree);
|
||||
final List<TerminalTree> subVLine = collect1;
|
||||
//获取变电信息
|
||||
List<TerminalTree> collect = subList.stream().filter(x -> x.getName().equals(key)).collect(Collectors.toList());
|
||||
|
||||
//电网侧监测点
|
||||
List<TerminalTree> powerFlag = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())).collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(collect)){
|
||||
//解决变电站下没有监测点显示问题(变电站-》终端-》母线)
|
||||
powerFlag.addAll(collect);
|
||||
}
|
||||
List<TerminalTree> subChildren = getRecursionChildren(powerFlag, subVLine);
|
||||
|
||||
//非电网侧监测点
|
||||
List<TerminalTree> powerFlagNot = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())).collect(Collectors.toList());
|
||||
List<TerminalTree> notSubChildren = getRecursionChildren(powerFlagNot,subVLine);
|
||||
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
TerminalTree sub=new TerminalTree();
|
||||
sub.setId(collect.get(0).getId());
|
||||
sub.setName(collect.get(0).getName());
|
||||
sub.setPid(collect.get(0).getPid());
|
||||
sub.setChildren(valueList);
|
||||
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(collect.get(0).getId());
|
||||
powerTree.setChildren(subChildren);
|
||||
valueList.add(powerTree);
|
||||
|
||||
|
||||
TerminalTree notPowerTree=new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
notPowerTree.setChildren(notSubChildren);
|
||||
valueList.add(notPowerTree);
|
||||
subInfoList.add(sub);
|
||||
}else{
|
||||
//电网侧变电站能否找到
|
||||
for (TerminalTree child : subChildren) {
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
List<TerminalTree> exist = subInfoList.stream().filter(x -> x.getId().equals(child.getId())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(exist)){
|
||||
//电网侧
|
||||
exist.get(0).getChildren().get(0).getChildren().addAll(child.getChildren());
|
||||
List<TerminalTree> children =new ArrayList<>();
|
||||
children.addAll(exist.get(0).getChildren().get(0).getChildren());
|
||||
children.add(child);
|
||||
exist.get(0).getChildren().get(0).setChildren(children);
|
||||
}else{
|
||||
TerminalTree sub=new TerminalTree();
|
||||
sub.setId(child.getId());
|
||||
sub.setName(child.getName());
|
||||
sub.setPid(child.getPid());
|
||||
valueList.get(0).setChildren(Arrays.asList(child));
|
||||
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(child.getId());
|
||||
powerTree.setChildren(Arrays.asList(child));
|
||||
valueList.add(powerTree);
|
||||
|
||||
TerminalTree notPowerTree = new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
notPowerTree.setChildren(new ArrayList<>());
|
||||
valueList.add(notPowerTree);
|
||||
|
||||
sub.setChildren(valueList);
|
||||
subInfoList.add(sub);
|
||||
}
|
||||
}
|
||||
for (TerminalTree child : notSubChildren) {
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
List<TerminalTree> exist = subInfoList.stream().filter(x -> x.getId().equals(child.getId())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(exist)){
|
||||
if (CollUtil.isNotEmpty(exist)) {
|
||||
//非电网侧
|
||||
exist.get(1).getChildren().get(0).getChildren().addAll(child.getChildren());
|
||||
}else{
|
||||
TerminalTree sub=new TerminalTree();
|
||||
List<TerminalTree> children =new ArrayList<>();
|
||||
children.addAll(exist.get(0).getChildren().get(1).getChildren());
|
||||
children.add(child);
|
||||
exist.get(0).getChildren().get(1).setChildren(children);
|
||||
} else {
|
||||
TerminalTree sub = new TerminalTree();
|
||||
sub.setId(child.getId());
|
||||
sub.setName(child.getName());
|
||||
sub.setPid(child.getPid());
|
||||
valueList.get(1).setChildren(Arrays.asList(child));
|
||||
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(child.getId());
|
||||
powerTree.setChildren(new ArrayList<>());
|
||||
valueList.add(powerTree);
|
||||
|
||||
TerminalTree notPowerTree = new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
notPowerTree.setChildren(Arrays.asList(child));
|
||||
valueList.add(notPowerTree);
|
||||
|
||||
sub.setChildren(valueList);
|
||||
subInfoList.add(sub);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//todo 变电站层级处理不存在下面信息的监测点信息(默认信息就是给他当成电网侧)
|
||||
List<TerminalTree> dw = new ArrayList<>();
|
||||
dw.addAll(subInfoList.stream().collect(Collectors.toList()));
|
||||
dw.addAll(subInfoList.stream().flatMap(x -> x.getChildren().get(0).getChildren().stream()).collect(Collectors.toList()));
|
||||
dw.addAll(subInfoList.stream().flatMap(x -> x.getChildren().get(1).getChildren().stream()).collect(Collectors.toList()));
|
||||
List<TerminalTree> collect = subList.stream().filter(x -> !dw.stream().map(TerminalTree::getId).collect(Collectors.toList()).contains(x.getId()))
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
for (TerminalTree notSub : collect) {
|
||||
|
||||
TerminalTree notSub1 = findParents(collect1, notSub);
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
TerminalTree sub = new TerminalTree();
|
||||
sub.setId(notSub.getId());
|
||||
sub.setName(notSub.getName());
|
||||
sub.setPid(notSub.getPid());
|
||||
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setId(notSub.getId());
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setChildren(Arrays.asList(notSub1));
|
||||
valueList.add(powerTree);
|
||||
|
||||
TerminalTree notPowerTree = new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
notPowerTree.setChildren(new ArrayList<>());
|
||||
valueList.add(notPowerTree);
|
||||
|
||||
sub.setChildren(valueList);
|
||||
subInfoList.add(sub);
|
||||
}
|
||||
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subInfoList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
@@ -428,26 +505,19 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
findParentsRecursive(lineTree, all,aa);
|
||||
aa.add(lineTree);
|
||||
}
|
||||
List<TerminalTree> distinctList = aa.stream().distinct().collect(Collectors.toList());
|
||||
List<TerminalTree> distinctList =new ArrayList<>();
|
||||
distinctList.addAll(aa.stream().distinct().collect(Collectors.toList()));
|
||||
aa.addAll(all);
|
||||
List<TerminalTree> lines = aa.stream().distinct().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> collect = distinctList.stream().filter(x -> x.getLevel() == LineBaseEnum.SUB_LEVEL.getCode()).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
for (TerminalTree tree : collect) {
|
||||
info.add(findParents(distinctList,tree));
|
||||
info.add(findParents(lines,tree));
|
||||
}
|
||||
|
||||
}
|
||||
return info;
|
||||
}
|
||||
private TerminalTree findParents(List<TerminalTree> all,TerminalTree subTree) {
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(subTree.getId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
collect.forEach(treeMap -> {
|
||||
subTree.setChildren(collect);
|
||||
findParents( all,treeMap);
|
||||
});
|
||||
}
|
||||
return subTree;
|
||||
}
|
||||
|
||||
private static void findParentsRecursive(TerminalTree tree, List<TerminalTree> all,List<TerminalTree> newParents) {
|
||||
if (tree.getLevel() == LineBaseEnum.SUB_LEVEL.getCode()) {
|
||||
@@ -461,6 +531,18 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private TerminalTree findParents(List<TerminalTree> all,TerminalTree subTree) {
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(subTree.getId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
collect.forEach(treeMap -> {
|
||||
subTree.setChildren(collect);
|
||||
findParents( all,treeMap);
|
||||
});
|
||||
}
|
||||
return subTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未绑定监测点树
|
||||
*
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.mapper.YwZtSubstationMapper;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.po.YwZtSubstation;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import com.njcn.device.pq.service.IYwZtSubstationService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-08-07
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class YwZtSubstationServiceImpl extends ServiceImpl<YwZtSubstationMapper, YwZtSubstation> implements IYwZtSubstationService {
|
||||
|
||||
|
||||
private final SubstationMapper substationMapper;
|
||||
private final ISubstationService substationService;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean syncYwZtSubstation() {
|
||||
List<Substation> test = substationMapper.test();
|
||||
//数据库经纬度
|
||||
Map<String, Substation> collect1 = test.stream().collect(Collectors.toMap(Substation::getScale, Function.identity()));
|
||||
//中台变电站信息
|
||||
List<YwZtSubstation> ztSubs = this.list();
|
||||
|
||||
//匹配不到数据
|
||||
List<Substation> loseInfo=new ArrayList<>();
|
||||
//匹配成功数据
|
||||
List<Substation> info=new ArrayList<>();
|
||||
|
||||
collect1.forEach((key,value)->{
|
||||
key=key.substring(key.indexOf("V")+1);
|
||||
String dzmc = getDzmc(key);
|
||||
List<YwZtSubstation> ztNormalSubs = ztSubs.stream().filter(
|
||||
x -> dzmc.indexOf(getDzmc(x.getName())) != -1 || getDzmc(x.getName()).indexOf(dzmc) != -1
|
||||
).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(ztNormalSubs)) {
|
||||
if(ztNormalSubs.size()>1){
|
||||
List<YwZtSubstation> collect = ztNormalSubs.stream().filter(
|
||||
x -> dzmc.equals(getDzmc(x.getName()))
|
||||
).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
value.setLng(collect.get(0).getLng());
|
||||
value.setScale(null);
|
||||
value.setLat(collect.get(0).getLat());
|
||||
info.add(value);
|
||||
}
|
||||
}else{
|
||||
value.setLng(ztNormalSubs.get(0).getLng());
|
||||
value.setScale(null);
|
||||
value.setLat(ztNormalSubs.get(0).getLat());
|
||||
info.add(value);
|
||||
}
|
||||
}else{
|
||||
loseInfo.add(value);
|
||||
}
|
||||
});
|
||||
List<String> collect = loseInfo.stream().filter(x->x.getLat().doubleValue()==0.0).map(Substation::getScale).collect(Collectors.toList());
|
||||
System.out.println(collect);
|
||||
System.out.println(info);
|
||||
return substationService.updateBatchById(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YwZtSubstation> getYwZtSubstation(String orgId) {
|
||||
//获取变电站信息
|
||||
List<String> orgIds = new ArrayList<>();
|
||||
if(StrUtil.isNotBlank(orgId)){
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(orgId, WebUtil.filterDeptType()).getData();
|
||||
orgIds= deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
}
|
||||
return this.list(new LambdaQueryWrapper<YwZtSubstation>().in(CollUtil.isNotEmpty(orgIds),YwZtSubstation::getOrgId,orgIds));
|
||||
}
|
||||
|
||||
public String getDzmc(String dzmc) {
|
||||
if(StrUtil.isNotBlank(dzmc)) {
|
||||
dzmc = dzmc.replace("变电站", "")
|
||||
.replace("火电厂", "")
|
||||
.replace("供电所", "")
|
||||
.replace("风光储", "")
|
||||
.replace("风电场", "")
|
||||
.replace("光伏电站", "")
|
||||
.replace("光储电站", "")
|
||||
.replace("开关站", "")
|
||||
.replace("桥接站", "");
|
||||
}
|
||||
return dzmc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -156,6 +156,7 @@ public class QuitRunningDeviceServiceImpl extends ServiceImpl<QuitRunningDeviceM
|
||||
}
|
||||
Map<String, LineDetailVO.Detail> mapDetail = new HashMap<>();
|
||||
QueryWrapper<QuitRunningDeviceVO> quitRunningDeviceVOQueryWrapper = new QueryWrapper<>();
|
||||
quitRunningDeviceVOQueryWrapper.eq("supervision_quit_running_device.state", DataStateEnum.ENABLE.getCode());
|
||||
if (Objects.nonNull(quitRunningDeviceQueryParam)) {
|
||||
//判断监测点/设备的选择
|
||||
// if (Objects.nonNull(quitRunningDeviceQueryParam.getDeviceType()) && Objects.nonNull(quitRunningDeviceQueryParam.getDeviceId())) {
|
||||
|
||||
@@ -798,7 +798,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
userReportPO.setEvaluationDept(userExcel.getEvaluationDept());
|
||||
userReportPO.setEvaluationConclusion(userExcel.getEvaluationConclusion());
|
||||
userReportPO.setDataType(1);
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.APPROVE.getStatus());
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(userReportPO);
|
||||
//处理敏感用户的信息
|
||||
|
||||
@@ -72,7 +72,7 @@ public class InstanceUtil {
|
||||
List<String> delete = list.stream().filter(x -> "delete_info".equals(x)).collect(Collectors.toList());
|
||||
//如果为空则需要判断信息,先判断全部数据是否都是自己创建的,然后判断是否是都是带提交数据
|
||||
if (CollUtil.isEmpty(delete)) {
|
||||
long count = list.stream().filter(x -> !userId.equals(x)).count();
|
||||
long count = createBy.stream().filter(x -> !userId.equals(x)).count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException(SupervisionResponseEnum.NO_POWER);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user