增加监测点信息批量查询
This commit is contained in:
@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -40,4 +42,14 @@ public class CommLineController extends BaseController {
|
||||
LineDTO result = lineService.getLineDetail(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getLineDetailBatch")
|
||||
@ApiOperation("批量获取监测点信息")
|
||||
public HttpResult<List<LineDTO>> getLineDetailBatch(@RequestParam("ids") List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getLineDetailBatch");
|
||||
List<LineDTO> result = lineService.getLineDetailBatch(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,5 +525,11 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
*/
|
||||
LineDTO selectLineDetail(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* @Description: 根据监测点id批量获取监测点信息
|
||||
*/
|
||||
List<LineDTO> selectLineDetailBatch(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(@Param("lineId")String lineId);
|
||||
}
|
||||
|
||||
@@ -1365,6 +1365,33 @@
|
||||
AND line.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectLineDetailBatch" resultType="com.njcn.device.biz.pojo.dto.LineDTO">
|
||||
SELECT
|
||||
line.id AS lineId,
|
||||
dev.id AS devId,
|
||||
detail.Time_Interval AS timeInterval,
|
||||
vg.Scale AS voltageLevel,
|
||||
pqd.Run_Flag as runFlag,
|
||||
detail.PT_Type AS ptType,
|
||||
detail.PT_Phase_Type AS ptPhaseType
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
pq_line vo,
|
||||
pq_voltage vg,
|
||||
pq_line dev,
|
||||
pq_device pqd
|
||||
WHERE
|
||||
line.id = detail.id
|
||||
AND vo.id = line.pid
|
||||
AND dev.id = vo.pid
|
||||
AND vo.id = vg.id
|
||||
AND pqd.id = dev.id
|
||||
AND line.id in
|
||||
<foreach collection="ids" open="(" close=")" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getCustomDetailByLineId" resultType="map">
|
||||
SELECT
|
||||
|
||||
@@ -191,4 +191,9 @@ public interface LineService {
|
||||
* @Date: 2023/9/22 10:46
|
||||
*/
|
||||
LineDTO getLineDetail(String id);
|
||||
|
||||
/**
|
||||
* 根据监测点批量获取监测点信息
|
||||
*/
|
||||
List<LineDTO> getLineDetailBatch(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -476,14 +476,45 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
public LineDTO getLineDetail(String id) {
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
List<DictData> connect = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String, String> connectMap = connect.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
LineDTO lineDTO = this.baseMapper.selectLineDetail(id);
|
||||
if(dicMap.containsKey(lineDTO.getVoltageLevel())){
|
||||
if(dicMap.containsKey(lineDTO.getVoltageLevel())&&connectMap.containsKey(lineDTO.getPtType())){
|
||||
lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel()));
|
||||
lineDTO.setPtType(connectMap.get(lineDTO.getPtType()));
|
||||
return lineDTO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据监测点id获取监测点信息
|
||||
*/
|
||||
@Override
|
||||
public List<LineDTO> getLineDetailBatch(List<String> ids) {
|
||||
if(CollectionUtil.isEmpty(ids)){
|
||||
return null;
|
||||
}
|
||||
List<LineDTO> lineDTOS = this.baseMapper.selectLineDetailBatch(ids);
|
||||
//电压等级
|
||||
Map<String, List<LineDTO>> lineVoltageMap = lineDTOS.stream().collect(Collectors.groupingBy(LineDTO::getVoltageLevel));
|
||||
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, String> voltageMap = voltageList.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
lineVoltageMap.forEach((key,lineData) -> {
|
||||
String voltage= voltageMap.get(key);
|
||||
lineData = lineData.stream().peek(line -> line.setVoltageLevel(voltage)).collect(Collectors.toList());
|
||||
});
|
||||
//接线方式
|
||||
Map<String, List<LineDTO>> linePtTypeMap = lineDTOS.stream().collect(Collectors.groupingBy(LineDTO::getPtType));
|
||||
List<DictData> connect = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
|
||||
Map<String, String> connectMap = connect.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
|
||||
linePtTypeMap.forEach((key,lineData)->{
|
||||
String ptType= connectMap.get(key);
|
||||
lineData = lineData.stream().peek(line -> line.setPtType(ptType)).collect(Collectors.toList());
|
||||
});
|
||||
return lineDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
|
||||
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());
|
||||
|
||||
Reference in New Issue
Block a user