闸门监控

master
wany 2024-09-26 13:52:26 +08:00
parent e998019421
commit 2656d0e722
9 changed files with 818 additions and 0 deletions

View File

@ -0,0 +1,65 @@
package com.gunshi.project.xyt.controller;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.vo.GateMonitorDataVo;
import com.gunshi.project.xyt.model.AttGateB;
import com.gunshi.project.xyt.service.AttGateBService;
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.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:06
*/
@Tag(name = "水闸基本情况调查表")
@RestController
@RequestMapping(value="/attGateB")
public class AttGateBController {
@Autowired
private AttGateBService service;
@Operation(summary = "新增")
@PostMapping("/insert")
public R<AttGateB> insert(@Validated(Insert.class) @RequestBody AttGateB dto) {
boolean result = service.save(dto);
return R.ok(result ? dto : null);
}
@Operation(summary = "修改")
@PostMapping("/update")
public R<AttGateB> update(@Validated(Update.class) @RequestBody AttGateB dto) {
boolean result = service.updateById(dto);
return R.ok(result ? dto : null);
}
@Operation(summary = "删除")
@GetMapping("/del/{id}")
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
return R.ok(service.removeById(id));
}
@Operation(summary = "列表")
@PostMapping("/list")
public R<List<AttGateB>> list() {
return R.ok(service.queryList());
}
@Operation(summary = "监测数据")
@GetMapping("/data")
public R<List<GateMonitorDataVo>> dataList(@Schema(name = "gateCode",description = "水闸编码") @RequestParam("gateCode") String gateCode) {
return R.ok(service.dataList(gateCode));
}
}

View File

@ -0,0 +1,58 @@
package com.gunshi.project.xyt.controller;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.model.GatePore;
import com.gunshi.project.xyt.service.GatePoreService;
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.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.Serializable;
import java.util.List;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:57
*/
@Tag(name = "闸孔信息表")
@RestController
@RequestMapping(value="/gatePore")
public class GatePoreController {
@Autowired
private GatePoreService service;
@Operation(summary = "新增")
@PostMapping("/insert")
public R<GatePore> insert(@Validated(Insert.class) @RequestBody GatePore dto) {
boolean result = service.save(dto);
return R.ok(result ? dto : null);
}
@Operation(summary = "修改")
@PostMapping("/update")
public R<GatePore> update(@Validated(Update.class) @RequestBody GatePore dto) {
boolean result = service.updateById(dto);
return R.ok(result ? dto : null);
}
@Operation(summary = "删除")
@GetMapping("/del/{id}")
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
return R.ok(service.removeById(id));
}
@Operation(summary = "通过stcd获取闸孔开度")
@GetMapping("/listByStcd")
public R<List<GatePore>> list(@Schema(name = "stcd",description = "测站编码") @RequestParam("stcd") String stcd) {
return R.ok(service.lambdaQuery().eq(GatePore::getStcd,stcd).orderByAsc(GatePore::getGateNumber).list());
}
}

View File

@ -0,0 +1,35 @@
package com.gunshi.project.xyt.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gunshi.core.dateformat.DateFormatString;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author xusan
* @Date 2023/7/4 10:28
* @Notes
**/
@Data
public class GateMonitorDataVo {
@Schema(description = "水闸编号")
private String gateCode;
@Schema(description = "测站")
private String stcd;
@Schema(description = "类型1闸前水位站 2闸后水位站 3流量站")
private Integer type;
@Schema(description = "时间")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date tm;
@Schema(description = "值")
private BigDecimal value;
}

View File

@ -0,0 +1,32 @@
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.entity.vo.GateMonitorDataVo;
import com.gunshi.project.xyt.model.AttGateB;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:06
*/
@Mapper
public interface AttGateBMapper extends BaseMapper<AttGateB> {
@Select("""
<script>
select t1.*,t2.z as value,t2.tm from public.gate_stbprp_rel t1
left join public.st_river_r_real t2 on t1.stcd = t2.stcd
where t1.type in (1,2)
union all
select t3.*,t4.q as value,t4.tm from public.gate_stbprp_rel t3
left join public.st_water_r_real t4 on t3.stcd = t4.stcd
where t3.type = 3
</script>
""")
List<GateMonitorDataVo> dataList(@Param("gateCode") String gateCode);
}

