新增经纬度和状态
parent
9ffb7c93d5
commit
271481c5a5
|
|
@ -52,12 +52,14 @@ public interface JcskSlBMapper extends BaseMapper<JcskSlB> {
|
|||
@Select(
|
||||
"""
|
||||
<script>
|
||||
SELECT station_code, value, tm
|
||||
SELECT station_code, value, tm,lgtd,lttd
|
||||
FROM (
|
||||
SELECT
|
||||
st.dvcd as station_code,
|
||||
r.spqn as value,
|
||||
to_char(r.mstm,'YYYY-MM-DD HH24:MI:SS') as tm,
|
||||
st.lgtd,
|
||||
st.lttd,
|
||||
ROW_NUMBER() OVER (PARTITION BY st.mpcd ORDER BY r.mstm DESC) as rn
|
||||
FROM jcsk_sl_b st
|
||||
LEFT JOIN jcsk_sl_r r ON st.mpcd = r.mpcd
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ public interface JcskSyRMapper extends BaseMapper<JcskSyR> {
|
|||
st.dvcd as station_code,
|
||||
r.spprwl as value,
|
||||
to_char(r.mstm,'YYYY-MM-DD HH24:MI:SS') as tm,
|
||||
m.profile_name
|
||||
m.profile_name,
|
||||
st.lgtd,
|
||||
st.lttd
|
||||
FROM jcsk_sy_b st
|
||||
LEFT JOIN (
|
||||
SELECT mpcd,stcd, MAX(mstm) as max_tm
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ package com.gunshi.project.hsz.common.model;
|
|||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gunshi.db.annotation.IgnoreAutoMapperAndDao;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 位移设备表
|
||||
* 数据源为AttWyCdBase
|
||||
|
|
@ -53,4 +56,14 @@ public class JcskGnssB {
|
|||
|
||||
@TableField(exist = false)
|
||||
private String stationCode;
|
||||
|
||||
@Schema(description = "0 离线 1 在线")
|
||||
@TableField(exist = false)
|
||||
private Integer status;
|
||||
|
||||
@TableField("lttd")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@TableField("lgtd")
|
||||
private BigDecimal lgtd;
|
||||
}
|
||||
|
|
@ -24,4 +24,11 @@ public class JcskSyRVo {
|
|||
|
||||
@Schema(description = "是否超过预警(0否 1是)")
|
||||
private Integer status = 0;
|
||||
|
||||
@Schema(description = "0 离线 1在线")
|
||||
private Integer onoffStauts;
|
||||
|
||||
private BigDecimal lgtd;
|
||||
|
||||
private BigDecimal lttd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ public class AttCctvBaseController {
|
|||
@PostMapping("/list")
|
||||
public R<List<AttCctvBase>> list() {
|
||||
List<AttCctvBase> res = service.queryList();
|
||||
//没时间只能默认为离线
|
||||
for (AttCctvBase re : res) {
|
||||
re.setStatus(0);
|
||||
}
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public class JcskGnssBController {
|
|||
list.stream().forEach(o ->{
|
||||
o.setStationCode(o.getCd());
|
||||
});
|
||||
service.checkStatus(list);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -244,4 +244,7 @@ public class AttResBaseVo {
|
|||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date ecologyFlowTm;
|
||||
|
||||
@Schema(description = "状态 0 离线 1在线")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,4 +168,8 @@ public class AttRvBaseVo {
|
|||
*/
|
||||
@Schema(description = "死水位 写死")
|
||||
private BigDecimal deadLev;
|
||||
|
||||
|
||||
@Schema(description = "状态 0 离线 1在线")
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public class RealRainListVo {
|
|||
|
||||
private String lgtd;
|
||||
private String lttd;
|
||||
@Schema(description = "0 离线 1 在线")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="降雨量级 0:无降雨 1:小雨 2:中雨 3:大雨 4:暴雨 5:大暴雨 6:特大暴雨")
|
||||
private Integer rainTag;
|
||||
|
|
|
|||
|
|
@ -135,4 +135,8 @@ public class AttCctvBase implements Serializable {
|
|||
private Date createTime;
|
||||
|
||||
|
||||
@Schema(description = "状态 0 离线 1在线")
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -85,4 +85,8 @@ public class StWaterRReal implements Serializable {
|
|||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal lttd;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "0 离线 1 在线")
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.hsz.common.mapper.JcskGnssRMapper;
|
||||
import com.gunshi.project.hsz.common.model.JcskGnssR;
|
||||
import com.gunshi.project.hsz.common.model.so.JcskGnssBPageSo;
|
||||
import com.gunshi.project.hsz.common.model.vo.HomeJcskGnssBVo;
|
||||
import com.gunshi.project.hsz.common.mapper.JcskGnssBMapper;
|
||||
|
|
@ -12,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
|
@ -21,6 +25,12 @@ import java.util.List;
|
|||
public class JcskGnssBService extends ServiceImpl<JcskGnssBMapper, JcskGnssB> {
|
||||
|
||||
|
||||
private final JcskGnssRMapper jcskGnssRMapper;
|
||||
|
||||
public JcskGnssBService(JcskGnssRMapper jcskGnssRMapper) {
|
||||
this.jcskGnssRMapper = jcskGnssRMapper;
|
||||
}
|
||||
|
||||
public Page<JcskGnssB> pageQuery(JcskGnssBPageSo page) {
|
||||
|
||||
LambdaQueryWrapper<JcskGnssB> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
@ -47,4 +57,27 @@ public class JcskGnssBService extends ServiceImpl<JcskGnssBMapper, JcskGnssB> {
|
|||
public List<JcskGnssB> artificialTree() {
|
||||
return baseMapper.selectArtificial();
|
||||
}
|
||||
|
||||
public void checkStatus(List<JcskGnssB> list){
|
||||
for (JcskGnssB jcskGnssB : list) {
|
||||
//N+1 就N+1把 无所谓了
|
||||
LambdaQueryWrapper<JcskGnssR> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(JcskGnssR::getCd, jcskGnssB.getCd());
|
||||
queryWrapper.orderByDesc(JcskGnssR::getTm)
|
||||
.last("limit 1");
|
||||
JcskGnssR jcskGnssR = jcskGnssRMapper.selectOne(queryWrapper);
|
||||
if(jcskGnssR == null){
|
||||
jcskGnssB.setStatus(0);
|
||||
}else if(jcskGnssR != null){
|
||||
LocalDateTime tm = jcskGnssR.getTm();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Duration between = Duration.between(tm, now);
|
||||
if(between.toHours() > 24){
|
||||
jcskGnssB.setStatus(0);
|
||||
}else{
|
||||
jcskGnssB.setStatus(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,16 @@ public class JcskSyRService extends ServiceImpl<JcskSyRMapper, JcskSyR> {
|
|||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
for (JcskSyRVo jcskSyRVo : list) {
|
||||
String tm = jcskSyRVo.getTm();
|
||||
if(tm != null && DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24){
|
||||
jcskSyRVo.setOnoffStauts(0);
|
||||
}else if(tm == null){
|
||||
jcskSyRVo.setOnoffStauts(1);
|
||||
}else{
|
||||
jcskSyRVo.setOnoffStauts(1);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
package com.gunshi.project.hsz.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gunshi.project.hsz.common.mapper.StPptnRMapper;
|
||||
import com.gunshi.project.hsz.common.model.StPptnR;
|
||||
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||
import com.gunshi.project.hsz.entity.so.RealRainBaseSo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainStatListVo;
|
||||
import com.gunshi.project.hsz.mapper.RealRainMapper;
|
||||
import com.gunshi.project.hsz.model.AttBasBase;
|
||||
import com.gunshi.project.hsz.model.AttBasBaseAutoDao;
|
||||
import com.gunshi.project.hsz.util.DateUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -36,6 +41,9 @@ public class RealRainService {
|
|||
|
||||
private final AttBasBaseAutoDao attBasBaseAutoDao;
|
||||
|
||||
@Autowired
|
||||
private StPptnRMapper stPptnRMapper;
|
||||
|
||||
/**
|
||||
* 实时雨情-降雨信息-查询接口
|
||||
*
|
||||
|
|
@ -45,6 +53,24 @@ public class RealRainService {
|
|||
public List<RealRainListVo> getRealRainList(RealRainBaseSo realRainBaseSo) {
|
||||
List<RealRainListVo> result = realRainMapper.getRealRainList(realRainBaseSo.getStm(), realRainBaseSo.getEtm());
|
||||
|
||||
for (RealRainListVo realRainListVo : result) {
|
||||
LambdaQueryWrapper<StPptnR> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StPptnR::getStcd,realRainListVo.getStcd())
|
||||
.orderByDesc(StPptnR::getTm)
|
||||
.last("limit 1");
|
||||
StPptnR stPptnR = stPptnRMapper.selectOne(queryWrapper);
|
||||
if(stPptnR == null){
|
||||
realRainListVo.setStatus(0);
|
||||
}else{
|
||||
Date tm = stPptnR.getTm();
|
||||
if(DateUtil.hoursBetweenDate(tm,new Date()) > 24){
|
||||
realRainListVo.setStatus(0);
|
||||
}else{
|
||||
realRainListVo.setStatus(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// result.sort(Comparator.comparing(RealRainListVo::getDrp, Comparator.nullsFirst(Double::compareTo)).reversed().thenComparing(RealRainListVo::getStcd));
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,14 @@ public class ReservoirWaterService {
|
|||
BigDecimal w = stZvarlBService.getWByZvarl(zvarlList,rz);
|
||||
vo.setNowCap(w);
|
||||
}
|
||||
Date tm = vo.getTm();
|
||||
if(tm != null && DateUtil.hoursBetweenDate(tm,new Date()) > 24){
|
||||
vo.setStatus(0);
|
||||
}else if(tm == null){
|
||||
vo.setStatus(0);
|
||||
}else{
|
||||
vo.setStatus(1);
|
||||
}
|
||||
});
|
||||
|
||||
//TODO 计算2个灌溉站的流量之和
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.gunshi.project.hsz.mapper.StZqRMapper;
|
|||
import com.gunshi.project.hsz.mapper.StZqrlBMapper;
|
||||
import com.gunshi.project.hsz.model.*;
|
||||
import com.gunshi.project.hsz.util.DataHandleUtil;
|
||||
import com.gunshi.project.hsz.util.DateUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -66,17 +67,16 @@ public class RiverWaterService {
|
|||
if(CollectionUtils.isEmpty(attRvBaseVos)){
|
||||
return attRvBaseVos;
|
||||
}
|
||||
// for (AttRvBaseVo attRvBaseVo : attRvBaseVos) {
|
||||
// Date tm = attRvBaseVo.getTm();
|
||||
// Calendar now = Calendar.getInstance();
|
||||
// now.set(Calendar.MINUTE, 0);
|
||||
// now.set(Calendar.SECOND, 0);
|
||||
// now.set(Calendar.MILLISECOND, 0);
|
||||
// Date currentDate = now.getTime();
|
||||
// if(tm.before(currentDate)){
|
||||
// attRvBaseVo.setZ(null);
|
||||
// }
|
||||
// }
|
||||
for (AttRvBaseVo attRvBaseVo : attRvBaseVos) {
|
||||
Date tm = attRvBaseVo.getTm();
|
||||
if(tm != null && DateUtil.hoursBetweenDate(tm,new Date()) > 24){
|
||||
attRvBaseVo.setStatus(0);
|
||||
}else if (tm == null){
|
||||
attRvBaseVo.setStatus(0);
|
||||
}else{
|
||||
attRvBaseVo.setStatus(1);
|
||||
}
|
||||
}
|
||||
return attRvBaseVos;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.gunshi.project.hsz.util.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -40,6 +41,13 @@ public class StWaterRRealService extends ServiceImpl<StWaterRRealMapper, StWater
|
|||
stWaterRReal.setQ(null);
|
||||
stWaterRReal.setV(null);
|
||||
}
|
||||
if(DateUtil.hoursBetweenDate(tm,new Date()) < 1){
|
||||
stWaterRReal.setStatus(1);
|
||||
}else{
|
||||
stWaterRReal.setStatus(0);
|
||||
}
|
||||
}else{
|
||||
stWaterRReal.setStatus(0);
|
||||
}
|
||||
}
|
||||
return stWaterRReals;
|
||||
|
|
|
|||
Loading…
Reference in New Issue