1.单位变电站公共方法
This commit is contained in:
@@ -127,8 +127,21 @@ public class CommTerminalController extends BaseController {
|
||||
List<DeptGetSubStationDTO> result = commTerminalService.deptSubStation(deptGetLineParam);
|
||||
log.info("运行时长" + timer.intervalSecond());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
} /**
|
||||
* 根据单位获取所有变电站详细信息
|
||||
* @param deptGetLineParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deptGetSubStationInfo")
|
||||
@ApiOperation("根据单位获取所有变电站详细信息")
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<DeptGetSubStationDTO.Info>> deptGetSubStationInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
String methodDescribe = getMethodDescribe("deptGetSubStationInfo");
|
||||
List<DeptGetSubStationDTO.Info> result = commTerminalService.deptSubStationInfo(deptGetLineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据单位获取所有变电站
|
||||
* @author cdf
|
||||
|
||||
@@ -74,6 +74,7 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
|
||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||
|
||||
List<TerminalGetBase.Extend> orgSubStationInfoGet(@Param("list")List<Integer> devType);
|
||||
|
||||
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("runFlag")List<Integer> runFlag,@Param("dataType")List<Integer> dataType);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,29 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="orgSubStationInfoGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase$Extend">
|
||||
select
|
||||
DISTINCT
|
||||
pq_dept_line.id unitId,
|
||||
substation.id ledgerId,
|
||||
substation.name subName,
|
||||
sub.Scale voltageLevel,
|
||||
point.id lineId
|
||||
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
|
||||
inner join pq_substation sub on sub.id = 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>
|
||||
<select id="getLineIdByDeptIds" resultType="string">
|
||||
select
|
||||
DISTINCT
|
||||
|
||||
@@ -82,8 +82,5 @@ public interface CommTerminalService {
|
||||
Map<String,String> getCustomDetailByLineId(String id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam);
|
||||
}
|
||||
|
||||
@@ -105,6 +105,8 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devType);
|
||||
|
||||
|
||||
List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType);
|
||||
|
||||
/**
|
||||
* 根据监测点id集合查询部门信息id
|
||||
* @param ids 部门ids
|
||||
|
||||
@@ -207,6 +207,49 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
return lineMapper.getCustomDetailByLineId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetSubStationDTO.Info> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()));
|
||||
Map<String, List<TerminalGetBase.Extend>> orgSub = anExtends.stream().collect(Collectors.groupingBy(TerminalGetBase::getUnitId));
|
||||
|
||||
temDept.forEach(item -> {
|
||||
DeptGetSubStationDTO.Info deptGetSubStationDTO = new DeptGetSubStationDTO.Info();
|
||||
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
||||
deptGetSubStationDTO.setUnitName(item.getUnitName());
|
||||
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||
deptGetSubStationDTO.setDeptLevel(item.getDeptLevel());
|
||||
List<String> deptIds = item.getUnitChildrenList();
|
||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||
List<SubGetBase> subList = new ArrayList<>();
|
||||
SubGetBase subGetBase;
|
||||
for (String deptId : deptIds) {
|
||||
if (orgSub.containsKey(deptId)) {
|
||||
//获取部门下变电信息
|
||||
List<TerminalGetBase.Extend> sub = orgSub.get(deptId);
|
||||
Map<String, List<TerminalGetBase.Extend>> subMap = sub.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getLedgerId()+"_"+x.getSubName()+"_"+x.getVoltageLevel()));
|
||||
for (Map.Entry<String, List<TerminalGetBase.Extend>> stringListEntry : subMap.entrySet()) {
|
||||
String[] split = stringListEntry.getKey().split("_");
|
||||
subGetBase=new SubGetBase();
|
||||
subGetBase.setId(split[0]);
|
||||
subGetBase.setName(split[1]);
|
||||
subGetBase.setVoltageLevel(split[2]);
|
||||
List<String> monitorIds = stringListEntry.getValue().stream().map(TerminalGetBase.Extend::getLineId).distinct().collect(Collectors.toList());
|
||||
subGetBase.setUnitChildrenList(monitorIds);
|
||||
subList.add(subGetBase);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
deptGetSubStationDTO.setStationIds(subList);
|
||||
}
|
||||
result.add(deptGetSubStationDTO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private List<Integer> filterDataTypeNew(String serverName) {
|
||||
List<Integer> devType = new ArrayList<>();
|
||||
|
||||
@@ -119,6 +119,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
return deptLines.stream ().collect (Collectors.groupingBy (TerminalGetBase::getUnitId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalGetBase.Extend> orgSubStationInfoGet(List<Integer> devType) {
|
||||
return deptLineMapper.orgSubStationInfoGet(devType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeptLine getLineByLineIds(String ids) {
|
||||
return this.getOne(new LambdaQueryWrapper<DeptLine>()
|
||||
|
||||
Reference in New Issue
Block a user