View File

@ -0,0 +1,15 @@
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.model.GatePore;
import org.apache.ibatis.annotations.Mapper;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:57
*/
@Mapper
public interface GatePoreMapper extends BaseMapper<GatePore> {
}

View File

@ -0,0 +1,405 @@
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.gunshi.core.dateformat.DateFormatString;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:05
*/
@Schema(description="水闸基本情况调查表")
@Data
@TableName("public.att_gate_b")
public class AttGateB implements Serializable {
public final static String thisTableName = "AttGateB";
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value="gate_code", type= IdType.AUTO)
@Schema(description="水闸工程代码")
@Size(max = 20,message = "水闸工程代码最大长度要小于 20")
@NotBlank(message = "水闸工程代码不能为空")
private String gateCode;
/**
*
*/
@TableField(value="gate_name")
@Schema(description="水闸名称")
@Size(max = 100,message = "水闸名称最大长度要小于 100")
@NotBlank(message = "水闸名称不能为空")
private String gateName;
/**
*
*/
@TableField(value="eng_man_name")
@Schema(description="管理单位")
@Size(max = 255,message = "管理单位最大长度要小于 255")
private String engManName;
/**
*
*/
@TableField(value="ad_namee")
@Schema(description="所属行政位置")
@Size(max = 255,message = "所属行政位置最大长度要小于 255")
private String adNamee;
/**
*
*/
@TableField(value="chan_name")
@Schema(description="所在渠道")
@Size(max = 255,message = "所在渠道最大长度要小于 255")
private String chanName;
/**
*
*/
@TableField(value="lgtd")
@Schema(description="经度")
private BigDecimal lgtd;
/**
*
*/
@TableField(value="lttd")
@Schema(description="纬度")
private BigDecimal lttd;
/**
*
*/
@TableField(value="bnch")
@Schema(description="桩号")
@Size(max = 12,message = "桩号最大长度要小于 12")
private String bnch;
/**
*
*/
@TableField(value="gaor_num")
@Schema(description="闸孔数量")
private Integer gaorNum;
/**
* 123退45 6 9
*/
@TableField(value="waga_type")
@Schema(description="水闸类别1分洪闸2节制闸3排退水闸4引水闸5 挡潮闸6 船闸9其他")
@Size(max = 50,message = "水闸类别1分洪闸2节制闸3排退水闸4引水闸5 挡潮闸6 船闸9其他最大长度要小于 50")
private String wagaType;
/**
*
*/
@TableField(value="gate_tp")
@Schema(description="闸门类型")
@Size(max = 30,message = "闸门类型最大长度要小于 30")
private String gateTp;
/**
* (m)
*/
@TableField(value="gate_size")
@Schema(description="闸门尺寸(m)")
@Size(max = 255,message = "闸门尺寸(m)最大长度要小于 255")
private String gateSize;
/**
* 1,23
*/
@TableField(value="pwr_tp")
@Schema(description="动力类型1手动,2电动3手电两用")
@Size(max = 50,message = "动力类型1手动,2电动3手电两用最大长度要小于 50")
private String pwrTp;
/**
* 12345
*/
@TableField(value="hdgr_tp")
@Schema(description="启闭设备类型1卷扬式2螺杆式3凹轮式4涡轮式5丝杆式")
@Size(max = 50,message = "启闭设备类型1卷扬式2螺杆式3凹轮式4涡轮式5丝杆式最大长度要小于 50")
private String hdgrTp;
/**
* (m)
*/
@TableField(value="in_ele")
@Schema(description="进口高程(m)")
private BigDecimal inEle;
/**
* (m)
*/
@TableField(value="out_ele")
@Schema(description="出口高程(m)")
private BigDecimal outEle;
/**
* (m3/s)
*/
@TableField(value="dsfl")
@Schema(description="设计流量(m3/s)")
private BigDecimal dsfl;
/**
* (m3/s)
*/
@TableField(value="stfl")
@Schema(description="实达流量(m3/s)")
private BigDecimal stfl;
/**
*
*/
@TableField(value="comp_date")
@Schema(description="建成时间")
@Size(max = 10,message = "建成时间最大长度要小于 10")
private String compDate;
/**
*
*/
@TableField(value="updser_date")
@Schema(description="更新或维修时间")
@Size(max = 10,message = "更新或维修时间最大长度要小于 10")
private String updserDate;
/**
*
*/
@TableField(value="updser_rsn")
@Schema(description="更新或维修原因")
@Size(max = 50,message = "更新或维修原因最大长度要小于 50")
private String updserRsn;
/**
*
*/
@TableField(value="updser_invst")
@Schema(description="更新或维修投资")
private BigDecimal updserInvst;
/**
* 12345
*/
@TableField(value="eng_grad")
@Schema(description="工程等别12Ⅱ3Ⅲ4Ⅳ5")
@Size(max = 50,message = "工程等别12Ⅱ3Ⅲ4Ⅳ5最大长度要小于 50")
private String engGrad;
/**
* 123
*/
@TableField(value="run_stat")
@Schema(description="运行情况1在用良好2在用故障3停用")
@Size(max = 50,message = "运行情况1在用良好2在用故障3停用最大长度要小于 50")
private String runStat;
/**
*
*/
@TableField(value="note")
@Schema(description="备注")
@Size(max = 255,message = "备注最大长度要小于 255")
private String note;
/**
*
*/
@TableField(value="start_long")
@Schema(description="起点经度")
private BigDecimal startLong;
/**
*
*/
@TableField(value="start_lat")
@Schema(description="起点纬度")
private BigDecimal startLat;
/**
*
*/
@TableField(value="end_long")
@Schema(description="终点经度")
private BigDecimal endLong;
/**
*
*/
@TableField(value="end_lat")
@Schema(description="终点纬度")
private BigDecimal endLat;
/**
*
*/
@TableField(value="waga_use")
@Schema(description="水闸用途")
@Size(max = 255,message = "水闸用途最大长度要小于 255")
private String wagaUse;
/**
* 1234
*/
@TableField(value="wain_waso_type")
@Schema(description="取水水源类型1水库2湖泊3河流4其他")
@Size(max = 50,message = "取水水源类型1水库2湖泊3河流4其他最大长度要小于 50")
private String wainWasoType;
/**
* (m3/s)
*/
@TableField(value="lock_disc")
@Schema(description="最大过闸流量(m3/s)")
private BigDecimal lockDisc;
/**
* (kw)
*/
@TableField(value="ins_pow")
@Schema(description="装机功率(kw)")
private BigDecimal insPow;
/**
* (mw)
*/
@TableField(value="des_tot_ins_cap")
@Schema(description="设计装机总容量(mw)")
@Size(max = 255,message = "设计装机总容量(mw)最大长度要小于 255")
private String desTotInsCap;
/**
* 012
*/
@TableField(value="eng_stat")
@Schema(description="工程建设情况0未建1在建2已建")
@Size(max = 50,message = "工程建设情况0未建1在建2已建最大长度要小于 50")
private String engStat;
/**
*
*/
@TableField(value="start_date")
@Schema(description="开工时间")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date startDate;
/**
* 1234 5679
*/
@TableField(value="adm_dep")
@Schema(description="归口管理部门1水利部门2电力部门3农业部门4 林业部门5城建部门6航运部门7环保部门9其他部门")
@Size(max = 1,message = "归口管理部门1水利部门2电力部门3农业部门4 林业部门5城建部门6航运部门7环保部门9其他部门最大长度要小于 1")
private String admDep;
/**
*
*/
@TableField(value="coll_date")
@Schema(description="属性采集时间")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date collDate;
/**
*
*/
@TableField(value="upd_date")
@Schema(description="属性更新时间")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date updDate;
/**
* 0 1
*/
@TableField(value="ctrl_type")
@Schema(description="是否可控 0 否 1 是")
private Integer ctrlType;
/**
*
*/
@TableField(value="stcd")
@Schema(description="闸控代码")
@Size(max = 10,message = "闸控代码最大长度要小于 10")
private String stcd;
/**
*
*/
@TableField(value="ctrl_pass")
@Schema(description="独立密码")
@Size(max = 16,message = "独立密码最大长度要小于 16")
@NotBlank(message = "独立密码不能为空")
private String ctrlPass;
/**
* max_hgt
*/
@TableField(value="max_hgt")
@Schema(description="max_hgt")
private BigDecimal maxHgt;
/**
* min_hgt
*/
@TableField(value="min_hgt")
@Schema(description="min_hgt")
private BigDecimal minHgt;
/**
* protocol
*/
@TableField(value="protocol")
@Schema(description="protocol")
@Size(max = 50,message = "protocol最大长度要小于 50")
private String protocol;
/**
* plc12plc
*/
@TableField(value="plc_type")
@Schema(description="plc控制版本1自动令2手动令空非plc")
private Integer plcType;
/**
* sort_order
*/
@TableField(value="sort_order")
@Schema(description="sort_order")
private Integer sortOrder;
/**
* rtu
*/
@TableField(value="camera_num")
@Schema(description="楚禹rtu摄像头数量")
private Integer cameraNum;
@TableField(exist = false)
@Schema(description = "文件集合")
private List<FileAssociations> files;
}

