监测设备状态
parent
1dbf74b9b9
commit
5834ec5739
|
|
@ -5,6 +5,7 @@ import com.gunshi.core.result.R;
|
|||
import com.gunshi.project.xyt.entity.so.HomeStStbprpBSo;
|
||||
import com.gunshi.project.xyt.entity.so.StStbprpBSo;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeStStbprpBVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StStatusListVo;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.service.StStbprpBService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
|
|
@ -92,4 +93,9 @@ public class StStbprpBController {
|
|||
}
|
||||
|
||||
|
||||
@Operation(summary = "监测设备状态")
|
||||
@PostMapping("/status/list")
|
||||
public R<StStatusListVo> statusList() {
|
||||
return R.ok(service.statusList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StStatusListVo {
|
||||
|
||||
|
||||
@Schema(description = "离线")
|
||||
private List<StStatusVo> offLine;
|
||||
|
||||
@Schema(description = "在线")
|
||||
private List<StStatusVo> online;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.gunshi.project.xyt.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StStatusVo {
|
||||
|
||||
@Schema(description = "最后数据时间")
|
||||
private String tm;
|
||||
|
||||
@Schema(description = "测站编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "测站名称")
|
||||
private String stnm;
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.xyt.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.entity.so.HomeStStbprpBSo;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeStStbprpBVo;
|
||||
import com.gunshi.project.xyt.entity.vo.StStatusVo;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -49,4 +50,22 @@ public interface StStbprpBMapper extends BaseMapper<StStbprpB> {
|
|||
""")
|
||||
List<HomeStStbprpBVo> flowStationDetailsList();
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT st.stcd,st.stnm,r.tm FROM st_stbprp_b st
|
||||
LEFT JOIN st_pptn_r_real r ON st.stcd = r.stcd
|
||||
WHERE st.stcd in (select distinct(stcd) from st_stbprp_b_elem where elem ='drp')
|
||||
</script>
|
||||
""")
|
||||
List<StStatusVo> realRainList();
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT st.stcd,st.stnm,r.tm FROM st_stbprp_b st
|
||||
LEFT JOIN st_rsvr_r_real r ON st.stcd = r.stcd
|
||||
WHERE st.stcd in (select distinct(stcd) from st_stbprp_b_elem where elem ='z')
|
||||
</script>
|
||||
""")
|
||||
List<StStatusVo> rzList();
|
||||
|
||||
}
|
||||
|
|
@ -14,7 +14,6 @@ import com.gunshi.project.xyt.util.DataHandleUtil;
|
|||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import com.gunshi.project.xyt.util.ExcelUtil;
|
||||
import com.gunshi.project.xyt.util.MyBeanUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -35,11 +34,9 @@ import java.util.stream.Collectors;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, OsmoticPressR>
|
||||
{
|
||||
@Resource
|
||||
private OsmoticPressRMapper mapper;
|
||||
|
||||
public Page<OsmoticPressR> queryPage(OsmoticQueryPageSo osmoticQueryPageSo) {
|
||||
return mapper.queryPage(osmoticQueryPageSo.getPageSo().toPage(),osmoticQueryPageSo);
|
||||
return baseMapper.queryPage(osmoticQueryPageSo.getPageSo().toPage(),osmoticQueryPageSo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,16 +50,16 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
Map<String,BigDecimal> drpMap = new HashMap<>();
|
||||
if(year != null){
|
||||
isDesc = false;
|
||||
List<StRzVo> drpList = mapper.queryDrp(year);
|
||||
List<StRzVo> drpList = baseMapper.queryDrp(year);
|
||||
drpMap = drpList.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
|
||||
}
|
||||
List<String> dateList = DateUtil.getDatesBetween(osmoticQuerySo.getDateTimeRangeSo().getStart(), osmoticQuerySo.getDateTimeRangeSo().getEnd(),isDesc);
|
||||
List<OsmoticStationVo> resList = new ArrayList<>();
|
||||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryRz(osmoticQuerySo);
|
||||
List<StRzVo> list = baseMapper.queryRz(osmoticQuerySo);
|
||||
Map<String, BigDecimal> rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
|
||||
//查询测站管水位/渗流量
|
||||
List<OsmoticValueVo> valueList = mapper.queryValue(osmoticQuerySo);
|
||||
List<OsmoticValueVo> valueList = baseMapper.queryValue(osmoticQuerySo);
|
||||
//数据处理
|
||||
for(String str : dateList){
|
||||
OsmoticStationVo vo = new OsmoticStationVo();
|
||||
|
|
@ -82,9 +79,9 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
List<OsmoticChartVo> resList = new ArrayList<>();
|
||||
List<String> stationCodes = osmoticQuerySo.getStationCodes();
|
||||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryRz(osmoticQuerySo);
|
||||
List<StRzVo> list = baseMapper.queryRz(osmoticQuerySo);
|
||||
//查询测站管水位
|
||||
List<OsmoticValueVo> valueList = mapper.queryValue(osmoticQuerySo);
|
||||
List<OsmoticValueVo> valueList = baseMapper.queryValue(osmoticQuerySo);
|
||||
//按测站分组
|
||||
Map<String, List<OsmoticValueVo>> map = valueList.stream().collect(Collectors.groupingBy(OsmoticValueVo::getStationCode));
|
||||
for(String code : stationCodes){
|
||||
|
|
@ -109,7 +106,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
//查询测站降雨量
|
||||
List<StRzVo> drpList;
|
||||
if(year != null){
|
||||
drpList = mapper.queryDrp(year);
|
||||
drpList = baseMapper.queryDrp(year);
|
||||
OsmoticChartVo chartVo = new OsmoticChartVo();
|
||||
chartVo.setStationCode("rz");
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
|
|
@ -170,12 +167,12 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
public List<OsmoticStationVo> infiltraLine(OsmoticQuerySo osmoticQuerySo) {
|
||||
List<OsmoticStationVo> resList = new ArrayList<>();
|
||||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryLineRz(osmoticQuerySo);
|
||||
List<StRzVo> list = baseMapper.queryLineRz(osmoticQuerySo);
|
||||
Map<String, BigDecimal> rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
|
||||
//查询测站管水位
|
||||
List<OsmoticValueVo> valueList = mapper.queryLineValue(osmoticQuerySo);
|
||||
List<OsmoticValueVo> valueList = baseMapper.queryLineValue(osmoticQuerySo);
|
||||
//查询测站预警信息
|
||||
List<OsmoticValueVo> warnList = mapper.queryWarn(osmoticQuerySo);
|
||||
List<OsmoticValueVo> warnList = baseMapper.queryWarn(osmoticQuerySo);
|
||||
valueList.stream().map(vo->{
|
||||
Boolean b = warnList.stream().filter(o->o.getStationCode().equals(vo.getStationCode()) && o.getTm().equals(vo.getTm())).findAny().isPresent();
|
||||
if(b){
|
||||
|
|
@ -380,9 +377,9 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
public List<OsmoticPressVo> listValue(Integer type) {
|
||||
List<OsmoticPressVo> list;
|
||||
if(type == 1){
|
||||
list = mapper.listValue();
|
||||
list = baseMapper.listValue();
|
||||
}else {
|
||||
list = mapper.flowListValue();
|
||||
list = baseMapper.flowListValue();
|
||||
}
|
||||
OsmoticQuerySo so = new OsmoticQuerySo();
|
||||
List<String> stationCodes = list.stream().map(OsmoticPressVo::getStationCode).collect(Collectors.toList());
|
||||
|
|
@ -393,7 +390,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
dateTimeRangeSo.setStart(DateUtil.convertStringToDate(minTm));
|
||||
dateTimeRangeSo.setEnd(DateUtil.convertStringToDate(maxTm));
|
||||
so.setDateTimeRangeSo(dateTimeRangeSo);
|
||||
List<OsmoticValueVo> warnList = mapper.queryWarn(so);
|
||||
List<OsmoticValueVo> warnList = baseMapper.queryWarn(so);
|
||||
list.stream().map(o->{
|
||||
if(o.getTm() != null && DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(o.getTm()), new Date()) > 48){
|
||||
o.setFlag(1);
|
||||
|
|
@ -408,10 +405,10 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
}
|
||||
|
||||
public List<OsmoticPressDetailVo> detailValue(OsmoticDetailQuerySo so) {
|
||||
List<OsmoticPressDetailVo> list = mapper.detailValue(so);
|
||||
List<OsmoticPressDetailVo> list = baseMapper.detailValue(so);
|
||||
OsmoticQuerySo osmoticQuerySo = new OsmoticQuerySo();
|
||||
BeanUtils.copyProperties(so,osmoticQuerySo);
|
||||
List<StRzVo> stRzVos = mapper.queryLineRz(osmoticQuerySo);
|
||||
List<StRzVo> stRzVos = baseMapper.queryLineRz(osmoticQuerySo);
|
||||
return bindPressDetail(list,stRzVos);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ import java.util.stream.Collectors;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, OsmoticShiftR>
|
||||
{
|
||||
@Resource
|
||||
private OsmoticShiftRMapper mapper;
|
||||
|
||||
@Resource
|
||||
private OsmoticPressRMapper pressRMapper;
|
||||
|
|
@ -65,7 +63,7 @@ public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, Osmot
|
|||
List<OsmoticShiftVo> resList = new ArrayList<>();
|
||||
commonQueryHandle(osmoticQuerySo);
|
||||
//查询位移监测记录
|
||||
List<OsmoticShiftValueVo> valueList = mapper.queryValue(osmoticQuerySo);
|
||||
List<OsmoticShiftValueVo> valueList = baseMapper.queryValue(osmoticQuerySo);
|
||||
List<String> dateList = DateUtil.getDatesBetween(osmoticQuerySo.getDateTimeRangeSo().getStart(), osmoticQuerySo.getDateTimeRangeSo().getEnd(), false);
|
||||
//数据处理
|
||||
for(String str : dateList){
|
||||
|
|
@ -93,7 +91,7 @@ public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, Osmot
|
|||
List<OsmoticChartVo> resList = new ArrayList<>();
|
||||
commonQueryHandle(osmoticQuerySo);
|
||||
//查询位移监测记录
|
||||
List<OsmoticShiftValueVo> valueList = mapper.queryValue(osmoticQuerySo);
|
||||
List<OsmoticShiftValueVo> valueList = baseMapper.queryValue(osmoticQuerySo);
|
||||
//按测站分组
|
||||
Map<String, List<OsmoticShiftValueVo>> map = valueList.stream().collect(Collectors.groupingBy(OsmoticShiftValueVo::getStationCode));
|
||||
map.entrySet().forEach(o->{
|
||||
|
|
@ -250,7 +248,7 @@ public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, Osmot
|
|||
}
|
||||
|
||||
public List<OsmoticShiftListVo> listValue() {
|
||||
List<OsmoticShiftListVo> list = mapper.listValue();
|
||||
List<OsmoticShiftListVo> list = baseMapper.listValue();
|
||||
OsmoticQuerySo so = new OsmoticQuerySo();
|
||||
List<String> stationCodes = list.stream().map(OsmoticShiftListVo::getStationCode).collect(Collectors.toList());
|
||||
String maxTm = list.stream().filter(o->o.getTm() != null).max(Comparator.comparing(OsmoticShiftListVo::getTm)).get().getTm();
|
||||
|
|
@ -260,7 +258,7 @@ public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, Osmot
|
|||
dateTimeRangeSo.setStart(DateUtil.convertStringToDate(minTm));
|
||||
dateTimeRangeSo.setEnd(DateUtil.convertStringToDate(maxTm));
|
||||
so.setDateTimeRangeSo(dateTimeRangeSo);
|
||||
List<OsmoticShiftListVo> warnList = mapper.queryWarn(so);
|
||||
List<OsmoticShiftListVo> warnList = baseMapper.queryWarn(so);
|
||||
list.stream().map(o->{
|
||||
if(o.getTm() != null && DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(o.getTm()), new Date()) > 48){
|
||||
o.setFlag(1);
|
||||
|
|
@ -283,7 +281,7 @@ public class OsmoticShiftRService extends ServiceImpl<OsmoticShiftRMapper, Osmot
|
|||
}
|
||||
|
||||
public List<OsmoticShiftValueVo> detailValue(OsmoticDetailQuerySo so) {
|
||||
List<OsmoticShiftValueVo> list = mapper.detailValue(so);
|
||||
List<OsmoticShiftValueVo> list = baseMapper.detailValue(so);
|
||||
OsmoticQuerySo osmoticQuerySo = new OsmoticQuerySo();
|
||||
BeanUtils.copyProperties(so,osmoticQuerySo);
|
||||
List<StRzVo> stRzVos = pressRMapper.queryLineRz(osmoticQuerySo);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,23 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.so.HomeStStbprpBSo;
|
||||
import com.gunshi.project.xyt.entity.vo.HomeStStbprpBVo;
|
||||
import com.gunshi.project.xyt.entity.vo.*;
|
||||
import com.gunshi.project.xyt.mapper.OsmoticPressRMapper;
|
||||
import com.gunshi.project.xyt.mapper.OsmoticShiftRMapper;
|
||||
import com.gunshi.project.xyt.mapper.StStbprpBMapper;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: sttp 以水利标准来
|
||||
|
|
@ -21,6 +29,12 @@ import java.util.List;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
||||
{
|
||||
@Resource
|
||||
private OsmoticPressRMapper pressRMapper;
|
||||
|
||||
@Resource
|
||||
private OsmoticShiftRMapper shiftRMapper;
|
||||
|
||||
|
||||
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
||||
return baseMapper.rainfallStationDetailsList(dto);
|
||||
|
|
@ -31,6 +45,66 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
public List<HomeStStbprpBVo> flowStationDetailsList() {
|
||||
return baseMapper.flowStationDetailsList();
|
||||
}
|
||||
|
||||
public StStatusListVo statusList() {
|
||||
StStatusListVo res = new StStatusListVo();
|
||||
//水雨情站超过2小时为离线;渗压,渗流,位移暂定超过24小时为离线
|
||||
List<StStatusVo> list = new ArrayList<>();
|
||||
List<StStatusVo> onLineList = new ArrayList<>();
|
||||
List<StStatusVo> offLineList = new ArrayList<>();
|
||||
//雨量站
|
||||
List<StStatusVo> rainList = baseMapper.realRainList();
|
||||
//水位站
|
||||
List<StStatusVo> rzList = baseMapper.rzList();
|
||||
rainList.addAll(rzList);
|
||||
rainList.stream().collect(Collectors.toMap(obj->obj.getStcd(),obj-> obj,(obj1,obj2)->
|
||||
DateUtil.convertStringToDate(obj1.getTm()).after(DateUtil.convertStringToDate(obj2.getTm())) ? obj1 : obj2
|
||||
)).values().stream().collect(Collectors.toList());
|
||||
for(StStatusVo statusVo : rainList){
|
||||
String tm = statusVo.getTm();
|
||||
if(StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm),new Date()) > 2){
|
||||
offLineList.add(statusVo);
|
||||
}else {
|
||||
onLineList.add(statusVo);
|
||||
}
|
||||
}
|
||||
//渗压
|
||||
List<OsmoticPressVo> pressList = pressRMapper.listValue();
|
||||
list.addAll(pressList.stream().map(o->{
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
//渗流
|
||||
List<OsmoticPressVo> flowList = pressRMapper.flowListValue();
|
||||
list.addAll(flowList.stream().map(o->{
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
//位移
|
||||
List<OsmoticShiftListVo> shiftList = shiftRMapper.listValue();
|
||||
list.addAll(shiftList.stream().map(o->{
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
for (StStatusVo vo : list){
|
||||
String tm = vo.getTm();
|
||||
if(StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm),new Date()) > 24){
|
||||
offLineList.add(vo);
|
||||
}else {
|
||||
onLineList.add(vo);
|
||||
}
|
||||
}
|
||||
res.setOnline(onLineList);
|
||||
res.setOffLine(offLineList);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.gunshi.project.xyt.entity.so.TyYearRainfallPageSo;
|
|||
import com.gunshi.project.xyt.entity.vo.TyYearRainfallVo;
|
||||
import com.gunshi.project.xyt.mapper.TyYearRainfallMapper;
|
||||
import com.gunshi.project.xyt.model.TyYearRainfall;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -30,8 +29,6 @@ import java.util.stream.Collectors;
|
|||
public class TyYearRainfallService extends ServiceImpl<TyYearRainfallMapper, TyYearRainfall>
|
||||
{
|
||||
|
||||
@Resource
|
||||
private TyYearRainfallMapper mapper;
|
||||
|
||||
public boolean saveData(TyYearRainfallVo dto) {
|
||||
checkParam(dto);
|
||||
|
|
@ -67,7 +64,7 @@ public class TyYearRainfallService extends ServiceImpl<TyYearRainfallMapper, TyY
|
|||
}
|
||||
|
||||
public Page<TyYearRainfallVo> pageQuery(TyYearRainfallPageSo tyYearRainfallPageSo) {
|
||||
Page<TyYearRainfallVo> page = mapper.pageQuery(tyYearRainfallPageSo.getPageSo().toPage(), tyYearRainfallPageSo);
|
||||
Page<TyYearRainfallVo> page = baseMapper.pageQuery(tyYearRainfallPageSo.getPageSo().toPage(), tyYearRainfallPageSo);
|
||||
fillList(page);
|
||||
return page;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue