水情联调修改
parent
c9f1735b9f
commit
ce25fdfc76
|
|
@ -1,20 +1,25 @@
|
||||||
package com.gunshi.project.xyt.controller;
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.core.annotation.Get;
|
||||||
import com.gunshi.core.annotation.Post;
|
import com.gunshi.core.annotation.Post;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
||||||
import com.gunshi.project.xyt.entity.so.ReservoirWaterCommonSo;
|
import com.gunshi.project.xyt.entity.so.ReservoirWaterCommonSo;
|
||||||
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
|
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
|
||||||
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.AttRvMonitorDetailVo;
|
||||||
import com.gunshi.project.xyt.entity.vo.StRsvrVo;
|
import com.gunshi.project.xyt.entity.vo.StRsvrVo;
|
||||||
import com.gunshi.project.xyt.model.StImgRReal;
|
import com.gunshi.project.xyt.model.StImgRReal;
|
||||||
|
import com.gunshi.project.xyt.model.StStbprpB;
|
||||||
import com.gunshi.project.xyt.service.ReservoirWaterService;
|
import com.gunshi.project.xyt.service.ReservoirWaterService;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -45,6 +50,11 @@ public class ReservoirWaterController {
|
||||||
return R.ok(reservoirWaterService.list());
|
return R.ok(reservoirWaterService.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get(path = "/image/channel", summary = "图像监测视角下拉")
|
||||||
|
public R<List<StStbprpB>> channel(@Schema(name = "resCode") @RequestParam("resCode") String resCode) {
|
||||||
|
return R.ok(reservoirWaterService.channel(resCode));
|
||||||
|
}
|
||||||
|
|
||||||
@Post(path = "/real/img", summary = "水库实时图像")
|
@Post(path = "/real/img", summary = "水库实时图像")
|
||||||
public R<List<StImgRReal>> realImg(@RequestBody ReservoirWaterCommonSo reservoirWaterCommonSo) {
|
public R<List<StImgRReal>> realImg(@RequestBody ReservoirWaterCommonSo reservoirWaterCommonSo) {
|
||||||
return R.ok(reservoirWaterService.realImg(reservoirWaterCommonSo));
|
return R.ok(reservoirWaterService.realImg(reservoirWaterCommonSo));
|
||||||
|
|
@ -55,5 +65,8 @@ public class ReservoirWaterController {
|
||||||
return R.ok(reservoirWaterService.monitorData(dataQueryCommonSo));
|
return R.ok(reservoirWaterService.monitorData(dataQueryCommonSo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get(path = "/detail", summary = "监测详细数据(下方表格)")
|
||||||
|
public R<AttRvMonitorDetailVo> detail(@Schema(name = "stcd") @RequestParam("stcd") String stcd) {
|
||||||
|
return R.ok(reservoirWaterService.detail(stcd));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
import com.gunshi.core.annotation.Get;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.StStbprpCctvVo;
|
||||||
|
import com.gunshi.project.xyt.service.StStbprpCctvService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点与视频关系
|
||||||
|
* Created by wanyan on 2024/4/9
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/stbprp/cctv")
|
||||||
|
@Tag(name = "站点与视频关系")
|
||||||
|
public class StStbprpCctvController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StStbprpCctvService stStbprpCctvService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Get(path = "/listByStcd/{stcd}", summary = "按stcd查询")
|
||||||
|
public R<List<StStbprpCctvVo>> listByStcd(@PathVariable("stcd") String stcd) {
|
||||||
|
return R.ok(stStbprpCctvService.listByStcd(stcd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 河道监测数据(下方表格)
|
||||||
|
* Created by wanyan on 2024/2/20
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AttRvMonitorDetailVo extends StPptnDetailsVo {
|
||||||
|
|
||||||
|
@Schema(description="24小时水位变幅(m)")
|
||||||
|
private BigDecimal rzDiff;
|
||||||
|
|
||||||
|
@Schema(description="本年最高水位(m)")
|
||||||
|
private BigDecimal maxRz;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StStbprpCctv;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StStbprpCctvVo extends StStbprpCctv {
|
||||||
|
|
||||||
|
@Schema(description="站点名称")
|
||||||
|
private String stnm;
|
||||||
|
|
||||||
|
@Schema(description="视频名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -7,10 +7,13 @@ import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
||||||
import com.gunshi.project.xyt.model.AttResBase;
|
import com.gunshi.project.xyt.model.AttResBase;
|
||||||
import com.gunshi.project.xyt.model.StImgRReal;
|
import com.gunshi.project.xyt.model.StImgRReal;
|
||||||
import com.gunshi.project.xyt.model.StRsvrR;
|
import com.gunshi.project.xyt.model.StRsvrR;
|
||||||
|
import com.gunshi.project.xyt.model.StStbprpB;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -81,4 +84,38 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
||||||
</script>
|
</script>
|
||||||
""")
|
""")
|
||||||
List<StRsvrR> queryRzList(@Param("stcd") String stcd, @Param("stm") String startTime, @Param("etm") String endTime);
|
List<StRsvrR> queryRzList(@Param("stcd") String stcd, @Param("stm") String startTime, @Param("etm") String endTime);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t.tm,t.rz from public.st_rsvr_r_real t
|
||||||
|
where t.stcd = #{stcd}
|
||||||
|
order by t.TM desc limit 1
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
AttResMonitorVo latestRz(@Param("stcd") String stcd);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t.rz from public.st_rsvr_r t
|
||||||
|
where t.stcd = #{stcd} and t.tm = #{dateTime}
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
BigDecimal oldRz(@Param("stcd") String stcd,@Param("dateTime") Date dateTime);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select
|
||||||
|
max(t.rz) from public.st_rsvr_r t
|
||||||
|
where t.stcd = #{stcd} and t.tm <![CDATA[>=]]> #{startTime} and t.tm <![CDATA[<=]]> #{endTime}
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
BigDecimal queryMaxRzByStcdAndTime(@Param("stcd") String stcd, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select stcd,stnm from st_stbprp_b where res_code = #{resCode}
|
||||||
|
and sttp = 'TX'
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<StStbprpB> channel(@Param("resCode") String resCode);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.StStbprpCctvVo;
|
||||||
|
import com.gunshi.project.xyt.model.StStbprpCctv;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/4/9
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public interface StStbprpCctvMapper extends BaseMapper<StStbprpCctv> {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t.id,t.stcd,t,cam_id,s.name,m.stnm from public.st_stbprp_cctv t
|
||||||
|
left join public.att_cctv_base s on t.cam_id = s.index_code
|
||||||
|
left join public.st_stbprp_b m on t.stcd = m.stcd
|
||||||
|
where t.stcd=#{stcd}
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<StStbprpCctvVo> listByStcd(@Param("stcd") String stcd);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.gunshi.project.xyt.model;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 测站与视频监控关联表
|
||||||
|
* Created by XuSan on 2024/3/5.
|
||||||
|
*
|
||||||
|
* @author XuSan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Schema
|
||||||
|
@Data
|
||||||
|
@TableName(value = "public.st_stbprp_cctv")
|
||||||
|
public class StStbprpCctv implements Serializable {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
@Schema(description="主键id")
|
||||||
|
@NotNull(message = "主键不能为空", groups = {Update.class})
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField(value = "stcd")
|
||||||
|
@Schema(description="测站编码")
|
||||||
|
@NotNull(message = "测站编码不能为空", groups = {Insert.class,Update.class})
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
@TableField(value = "cam_id")
|
||||||
|
@Schema(description="视频id")
|
||||||
|
@NotNull(message = "视频id不能为空", groups = {Insert.class,Update.class})
|
||||||
|
private String camId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,21 +5,23 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
|
||||||
import com.gunshi.project.xyt.entity.so.ReservoirWaterCommonSo;
|
import com.gunshi.project.xyt.entity.so.ReservoirWaterCommonSo;
|
||||||
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
|
import com.gunshi.project.xyt.entity.vo.*;
|
||||||
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
|
|
||||||
import com.gunshi.project.xyt.entity.vo.StRsvrVo;
|
|
||||||
import com.gunshi.project.xyt.mapper.AttResBaseMapper;
|
import com.gunshi.project.xyt.mapper.AttResBaseMapper;
|
||||||
import com.gunshi.project.xyt.mapper.StZvarlBMapper;
|
import com.gunshi.project.xyt.mapper.StZvarlBMapper;
|
||||||
import com.gunshi.project.xyt.model.AttResBase;
|
import com.gunshi.project.xyt.model.AttResBase;
|
||||||
import com.gunshi.project.xyt.model.StImgRReal;
|
import com.gunshi.project.xyt.model.StImgRReal;
|
||||||
|
import com.gunshi.project.xyt.model.StStbprpB;
|
||||||
import com.gunshi.project.xyt.model.StZvarlB;
|
import com.gunshi.project.xyt.model.StZvarlB;
|
||||||
import com.gunshi.project.xyt.util.DataHandleUtil;
|
import com.gunshi.project.xyt.util.DataHandleUtil;
|
||||||
import com.gunshi.project.xyt.util.DateUtil;
|
import com.gunshi.project.xyt.util.DateUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -40,6 +42,9 @@ public class ReservoirWaterService {
|
||||||
@Resource
|
@Resource
|
||||||
private StZvarlBMapper stZvarlBMapper;
|
private StZvarlBMapper stZvarlBMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RainBasinDivisionService rainBasinDivisionService;
|
||||||
|
|
||||||
public List<AttResBaseVo> list() {
|
public List<AttResBaseVo> list() {
|
||||||
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList();
|
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList();
|
||||||
if(CollectionUtils.isEmpty(attResBaseVos)){
|
if(CollectionUtils.isEmpty(attResBaseVos)){
|
||||||
|
|
@ -161,4 +166,56 @@ public class ReservoirWaterService {
|
||||||
vo.setList(attResBaseMapper.queryRzList(attResBase.getStcd(),startTime,endTime));
|
vo.setList(attResBaseMapper.queryRzList(attResBase.getStcd(),startTime,endTime));
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AttRvMonitorDetailVo detail(String stcd) {
|
||||||
|
AttRvMonitorDetailVo vo = new AttRvMonitorDetailVo();
|
||||||
|
StPptnDetailsVo stPptnDetailsVo = rainBasinDivisionService.queryStPptnDetailsByStcd(stcd);
|
||||||
|
BeanUtils.copyProperties(stPptnDetailsVo,vo,AttRvMonitorDetailVo.class);
|
||||||
|
|
||||||
|
//最新水位
|
||||||
|
AttResMonitorVo monitorVo = attResBaseMapper.latestRz(stcd);
|
||||||
|
if(monitorVo == null){
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
Date tm = monitorVo.getTm();
|
||||||
|
BigDecimal rz = monitorVo.getRz();
|
||||||
|
|
||||||
|
//最新水位时间往前推24小时水位
|
||||||
|
LocalDateTime now = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||||
|
LocalDateTime dateTime = now.minusDays(1);
|
||||||
|
BigDecimal oldRz = attResBaseMapper.oldRz(stcd,Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
|
||||||
|
if(oldRz == null){
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
vo.setRzDiff(rz.subtract(oldRz));
|
||||||
|
|
||||||
|
//本年最高水位
|
||||||
|
BigDecimal maxYearRz = queryYearRzByStcdAndTime(stcd);
|
||||||
|
vo.setMaxRz(maxYearRz);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal queryYearRzByStcdAndTime(String stcd) {
|
||||||
|
LocalDateTime now = LocalDateTime.ofInstant(new Date().toInstant(), ZoneId.systemDefault());
|
||||||
|
LocalDateTime startTime;
|
||||||
|
LocalDateTime endTime;
|
||||||
|
if (now.getHour() >= 8 || (now.getHour() < 8 && now.getMonthValue() > 1) || (now.getHour() < 8 && now.getMonthValue() == 1 && now.getDayOfMonth() >= 1)){
|
||||||
|
startTime = LocalDateTime.of(
|
||||||
|
now.getYear(),
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
8,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
endTime = now;
|
||||||
|
return attResBaseMapper.queryMaxRzByStcdAndTime(stcd,Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()), Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
}
|
||||||
|
return new BigDecimal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StStbprpB> channel(String resCode) {
|
||||||
|
return attResBaseMapper.channel(resCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.entity.vo.StStbprpCctvVo;
|
||||||
|
import com.gunshi.project.xyt.mapper.StStbprpCctvMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Created by wanyan on 2024/4/9
|
||||||
|
*
|
||||||
|
* @author wanyan
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StStbprpCctvService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StStbprpCctvMapper stStbprpCctvMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public List<StStbprpCctvVo> listByStcd(String stcd) {
|
||||||
|
return stStbprpCctvMapper.listByStcd(stcd);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue