闸阀调节;水库水情接口返回增加死库容和控制流域面积
parent
4945410a8e
commit
dbc554408f
|
|
@ -9,6 +9,7 @@ import com.gunshi.project.xyt.service.GateValveCctvRelService;
|
|||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -74,8 +75,8 @@ public class GateValveCctvRelController {
|
|||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<GateValveCctvRelVo>> list() {
|
||||
return R.ok(service.queryList());
|
||||
public R<List<GateValveCctvRelVo>> list(@RequestParam(value = "valveCode",required = false) @Parameter(description = "闸阀编码") String valveCode) {
|
||||
return R.ok(service.queryList(valveCode));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
|
||||
import com.gunshi.project.xyt.model.GateValveKey;
|
||||
import com.gunshi.project.xyt.model.GateValveReal;
|
||||
import com.gunshi.project.xyt.service.GateValveRealService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
|
|
@ -63,6 +64,12 @@ public class GateValveRealController {
|
|||
return R.ok(service.realQ(valveCode));
|
||||
}
|
||||
|
||||
@Operation(summary = "调节闸阀")
|
||||
@PostMapping("/control")
|
||||
public R<String> control(@RequestBody GateValveKey gateValveKey) {
|
||||
return R.ok(service.control(gateValveKey));
|
||||
}
|
||||
|
||||
// @Operation(summary = "分页")
|
||||
// @PostMapping("/page")
|
||||
public R<List<GateValveReal>> page() {
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ public class AttResBaseVo {
|
|||
@Schema(description="监测水位")
|
||||
private BigDecimal rz;
|
||||
|
||||
@Schema(description="坝址控制流域面积")
|
||||
private BigDecimal watShedArea;
|
||||
|
||||
/**
|
||||
* 超讯限
|
||||
*/
|
||||
|
|
@ -155,6 +158,9 @@ public class AttResBaseVo {
|
|||
@Schema(description = "坝顶高程")
|
||||
private BigDecimal crestElev;
|
||||
|
||||
@Schema(description="死库容")
|
||||
private BigDecimal deadCap;
|
||||
|
||||
/**
|
||||
* 兴利库容
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
@Select("""
|
||||
<script>
|
||||
select t.stcd,t.stnm,COALESCE(t.clgtd,t.lgtd) lgtd,COALESCE(t.clttd,t.lttd) lttd,t.source,t.sttp,t.stlc,t.adcd,t.esstym,s.res_code,s.fl_low_lim_lev,
|
||||
s.tot_cap,s.ben_res_cap,s.norm_wat_lev,s.crest_elev,s.des_flood_lev,s.dead_lev,s.cal_flood_lev,sad.adnm,
|
||||
s.tot_cap,s.ben_res_cap,s.norm_wat_lev,s.crest_elev,s.des_flood_lev,s.dead_lev,s.cal_flood_lev,s.wat_shed_area,s.dead_cap,sad.adnm,
|
||||
m.tm,m.rz,(m.rz-s.fl_low_lim_lev) as aFsltdz,sprr.tm as drpTm,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today,
|
||||
case when s.cal_flood_lev is not null and m.rz-s.cal_flood_lev > 0 then 1 else 0 end as calState,
|
||||
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev > 0 then 1 else 0 end as desState,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,12 @@ public interface GateValveCctvRelMapper extends BaseMapper<GateValveCctvRel> {
|
|||
from public.gate_valve_cctv_rel t
|
||||
LEFT JOIN public.att_gate_valve s ON t.valve_code = s.valve_code
|
||||
LEFT JOIN public.att_cctv_base m ON t.index_code = m.index_code
|
||||
<where>
|
||||
<if test="valveCode != null and valveCode !=''">
|
||||
t.valve_code = #{valveCode}
|
||||
</if>
|
||||
</where>
|
||||
</script>
|
||||
""")
|
||||
List<GateValveCctvRelVo> queryList();
|
||||
List<GateValveCctvRelVo> queryList(@Param("valveCode") String valveCode);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 描述: 闸阀密码表
|
||||
* author: xusan
|
||||
* date: 2024-07-08 17:34:26
|
||||
*/
|
||||
@Schema(description="闸阀密码表")
|
||||
@Data
|
||||
@TableName("public.gate_valve_key")
|
||||
public class GateValveKey implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 闸阀编号
|
||||
*/
|
||||
@TableId(value="valve_code", type= IdType.AUTO)
|
||||
@Schema(description="闸阀编号")
|
||||
private String valveCode;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@TableField(value="key")
|
||||
@Schema(description="密码")
|
||||
private String key;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description="开关状态")
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
@ -1,15 +1,12 @@
|
|||
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.annotation.JsonFormat;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -29,18 +26,11 @@ public class GateValveR implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="id")
|
||||
// @Size(max = 0,message = "id最大长度要小于 0")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 闸阀ID
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value="valve_code")
|
||||
@Schema(description="闸阀ID")
|
||||
@Size(max = 20,message = "闸阀ID最大长度要小于 20")
|
||||
|
|
@ -56,9 +46,9 @@ public class GateValveR implements Serializable {
|
|||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value="tm")
|
||||
@Schema(description="操作时间")
|
||||
// @Size(max = 0,message = "操作时间最大长度要小于 0")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date tm;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
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.annotation.JsonFormat;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -28,17 +26,10 @@ public class GateValveReal implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="id")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 闸阀ID
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value="valve_code")
|
||||
@Schema(description="闸阀ID")
|
||||
@Size(max = 20,message = "闸阀ID最大长度要小于 20")
|
||||
|
|
@ -54,6 +45,7 @@ public class GateValveReal implements Serializable {
|
|||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value="tm")
|
||||
@Schema(description="操作时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public class GateValveCctvRelService extends ServiceImpl<GateValveCctvRelMapper,
|
|||
return getBaseMapper().pages(page.getPageSo().toPage(), page);
|
||||
}
|
||||
|
||||
public List<GateValveCctvRelVo> queryList() {
|
||||
return baseMapper.queryList();
|
||||
public List<GateValveCctvRelVo> queryList(String valveCode) {
|
||||
return baseMapper.queryList(valveCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
|
||||
import com.gunshi.project.xyt.mapper.GateValveRMapper;
|
||||
import com.gunshi.project.xyt.mapper.GateValveRealMapper;
|
||||
import com.gunshi.project.xyt.model.GateValveKey;
|
||||
import com.gunshi.project.xyt.model.GateValveKeyAutoDao;
|
||||
import com.gunshi.project.xyt.model.GateValveR;
|
||||
import com.gunshi.project.xyt.model.GateValveReal;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -23,6 +30,11 @@ import java.util.List;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateValveReal>
|
||||
{
|
||||
@Resource
|
||||
private GateValveKeyAutoDao gateValveKeyAutoDao;
|
||||
|
||||
@Resource
|
||||
private GateValveRMapper gateValveRMapper;
|
||||
|
||||
public List<GateStautsVo> gateStatusList() {
|
||||
List<GateStautsVo> list = baseMapper.gateStatusList();
|
||||
|
|
@ -37,6 +49,28 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
|
|||
public BigDecimal realQ(String valveCode) {
|
||||
return baseMapper.realQ(valveCode);
|
||||
}
|
||||
|
||||
public String control(GateValveKey gateValveKey) {
|
||||
//先判断密码是否正确
|
||||
String valveCode = gateValveKey.getValveCode();
|
||||
String key = gateValveKey.getKey();
|
||||
GateValveKey valveKey = gateValveKeyAutoDao.getById(valveCode);
|
||||
if(valveKey == null || !key.equals(valveKey.getKey())){
|
||||
throw new IllegalArgumentException("密码不正确");
|
||||
}
|
||||
//更新闸阀实时表和历史表
|
||||
GateValveR gateValveR = new GateValveR();
|
||||
BeanUtils.copyProperties(gateValveKey,gateValveR);
|
||||
gateValveR.setTm(new Date());
|
||||
gateValveRMapper.insert(gateValveR);
|
||||
|
||||
GateValveReal real = new GateValveReal();
|
||||
BeanUtils.copyProperties(gateValveKey,real);
|
||||
real.setTm(new Date());
|
||||
this.remove(new QueryWrapper<GateValveReal>().eq("valve_code",valveCode));
|
||||
this.save(real);
|
||||
return "调节闸阀成功";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue