二级评估接口开发
This commit is contained in:
@@ -573,4 +573,7 @@ public class LineController extends BaseController {
|
||||
List<PollutionSubstationDTO> list = lineService.getPowerStationByMonitorIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.pojo.vo.LedgerSelectVO;
|
||||
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -53,9 +54,29 @@ public class SubstationController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("获取变电站列表")
|
||||
@GetMapping("getSubstationSelect")
|
||||
HttpResult<List<Line>> getSubstationSelect(){
|
||||
HttpResult<List<LedgerSelectVO>> getSubstationSelect(){
|
||||
String methodDescribe = getMethodDescribe("getSubstationSelect");
|
||||
List<Line> substationDTOList = substationService.getSubstationSelect();
|
||||
List<LedgerSelectVO> substationDTOList = substationService.getSubstationSelect();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("获取变电站下面监测点")
|
||||
@GetMapping("getMonitorSelect")
|
||||
HttpResult<List<Line>> getMonitorSelect(@RequestParam("stationId")String stationId){
|
||||
String methodDescribe = getMethodDescribe("getMonitorSelect");
|
||||
List<Line> substationDTOList = substationService.getMonitorSelect(stationId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("获取变电站下面的母线列表")
|
||||
@GetMapping("getBusBarSelect")
|
||||
HttpResult<List<LedgerSelectVO>> getBusBarSelect(@RequestParam("stationId")String stationId){
|
||||
String methodDescribe = getMethodDescribe("getBusBarSelect");
|
||||
List<LedgerSelectVO> substationDTOList = substationService.getBusBarSelect(stationId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.vo.LedgerSelectVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,7 +24,11 @@ public interface ISubstationService extends IService<Substation> {
|
||||
*/
|
||||
List<SubstationDTO> getSubstationById(List<String> subId);
|
||||
|
||||
List<Line> getSubstationSelect();
|
||||
List<LedgerSelectVO> getSubstationSelect();
|
||||
|
||||
List<LedgerSelectVO> getBusBarSelect(String stationId);
|
||||
|
||||
List<Line> getMonitorSelect(String stationId);
|
||||
|
||||
List<LineDetail> getPowerByStationId(String stationId,Integer powerFlag);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -9,12 +10,19 @@ import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.mapper.VoltageMapper;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.po.Voltage;
|
||||
import com.njcn.device.pq.pojo.vo.LedgerSelectVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -35,17 +43,68 @@ public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substat
|
||||
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
|
||||
private final VoltageMapper voltageMapper;
|
||||
|
||||
private final SubstationMapper substationMapper;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public List<SubstationDTO> getSubstationById(List<String> subId) {
|
||||
return this.baseMapper.getSubstationById(subId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getSubstationSelect() {
|
||||
public List<LedgerSelectVO> getSubstationSelect() {
|
||||
List<LedgerSelectVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Line::getLevel, LineBaseEnum.SUB_LEVEL.getCode())
|
||||
.eq(Line::getState, DataStateEnum.ENABLE.getCode()).orderByAsc(Line::getCreateTime);
|
||||
return lineMapper.selectList(lambdaQueryWrapper);
|
||||
List<Line> stationList = lineMapper.selectList(lambdaQueryWrapper);
|
||||
List<String> ids = stationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
List<Substation> substationList = substationMapper.selectBatchIds(ids);
|
||||
Map<String,Substation> stationMap = substationList.stream().collect(Collectors.toMap(Substation::getId,Function.identity()));
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
stationList.forEach(item->{
|
||||
LedgerSelectVO ledgerSelectVO = new LedgerSelectVO();
|
||||
BeanUtil.copyProperties(item,ledgerSelectVO);
|
||||
ledgerSelectVO.setVoltageLevel(stationMap.get(item.getId()).getScale());
|
||||
ledgerSelectVO.setVoltageName(dictDataMap.get(ledgerSelectVO.getVoltageLevel()).getName());
|
||||
result.add(ledgerSelectVO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LedgerSelectVO> getBusBarSelect(String stationId) {
|
||||
List<LedgerSelectVO> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(Line::getPids,stationId).eq(Line::getLevel,LineBaseEnum.SUB_V_LEVEL);
|
||||
List<Line> busBarList = lineMapper.selectList(lambdaQueryWrapper);
|
||||
List<String> ids = busBarList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
List<Voltage> voltageList = voltageMapper.selectBatchIds(ids);
|
||||
Map<String,Voltage> voltageMap = voltageList.stream().collect(Collectors.toMap(Voltage::getId,Function.identity()));
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
busBarList.forEach(item->{
|
||||
LedgerSelectVO ledgerSelectVO = new LedgerSelectVO();
|
||||
BeanUtil.copyProperties(item,ledgerSelectVO);
|
||||
ledgerSelectVO.setVoltageLevel(voltageMap.get(item.getId()).getScale());
|
||||
ledgerSelectVO.setVoltageName(dictDataMap.get(ledgerSelectVO.getVoltageLevel()).getName());
|
||||
result.add(ledgerSelectVO);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getMonitorSelect(String stationId) {
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(Line::getPids,stationId).eq(Line::getLevel,LineBaseEnum.LINE_LEVEL);
|
||||
List<Line> lineList = lineMapper.selectList(lambdaQueryWrapper);
|
||||
return lineList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user