package cn.gistack.nky.service.impl;
|
|
import cn.gistack.nky.entity.AlarmGet;
|
import cn.gistack.nky.mapper.AlarmGetMapper;
|
import cn.gistack.nky.requestpojo.AlarmGetPo;
|
import cn.gistack.nky.requestpojo.BatchDataPo;
|
import cn.gistack.nky.resultpojo.DataResChildrenPo;
|
import cn.gistack.nky.resultpojo.DataResPo;
|
import cn.gistack.nky.service.IAlarmGetService;
|
import cn.gistack.nky.service.INkyService;
|
import cn.gistack.nky.service.IZtApiService;
|
import cn.gistack.nky.vo.AlarmGetVO;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import lombok.AllArgsConstructor;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@AllArgsConstructor
|
@Service
|
public class AlarmGetServiceImpl extends ServiceImpl<AlarmGetMapper, AlarmGet> implements IAlarmGetService {
|
|
private final INkyService nkyService;
|
private final IZtApiService ztApiService;
|
|
@Override
|
public void batchData(String type) {
|
|
List<DataResPo> cdList = getResCdList(type);
|
cdList.forEach(dataResPo -> {
|
if (dataResPo.getChildren() != null && dataResPo.getChildren().size()>0){
|
BatchDataPo batchDataPo = new BatchDataPo(dataResPo, type);
|
nkyService.batchData(batchDataPo);
|
}
|
});
|
|
}
|
|
@Override
|
public void alarmGetData(String type) {
|
List<DataResChildrenPo> cdList = getCdList(type);
|
|
cdList.forEach(dataResChildrenPo -> {
|
AlarmGetPo alarmGetPo = new AlarmGetPo(dataResChildrenPo,type);
|
|
nkyService.alarmGetData(alarmGetPo);
|
|
});
|
|
}
|
|
@Override
|
public List<AlarmGetVO> getAlarmDetail(AlarmGetVO alarmGet) {
|
return baseMapper.getAlarmDetail(alarmGet);
|
}
|
|
@Override
|
public IPage<AlarmGetVO> getAlarmDetailPage(IPage<AlarmGetVO> page, AlarmGetVO alarmGet) {
|
return page.setRecords(baseMapper.getAlarmDetailPage(page,alarmGet));
|
}
|
|
@Override
|
public AlarmGetVO getAlarmVO(AlarmGetVO alarmGet) {
|
return baseMapper.getAlarmVo(alarmGet);
|
}
|
|
/**
|
* 获取水库集
|
*
|
* @param type
|
* @return
|
*/
|
public List<DataResPo> getResCdList(String type) {
|
List<DataResPo> cdList = new ArrayList<>();
|
if (type.equals("1")) {
|
//获取渗压测点
|
cdList = ztApiService.getResSy();
|
} else if (type.equals("2")) {
|
//获取渗流测点
|
cdList=ztApiService.getResSl();
|
} else if (type.equals("3") || type.equals("4") || type.equals("5")) {
|
//获取位移测点
|
cdList = ztApiService.getResWy();
|
} else {
|
return null;
|
}
|
return cdList;
|
}
|
|
public List<DataResChildrenPo> getCdList(String type){
|
List<DataResChildrenPo> cdList = new ArrayList<>();
|
if (type.equals("1")){
|
//获取渗压测点
|
cdList = ztApiService.getSy();
|
}else if (type.equals("2")){
|
//获取渗流测点
|
return null;
|
}else if (type.equals("3") || type.equals("4") || type.equals("5")){
|
//获取位移测点
|
cdList = ztApiService.getWy();
|
}else {
|
return null;
|
}
|
return cdList;
|
}
|
}
|