View File

@ -0,0 +1,134 @@
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.gunshi.core.dateformat.DateFormatString;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:56
*/
@Schema(description="闸孔信息表")
@Data
@TableName("public.gate_pore")
public class GatePore implements Serializable {
public final static String thisTableName = "GatePore";
private static final long serialVersionUID = 1L;
/**
* stcd
*/
@TableId(value="stcd", type= IdType.AUTO)
@Schema(description="stcd")
@Size(max = 16,message = "stcd最大长度要小于 16")
@NotBlank(message = "stcd不能为空")
private String stcd;
/**
*
*/
@TableField(value="gate_number")
@Schema(description="第几个闸门")
private Integer gateNumber;
/**
*
*/
@TableField(value="real_aperture")
@Schema(description="实际开度")
private BigDecimal realAperture;
/**
*
*/
@TableField(value="set_aperture")
@Schema(description="设定开度")
private BigDecimal setAperture;
/**
*
*/
@TableField(value="sensor_lever")
@Schema(description="传感器水位")
private BigDecimal sensorLever;
/**
*
*/
@TableField(value="altitude_lever")
@Schema(description="海拔水位")
private BigDecimal altitudeLever;
/**
* ,0,
*/
@TableField(value="remote_signal")
@Schema(description="闸门远控信号,如果是0,则不能通过指令控制")
private Integer remoteSignal;
/**
*
*/
@TableField(value="power_signal")
@Schema(description="闸门电源故障信号")
private Integer powerSignal;
/**
*
*/
@TableField(value="opening_signal")
@Schema(description="闸门开闸中")
private Integer openingSignal;
/**
*
*/
@TableField(value="closeing_signal")
@Schema(description="闸门关闸中")
private Integer closeingSignal;
/**
*
*/
@TableField(value="error_signal")
@Schema(description="闸门故障")
private Integer errorSignal;
/**
*
*/
@TableField(value="opened_signal")
@Schema(description="闸门全开")
private Integer openedSignal;
/**
*
*/
@TableField(value="closed_signal")
@Schema(description="闸门全关")
private Integer closedSignal;
/**
* tm
*/
@TableField(value="tm")
@Schema(description="tm")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date tm;
}

View File

@ -0,0 +1,51 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.vo.GateMonitorDataVo;
import com.gunshi.project.xyt.mapper.AttGateBMapper;
import com.gunshi.project.xyt.model.AttGateB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:06
*/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class AttGateBService extends ServiceImpl<AttGateBMapper, AttGateB>
{
@Autowired
private FileAssociationsService fileService;
public List<AttGateB> queryList() {
List<AttGateB> list = this.list();
if(CollectionUtils.isNotEmpty(list)){
fillAttach(list);
}
return list;
}
private void fillAttach(List<AttGateB> list) {
for (AttGateB record : list) {
record.setFiles(fileService.getFiles(getGroupId(),record.getGateCode()));
}
}
private String getGroupId() {
return "attGateB";
}
public List<GateMonitorDataVo> dataList(String gateCode) {
return this.baseMapper.dataList(gateCode);
}
}

View File

@ -0,0 +1,23 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.mapper.GatePoreMapper;
import com.gunshi.project.xyt.model.GatePore;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* :
* author: xusan
* date: 2024-09-26 10:44:57
*/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class GatePoreService extends ServiceImpl<GatePoreMapper, GatePore>
{
}