断面树中渗压设备按stationCode排序;闸阀监控-闸阀控制列表,开关历史分页查询及导出

master
wany 2024-07-22 11:31:08 +08:00
parent a9b7b8fdcf
commit b1ebf1b9ed
14 changed files with 211 additions and 23 deletions

View File

@ -1,6 +1,9 @@
package com.gunshi.project.xyt.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.so.GateHisPageSo;
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
import com.gunshi.project.xyt.model.GateValveR;
import com.gunshi.project.xyt.service.GateValveRService;
import com.gunshi.project.xyt.validate.markers.Insert;
@ -8,6 +11,7 @@ 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 jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -56,8 +60,14 @@ public class GateValveRController {
@Operation(summary = "分页")
@PostMapping("/page")
public R<List<GateValveR>> page() {
return R.ok(service.page(null,null));
public R<Page<GateStautsVo>> page(@RequestBody GateHisPageSo so) {
return R.ok(service.pageQuery(so));
}
@Operation(summary = "导出")
@PostMapping("/export")
public void export(@RequestBody GateHisPageSo so, HttpServletResponse response) {
service.export(so,response);
}
}

View File

@ -1,6 +1,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.GateValveReal;
import com.gunshi.project.xyt.service.GateValveRealService;
import com.gunshi.project.xyt.validate.markers.Insert;
@ -50,8 +51,8 @@ public class GateValveRealController {
@Operation(summary = "列表")
@PostMapping("/list")
public R<List<GateValveReal>> list() {
return R.ok(service.lambdaQuery().list());
public R<List<GateStautsVo>> list() {
return R.ok(service.gateStatusList());
}
@Operation(summary = "分页")
@ -60,4 +61,6 @@ public class GateValveRealController {
return R.ok(service.page(null,null));
}
}

View File

@ -73,6 +73,11 @@ public class ReservoirWaterController {
return R.ok(reservoirWaterService.monitorData(dataQueryCommonSo));
}
@Post(path = "/data", summary = "闸阀总览-库容曲线")
public R<List<AttResMonitorVo>> data(@RequestBody @Validated DataQueryCommonSo dataQueryCommonSo) {
return R.ok(reservoirWaterService.data(dataQueryCommonSo));
}
@Get(path = "/detail", summary = "监测详细数据(下方表格)")
public R<AttRvMonitorDetailVo> detail(@Schema(name = "stcd") @RequestParam("stcd") String stcd) {
return R.ok(reservoirWaterService.detail(stcd));

View File

@ -0,0 +1,33 @@
package com.gunshi.project.xyt.entity.so;
import com.gunshi.db.dto.DateTimeRangeSo;
import com.gunshi.db.dto.PageSo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* Description:
* Created by wanyan on 2024/3/19
*
* @author wanyan
* @version 1.0
*/
@Data
@Schema(description = "开关历史分页查询对象")
public class GateHisPageSo {
@NotNull(message = "分页参数不能为空")
@Schema(description = "分页参数")
private PageSo pageSo;
@Schema(description="时段")
private DateTimeRangeSo dateTimeRangeSo;
@Schema(description="闸阀ID")
@NotEmpty(message = "闸阀代码不可为空")
private String valveCode;
}

View File

@ -0,0 +1,57 @@
package com.gunshi.project.xyt.entity.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
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.util.Date;
/**
* Description:
* Created by wanyan on 2024/7/19
*
* @author wanyan
* @version 1.0
*/
@Data
public class GateStautsVo {
@Schema(description="闸阀ID")
@ExcelIgnore
private String valveCode;
/**
*
*/
@Schema(description="闸阀名称")
@ExcelProperty({"闸阀名称"})
@ColumnWidth(20)
private String valveName;
@Schema(description="开关状态")
@ExcelProperty({"开关状态"})
@ColumnWidth(20)
private String status;
/**
*
*/
@Schema(description="操作时间")
@ExcelProperty({"操作时间"})
@ColumnWidth(25)
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date tm;
@Schema(description = "监测时间是否离当前时间超过2小时0否 1是")
@ExcelIgnore
private Integer flag = 0;
@Schema(description="是否可手动控制")
@ExcelIgnore
private Boolean manualOperation;
}

View File

@ -1,8 +1,15 @@
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.so.GateHisPageSo;
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
import com.gunshi.project.xyt.model.GateValveR;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* :
@ -12,4 +19,37 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GateValveRMapper extends BaseMapper<GateValveR> {
@Select("""
<script>
select t.valve_code,t.tm,s.valve_name,case when t.status = '100%' then '' when t.status = '0%' then '关' else t.status end as status
from public.gate_valve_r t
left join public.att_gate_valve s on t.valve_code = s.valve_code
where t.valve_code = #{obj.valveCode}
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc nulls last
</script>
""")
Page<GateStautsVo> pageQuery(Page<GateStautsVo> page,@Param("obj") GateHisPageSo so);
@Select("""
<script>
select t.valve_code,t.tm,s.valve_name,case when t.status = '100%' then '' when t.status = '0%' then '关' else t.status end as status
from public.gate_valve_r t
left join public.att_gate_valve s on t.valve_code = s.valve_code
where t.valve_code = #{obj.valveCode}
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc nulls last
</script>
""")
List<GateStautsVo> hisList(@Param("obj") GateHisPageSo so);
}

View File

@ -1,8 +1,12 @@
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
import com.gunshi.project.xyt.model.GateValveReal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* :
@ -12,4 +16,13 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GateValveRealMapper extends BaseMapper<GateValveReal> {
@Select("""
<script>
SELECT t.valve_code,t.valve_name,t.manual_operation,case when s.status = '100%' then '' when s.status = '0%' then '关' else s.status end as status,s.tm
FROM public.att_gate_valve t
LEFT JOIN public.gate_valve_real s ON t.valve_code = s.valve_code
order by s.tm desc nulls last
</script>
""")
List<GateStautsVo> gateStatusList();
}

View File

@ -98,13 +98,6 @@ public class AttCctvBase implements Serializable {
@Schema(description="纬度")
private String lttd;
/**
* 1 2 3 4
*/
@TableField(value="location")
@Schema(description="所在区域1大坝 2取水塔 3溢洪道 4其他")
private Integer location;
/**
* menu_id
*/

View File

@ -46,12 +46,11 @@ public class GateValveR implements Serializable {
private String valveCode;
/**
* 1 250% 3
*
*/
@TableField(value="status")
@Schema(description="开关状态 1全开 250%开 3关")
// @Size(max = 0,message = "开关状态 1全开 250%开 3关最大长度要小于 0")
private Integer status;
@Schema(description="开关状态")
private String status;
/**
*

View File

@ -33,7 +33,6 @@ public class GateValveReal implements Serializable {
*/
@TableId(value="id", type= IdType.AUTO)
@Schema(description="id")
// @Size(max = 0,message = "id最大长度要小于 0")
@NotBlank(message = "id不能为空")
private Long id;
@ -46,19 +45,17 @@ public class GateValveReal implements Serializable {
private String valveCode;
/**
* 1 250% 3
*
*/
@TableField(value="status")
@Schema(description="开关状态 1全开 250%开 3关")
// @Size(max = 0,message = "开关状态 1全开 250%开 3关最大长度要小于 0")
private Integer status;
@Schema(description="开关状态")
private String status;
/**
*
*/
@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;

View File

@ -34,7 +34,7 @@ public class AttDamProfileService extends ServiceImpl<AttDamProfileMapper, AttDa
List<ProfilePressTreeVo> res = MyBeanUtil.collectionCopy(list,ProfilePressTreeVo.class);
for(ProfilePressTreeVo vo : res){
List<OsmoticPressDevice> pressList = pressDeviceAutoDao.list(new QueryWrapper<OsmoticPressDevice>().eq("profile_code", vo.getProfileCode()));
vo.setChildren(pressList.stream().map(OsmoticPressDevice::getStationCode).collect(Collectors.toList()));
vo.setChildren(pressList.stream().map(OsmoticPressDevice::getStationCode).sorted().collect(Collectors.toList()));
}
return res;
}

View File

@ -1,13 +1,18 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.so.GateHisPageSo;
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
import com.gunshi.project.xyt.mapper.GateValveRMapper;
import com.gunshi.project.xyt.model.GateValveR;
import com.gunshi.project.xyt.util.ExcelUtil;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* :
@ -20,6 +25,14 @@ import java.util.Date;
public class GateValveRService extends ServiceImpl<GateValveRMapper, GateValveR>
{
public Page<GateStautsVo> pageQuery(GateHisPageSo so) {
return baseMapper.pageQuery(so.getPageSo().toPage(),so);
}
public void export(GateHisPageSo so, HttpServletResponse response) {
List<GateStautsVo> list = baseMapper.hisList(so);
ExcelUtil.exportExcel(list,"闸阀历史记录",GateStautsVo.class,response,"闸阀历史记录");
}
}

View File

@ -1,13 +1,16 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
import com.gunshi.project.xyt.mapper.GateValveRealMapper;
import com.gunshi.project.xyt.model.GateValveReal;
import com.gunshi.project.xyt.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* :
@ -20,6 +23,15 @@ import java.util.Date;
public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateValveReal>
{
public List<GateStautsVo> gateStatusList() {
List<GateStautsVo> list = baseMapper.gateStatusList();
for(GateStautsVo vo : list){
if(vo.getTm() != null && DateUtil.hoursBetweenDate(vo.getTm(), new Date()) > 2){
vo.setFlag(1);
}
}
return list;
}
}

View File

@ -221,4 +221,17 @@ public class ReservoirWaterService {
public Page<StImgR> imageInfo(PicQuerySo picQuerySo) {
return attResBaseMapper.imageInfo(picQuerySo.getPageSo().toPage(),picQuerySo);
}
public List<AttResMonitorVo> data(DataQueryCommonSo dataQueryCommonSo) {
String stcd = dataQueryCommonSo.getStcd();
//水位数据
List<AttResMonitorVo> rzData = attResBaseMapper.rzData(dataQueryCommonSo);
//获取库容曲线关系,算出库容
List<StZvarlB> zvarl = zvarl(stcd);
if(CollectionUtils.isNotEmpty(zvarl)){
calcTqData(rzData,zvarl);
}
//根据监测时间合并雨量和水位数据
return rzData;
}
}