1.根据专责要求调整冀北台账树

This commit is contained in:
wr
2025-11-04 17:10:46 +08:00
parent 5e93eb3691
commit 20ec9bc0b4
7 changed files with 106 additions and 25 deletions

View File

@@ -124,11 +124,11 @@ public class LineParam {
private String objId; private String objId;
@ApiModelProperty(name = "bigObjType",value = "对象大类") @ApiModelProperty(name = "bigObjType",value = "对象大类")
@NotBlank(message = "对象大类不可为空") // @NotBlank(message = "对象大类不可为空")
private String bigObjType; private String bigObjType;
@ApiModelProperty(name = "smallObjType",value = "对象小类") @ApiModelProperty(name = "smallObjType",value = "对象小类")
@NotBlank(message = "对象小类不可为空") // @NotBlank(message = "对象小类不可为空")
private String smallObjType; private String smallObjType;
/** /**

View File

@@ -54,7 +54,7 @@ public class TerminalTreeController extends BaseController {
String methodDescribe = getMethodDescribe("getTerminalTree"); String methodDescribe = getMethodDescribe("getTerminalTree");
List<TerminalTree> tree; List<TerminalTree> tree;
if(isJb){ if(isJb){
tree= terminalTreeService.getJbTerminalTree(); tree= terminalTreeService.getJbNewTerminalTree();
}else{ }else{
tree= terminalTreeService.getTerminalTree(); tree= terminalTreeService.getTerminalTree();
} }

View File

@@ -116,7 +116,6 @@
left join pq_substation sub on sub.id = substation.id left join pq_substation sub on sub.id = substation.id
where device.Dev_Model = 1 where device.Dev_Model = 1
and point.state = 1 and point.state = 1
and device.Run_Flag = 0
and device.Dev_Data_Type in and device.Dev_Data_Type in
<foreach collection="list" item="item" open="(" close=")" separator=","> <foreach collection="list" item="item" open="(" close=")" separator=",">
#{item} #{item}
@@ -125,7 +124,7 @@
and lineDetail.Power_Flag = #{powerFlag} and lineDetail.Power_Flag = #{powerFlag}
</if> </if>
<if test="lineRunFlag!=null "> <if test="lineRunFlag!=null ">
and lineDetail.Run_Flag = #{lineRunFlag} and device.Run_Flag = 0 and lineDetail.Run_Flag = #{lineRunFlag}
</if> </if>
</select> </select>
<select id="getLineIdByDeptIds" resultType="string"> <select id="getLineIdByDeptIds" resultType="string">

View File

@@ -121,9 +121,9 @@
</if> </if>
<if test="searchValue != '' and searchValue != null "> <if test="searchValue != '' and searchValue != null ">
<bind name="searchValueLike" value="'%'+searchValue+'%'"/> <bind name="searchValueLike" value="'%'+searchValue+'%'"/>
AND sub.NAME LIKE #{searchValueLike} AND (sub.NAME LIKE #{searchValueLike}
OR dev.name LIKE #{searchValueLike} OR dev.name LIKE #{searchValueLike}
OR line.NAME LIKE #{searchValueLike} OR line.NAME LIKE #{searchValueLike})
</if> </if>
ORDER BY ORDER BY
gdName, gdName,

View File

@@ -66,8 +66,9 @@
</select> </select>
<select id="getAllList" resultType="TerminalTree"> <select id="getAllList" resultType="TerminalTree">
select id, pid, name, level, sort select a.id, a.pid, a.name, a.level, a.sort ,b.Power_Flag
from pq_line from pq_line a
left join pq_line_detail b on a.id = b.id
where state = 1 where state = 1
</select> </select>
@@ -1797,12 +1798,13 @@
</select> </select>
<select id="selectByName" resultType="com.njcn.device.pq.pojo.po.LineDetail"> <select id="selectByName" resultType="com.njcn.device.pq.pojo.po.LineDetail">
select select
t2.* t2.*,
t1.name monitorName
from from
pq_line t1 , pq_line t1 ,
pq_line_detail t2 pq_line_detail t2
<where> <where>
t1.id = t2.id and t2.Run_Flag=0 t1.id = t2.id
<if test="param.lineIds!=null and param.lineIds.size()!=0"> <if test="param.lineIds!=null and param.lineIds.size()!=0">
AND t1.id in AND t1.id in
<foreach collection="param.lineIds" open="(" close=")" item="item" separator=","> <foreach collection="param.lineIds" open="(" close=")" item="item" separator=",">

View File

@@ -49,4 +49,7 @@ public interface TerminalTreeService {
* @return * @return
*/ */
List<TerminalTree> getJbTerminalTree(); List<TerminalTree> getJbTerminalTree();
List<TerminalTree> getJbNewTerminalTree();
} }

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -25,7 +26,6 @@ import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO; import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.system.api.AreaFeignClient; import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.enums.StatisticsEnum; import com.njcn.system.pojo.enums.StatisticsEnum;
import com.njcn.system.pojo.po.Area; import com.njcn.system.pojo.po.Area;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
@@ -138,7 +138,12 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){ private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
List<TerminalTree> list = new ArrayList<>(); List<TerminalTree> list = new ArrayList<>();
//电网侧
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){
list.addAll(devTree);
}
//非电网侧
if(CollUtil.isNotEmpty(userReportPOList)) { if(CollUtil.isNotEmpty(userReportPOList)) {
Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity())); Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
@@ -160,6 +165,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
busCopy.setName(it.getName()); busCopy.setName(it.getName());
busCopy.setId(it.getId()); busCopy.setId(it.getId());
busCopy.setPid(it.getPid()); busCopy.setPid(it.getPid());
busCopy.setSort(it.getSort());
busCopy.setChildren(getChildren(it, lineList)); busCopy.setChildren(getChildren(it, lineList));
busCopy.setPowerFlag(1); busCopy.setPowerFlag(1);
busCopy.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode()); busCopy.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
@@ -175,6 +181,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
devCopy.setName(it.getName()); devCopy.setName(it.getName());
devCopy.setId(it.getId()); devCopy.setId(it.getId());
devCopy.setPid(it.getPid()); devCopy.setPid(it.getPid());
devCopy.setSort(it.getSort());
devCopy.setChildren(getChildren(it, temBus)); devCopy.setChildren(getChildren(it, temBus));
devCopy.setPowerFlag(1); devCopy.setPowerFlag(1);
devCopy.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode()); devCopy.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode());
@@ -192,18 +199,11 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
terminalTree.setPowerFlag(1); terminalTree.setPowerFlag(1);
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode()); terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
terminalTree.setChildren(temDevList); terminalTree.setChildren(temDevList);
terminalTree.setSort(0);
list.add(terminalTree); list.add(terminalTree);
}); });
} }
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){
list.addAll(devTree);
}
return list; return list;
} }
@@ -521,6 +521,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(collect.get(0).getId()); sub.setId(collect.get(0).getId());
sub.setName(collect.get(0).getName()); sub.setName(collect.get(0).getName());
sub.setPid(collect.get(0).getPid()); sub.setPid(collect.get(0).getPid());
sub.setSort(0);
sub.setChildren(valueList); sub.setChildren(valueList);
TerminalTree powerTree=new TerminalTree(); TerminalTree powerTree=new TerminalTree();
@@ -551,7 +552,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(child.getId()); sub.setId(child.getId());
sub.setName(child.getName()); sub.setName(child.getName());
sub.setPid(child.getPid()); sub.setPid(child.getPid());
sub.setSort(0);
TerminalTree powerTree=new TerminalTree(); TerminalTree powerTree=new TerminalTree();
powerTree.setName("电网侧"); powerTree.setName("电网侧");
powerTree.setId(child.getId()); powerTree.setId(child.getId());
@@ -581,7 +582,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(child.getId()); sub.setId(child.getId());
sub.setName(child.getName()); sub.setName(child.getName());
sub.setPid(child.getPid()); sub.setPid(child.getPid());
sub.setSort(0);
TerminalTree powerTree = new TerminalTree(); TerminalTree powerTree = new TerminalTree();
powerTree.setName("电网侧"); powerTree.setName("电网侧");
powerTree.setId(child.getId()); powerTree.setId(child.getId());
@@ -620,7 +621,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
sub.setId(notSub.getId()); sub.setId(notSub.getId());
sub.setName(notSub.getName()); sub.setName(notSub.getName());
sub.setPid(notSub.getPid()); sub.setPid(notSub.getPid());
sub.setSort(0);
TerminalTree powerTree = new TerminalTree(); TerminalTree powerTree = new TerminalTree();
powerTree.setId(notSub.getId()); powerTree.setId(notSub.getId());
powerTree.setName("电网侧"); powerTree.setName("电网侧");
@@ -655,6 +656,49 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
return taiZhang; return taiZhang;
} }
@Override
public List<TerminalTree> getJbNewTerminalTree() {
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());
List<TerminalTree> provinceList = lineMapper.getProvinceList(null, 0);
List<TerminalTree> gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> linepowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() != 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> lineNotPowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() == 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
subvList.forEach(subv ->{
if(CollUtil.isEmpty(subv.getChildren())){
subv.setChildren(getRecursionChildren(subv, linepowerList));
}
}
);
subvList.forEach(subv -> {
if(CollUtil.isEmpty(subv.getChildren())){
subv.setChildren(getRecursionChildren(subv, lineNotPowerList));
}
}
);
subvList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
devList.forEach(dev -> dev.setChildren(getRecursionChildren(dev, subvList)));
devList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
subList.forEach(sub -> sub.setChildren(getRecursionChildrenCs(sub, devList)));
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
projectList.forEach(project -> project.setChildren(getChildren(project, provinceList)));
return projectList;
}
/** /**
* 获取全部子节点 * 获取全部子节点
@@ -663,7 +707,40 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
* @date 2021/7/19 * @date 2021/7/19
*/ */
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) { public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()); List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(collect)){
long sortSize = collect.stream().filter(x->ObjUtil.isNotNull(x.getSort())).filter(x -> x.getSort() == 0).count();
if(collect.size()-sortSize/collect.size()>50){
collect.sort(Comparator.comparing(x->x.getName()));
}
}
return collect;
}
public List<TerminalTree> getRecursionChildrenCs(TerminalTree item, List<TerminalTree> all){
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> list=new ArrayList<>();
TerminalTree power=new TerminalTree();
power.setName("电网侧");
power.setSort(0);
power.setChildren(collect.stream().filter(x -> 1 != x.getPowerFlag()).collect(Collectors.toList()));
list.add(power);
TerminalTree notPower=new TerminalTree();
notPower.setName("非电网侧");
notPower.setSort(1);
notPower.setChildren(collect.stream().filter(x -> 1 == x.getPowerFlag()).collect(Collectors.toList()));
list.add(notPower);
return list;
}
public List<TerminalTree> getRecursionChildren(TerminalTree item, List<TerminalTree> all){
List<TerminalTree> list = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(list)){
item.setPowerFlag(list.get(0).getPowerFlag());
}
return list;
} }
/** /**