修改大坝基本数据
parent
2e878773ae
commit
78027b2226
|
|
@ -37,9 +37,7 @@ public class AlarmSetController {
|
||||||
@Operation(summary = "新增")
|
@Operation(summary = "新增")
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
public R<AlarmSet> insert(@Validated(Insert.class) @RequestBody AlarmSet dto) {
|
public R<AlarmSet> insert(@Validated(Insert.class) @RequestBody AlarmSet dto) {
|
||||||
dto.setId(IdWorker.getId());
|
boolean result = service.saveData(dto);
|
||||||
dto.setCreateDate(new Date());
|
|
||||||
boolean result = service.save(dto);
|
|
||||||
return R.ok(result ? dto : null);
|
return R.ok(result ? dto : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,13 @@ public class StZqrlBController {
|
||||||
private StZvarlBService stZvarlBService;
|
private StZvarlBService stZvarlBService;
|
||||||
|
|
||||||
|
|
||||||
@Post(path = "/flowList", summary = "集合")
|
@Post(path = "/flowList", summary = "曲线数据")
|
||||||
public R<List<StZqrlBVo>> flowList(@RequestBody StZqrlBDto obj) {
|
public R<List<StZqrlBVo>> flowList(@RequestBody StZqrlBDto obj) {
|
||||||
return R.ok(stStbprpBService.flowList(obj));
|
return R.ok(stStbprpBService.flowList(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/count/{stcd}")
|
@GetMapping(path = "/count/{stcd}")
|
||||||
|
@Schema(description = "实时数据")
|
||||||
public R<StZqrlBCountVo> count(@Schema(name = "stcd") @PathVariable("stcd") Serializable stcd) {
|
public R<StZqrlBCountVo> count(@Schema(name = "stcd") @PathVariable("stcd") Serializable stcd) {
|
||||||
return R.ok(stStbprpBService.count(stcd));
|
return R.ok(stStbprpBService.count(stcd));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -30,10 +31,9 @@ public class AttDamBase implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@TableId(value="dam_code", type= IdType.AUTO)
|
@TableId(value="dam_code", type= IdType.AUTO)
|
||||||
@Schema(description="主键")
|
@Schema(description="主键")
|
||||||
@Size(max = 32,message = "主键最大长度要小于 32")
|
@Size(max = 32,message = "主键最大长度要小于 32")
|
||||||
|
|
@ -41,90 +41,90 @@ public class AttDamBase implements Serializable {
|
||||||
private String damCode;
|
private String damCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 大坝名称
|
* 大坝名称
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_name")
|
@TableField(value="dam_name")
|
||||||
@Schema(description="大坝名称")
|
@Schema(description="大坝名称")
|
||||||
@Size(max = 30,message = "大坝名称最大长度要小于 30")
|
@Size(max = 30,message = "大坝名称最大长度要小于 30")
|
||||||
private String damName;
|
private String damName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 水库编码
|
* 水库编码
|
||||||
*/
|
*/
|
||||||
@TableField(value="res_code")
|
@TableField(value="res_code")
|
||||||
@Schema(description="水库编码")
|
@Schema(description="水库编码")
|
||||||
@Size(max = 32,message = "水库编码最大长度要小于 32")
|
@Size(max = 32,message = "水库编码最大长度要小于 32")
|
||||||
private String resCode;
|
private String resCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否主坝(0否 1是)
|
* 是否主坝(0否 1是)
|
||||||
*/
|
*/
|
||||||
@TableField(value="is_main")
|
@TableField(value="is_main")
|
||||||
@Schema(description="是否主坝(0否 1是 2拦洪坝)")
|
@Schema(description="是否主坝(0否 1是 2拦洪坝)")
|
||||||
private Integer isMain;
|
private Integer isMain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建筑物型式
|
* 建筑物型式
|
||||||
*/
|
*/
|
||||||
@TableField(value="build_type")
|
@TableField(value="build_type")
|
||||||
@Schema(description="建筑物型式")
|
@Schema(description="建筑物型式")
|
||||||
@Size(max = 30,message = "建筑物型式最大长度要小于 30")
|
@Size(max = 30,message = "建筑物型式最大长度要小于 30")
|
||||||
private String buildType;
|
private String buildType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地基特性
|
* 地基特性
|
||||||
*/
|
*/
|
||||||
@TableField(value="found_character")
|
@TableField(value="found_character")
|
||||||
@Schema(description="地基特性")
|
@Schema(description="地基特性")
|
||||||
@Size(max = 30,message = "地基特性最大长度要小于 30")
|
@Size(max = 30,message = "地基特性最大长度要小于 30")
|
||||||
private String foundCharacter;
|
private String foundCharacter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大坝高(m)
|
* 最大坝高(m)
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_max_heig")
|
@TableField(value="dam_max_heig")
|
||||||
@Schema(description="最大坝高(m)")
|
@Schema(description="最大坝高(m)")
|
||||||
private String damMaxHeig;
|
private String damMaxHeig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 坝顶高程(m)
|
* 坝顶高程(m)
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_top_elev")
|
@TableField(value="dam_top_elev")
|
||||||
@Schema(description="坝顶高程(m)")
|
@Schema(description="坝顶高程(m)")
|
||||||
private String damTopElev;
|
private String damTopElev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 坝顶长度(m)
|
* 坝顶长度(m)
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_top_len")
|
@TableField(value="dam_top_len")
|
||||||
@Schema(description="坝顶长度(m)")
|
@Schema(description="坝顶长度(m)")
|
||||||
private String damTopLen;
|
private String damTopLen;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 坝顶宽度(m)
|
* 坝顶宽度(m)
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_top_wid")
|
@TableField(value="dam_top_wid")
|
||||||
@Schema(description="坝顶宽度(m)")
|
@Schema(description="坝顶宽度(m)")
|
||||||
private String damTopWid;
|
private String damTopWid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 防浪墙顶高程
|
* 防浪墙顶高程
|
||||||
*/
|
*/
|
||||||
@TableField(value="dam_wave_wall")
|
@TableField(value="dam_wave_wall")
|
||||||
@Schema(description="防浪墙顶高程")
|
@Schema(description="防浪墙顶高程")
|
||||||
private String damWaveWall;
|
private String damWaveWall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开工日期
|
* 开工日期
|
||||||
*/
|
*/
|
||||||
@TableField(value="start_date")
|
@TableField(value="start_date")
|
||||||
@Schema(description="开工日期")
|
@Schema(description="开工日期")
|
||||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 竣工日期
|
* 竣工日期
|
||||||
*/
|
*/
|
||||||
@TableField(value="end_date")
|
@TableField(value="end_date")
|
||||||
@Schema(description="竣工日期")
|
@Schema(description="竣工日期")
|
||||||
// @Size(max = 0,message = "竣工日期最大长度要小于 0")
|
// @Size(max = 0,message = "竣工日期最大长度要小于 0")
|
||||||
|
|
@ -132,8 +132,8 @@ public class AttDamBase implements Serializable {
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 蓄水日期
|
* 蓄水日期
|
||||||
*/
|
*/
|
||||||
@TableField(value="storage_date")
|
@TableField(value="storage_date")
|
||||||
@Schema(description="蓄水日期")
|
@Schema(description="蓄水日期")
|
||||||
// @Size(max = 0,message = "蓄水日期最大长度要小于 0")
|
// @Size(max = 0,message = "蓄水日期最大长度要小于 0")
|
||||||
|
|
@ -141,14 +141,24 @@ public class AttDamBase implements Serializable {
|
||||||
private Date storageDate;
|
private Date storageDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField(value="create_time")
|
@TableField(value="create_time")
|
||||||
@Schema(description="创建时间")
|
@Schema(description="创建时间")
|
||||||
// @Size(max = 0,message = "创建时间最大长度要小于 0")
|
// @Size(max = 0,message = "创建时间最大长度要小于 0")
|
||||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableField(value="main_basic_intensity_of_an_earth_quake")
|
||||||
|
@Schema(description = "地震基本烈度")
|
||||||
|
private String mainBasicIntensityOfAnEarthQuake;
|
||||||
|
|
||||||
|
@TableField(value="main_earthquake_acceleration")
|
||||||
|
@Schema(description = "地震峰值加速度")
|
||||||
|
private BigDecimal mainEarthquakeAcceleration;// 主坝-地震峰值加速度
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "文件集合")
|
@Schema(description = "文件集合")
|
||||||
private List<FileAssociations> files;
|
private List<FileAssociations> files;
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,21 @@ public class AttResBuilding implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 水库代码
|
* 水库代码
|
||||||
*/
|
*/
|
||||||
@TableId(value="id", type= IdType.INPUT)
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
// 主坝字段 (prefix: main_)
|
// 主坝字段 (prefix: main_)
|
||||||
private String mainType; // 主坝-坝型
|
private String mainType; // 主坝-坝型
|
||||||
|
private String mainFoundation; //主坝-地基特性
|
||||||
|
private String mainBasicIntensityOfAnEarthQuake; //主坝-地震基本烈度
|
||||||
private BigDecimal mainCrestElevation; // 主坝-坝顶高程(m)
|
private BigDecimal mainCrestElevation; // 主坝-坝顶高程(m)
|
||||||
private BigDecimal mainCrestLength; // 主坝-坝顶长度(m)
|
private BigDecimal mainCrestLength; // 主坝-坝顶长度(m)
|
||||||
private BigDecimal mainCrestWidth; // 主坝-坝顶宽度(m)
|
private BigDecimal mainCrestWidth; // 主坝-坝顶宽度(m)
|
||||||
private BigDecimal mainMaxHeight; // 主坝-最大坝高(m)
|
private BigDecimal mainMaxHeight; // 主坝-最大坝高(m)
|
||||||
|
private BigDecimal mainEarthquakeAcceleration;// 主坝-地震峰值加速度
|
||||||
|
private BigDecimal mainTopOfWaveBarrierElevation;// 主坝-防浪墙顶高程
|
||||||
|
|
||||||
// 副坝字段 (prefix: aux_)
|
// 副坝字段 (prefix: aux_)
|
||||||
private String auxType; // 副坝-坝型
|
private String auxType; // 副坝-坝型
|
||||||
|
|
@ -53,6 +57,8 @@ public class AttResBuilding implements Serializable {
|
||||||
private BigDecimal spillwayCheckFloodDischarge; // 溢洪道-校核洪水下泄流量(m³/s)
|
private BigDecimal spillwayCheckFloodDischarge; // 溢洪道-校核洪水下泄流量(m³/s)
|
||||||
private BigDecimal spillwayDesignFloodDischarge; // 溢洪道-设计洪水下泄流量(m³/s)
|
private BigDecimal spillwayDesignFloodDischarge; // 溢洪道-设计洪水下泄流量(m³/s)
|
||||||
private BigDecimal spillwayScouringDischarge; // 溢洪道-消能防冲下泄流量(m³/s)
|
private BigDecimal spillwayScouringDischarge; // 溢洪道-消能防冲下泄流量(m³/s)
|
||||||
|
private BigDecimal spillwayMaxSingleWidthFlow;//溢洪道-最大单宽流量
|
||||||
|
|
||||||
|
|
||||||
// 灌溉发电洞字段 (prefix: irrigation_)
|
// 灌溉发电洞字段 (prefix: irrigation_)
|
||||||
private String irrigationType; // 灌溉发电洞-型式
|
private String irrigationType; // 灌溉发电洞-型式
|
||||||
|
|
@ -86,4 +92,18 @@ public class AttResBuilding implements Serializable {
|
||||||
// 防汛道路字段 (prefix: road_)
|
// 防汛道路字段 (prefix: road_)
|
||||||
private BigDecimal roadLength; // 防汛道路-防汛路长度(m)
|
private BigDecimal roadLength; // 防汛道路-防汛路长度(m)
|
||||||
private BigDecimal roadWidth; // 防汛道路-路面宽度(m)
|
private BigDecimal roadWidth; // 防汛道路-路面宽度(m)
|
||||||
|
|
||||||
|
//输水建筑物 (prefix: water_conveyance )
|
||||||
|
private BigDecimal waterConveyanceFlow;//输水建筑物-设计流量
|
||||||
|
private String waterConveyanceType;//输水建筑物-进水口形式
|
||||||
|
private String waterConveyanceWaterIntakeType;//输水建筑物-取水方式
|
||||||
|
private String waterConveyanceFoundation;//输水建筑物-地基特性
|
||||||
|
private BigDecimal waterConveyanceInletBottomHigh;//输水建筑物-进口底槛高程
|
||||||
|
private BigDecimal waterConveyanceOrificeSize;//输水建筑物-孔口尺寸
|
||||||
|
private String waterConveyanceGateType;//输水建筑物-闸门型式
|
||||||
|
private Integer waterConveyanceHoistNum;//输水建筑物-启闭机型式容量及数量
|
||||||
|
private String waterConveyanceTunnelType;//输水建筑物-引水隧洞型式
|
||||||
|
private BigDecimal waterConveyanceLength;//输水建筑物-长度
|
||||||
|
private String waterConveyanceLiningType;//输水建筑物-衬砌型式
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.gunshi.project.hsz.service;
|
package com.gunshi.project.hsz.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.hsz.entity.so.AlarmSetPageSo;
|
import com.gunshi.project.hsz.entity.so.AlarmSetPageSo;
|
||||||
|
|
@ -10,6 +11,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -23,4 +26,16 @@ public class AlarmSetService extends ServiceImpl<AlarmSetMapper, AlarmSet> {
|
||||||
Page<AlarmSet> alarmSetPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
Page<AlarmSet> alarmSetPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||||
return alarmSetPage;
|
return alarmSetPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean saveData(AlarmSet dto) {
|
||||||
|
dto.setId(IdWorker.getId());
|
||||||
|
dto.setCreateDate(new Date());
|
||||||
|
LambdaQueryWrapper<AlarmSet> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AlarmSet::getStcd, dto.getStcd());
|
||||||
|
AlarmSet alarmSet = this.baseMapper.selectOne(queryWrapper);
|
||||||
|
if(alarmSet != null){
|
||||||
|
throw new IllegalArgumentException("对不起,该站点的告警设置已存在,请勿重复添加");
|
||||||
|
}
|
||||||
|
return save(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,7 @@ import com.gunshi.project.hsz.entity.vo.*;
|
||||||
import com.gunshi.project.hsz.mapper.OsmoticPressRMapper;
|
import com.gunshi.project.hsz.mapper.OsmoticPressRMapper;
|
||||||
import com.gunshi.project.hsz.mapper.OsmoticShiftRMapper;
|
import com.gunshi.project.hsz.mapper.OsmoticShiftRMapper;
|
||||||
import com.gunshi.project.hsz.mapper.StStbprpBMapper;
|
import com.gunshi.project.hsz.mapper.StStbprpBMapper;
|
||||||
import com.gunshi.project.hsz.model.StRsvrR;
|
import com.gunshi.project.hsz.model.*;
|
||||||
import com.gunshi.project.hsz.model.StStbprpB;
|
|
||||||
import com.gunshi.project.hsz.model.StZqrlB;
|
|
||||||
import com.gunshi.project.hsz.model.StZvarlB;
|
|
||||||
import com.gunshi.project.hsz.util.DateUtil;
|
import com.gunshi.project.hsz.util.DateUtil;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -55,6 +52,9 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StRsvrRService rsvrRService;
|
private StRsvrRService rsvrRService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StRiverRService riverRService;
|
||||||
|
|
||||||
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
||||||
return baseMapper.rainfallStationDetailsList(dto);
|
return baseMapper.rainfallStationDetailsList(dto);
|
||||||
}
|
}
|
||||||
|
|
@ -147,6 +147,12 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||||
.between(StRsvrR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
.between(StRsvrR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
||||||
.orderBy(true, true, StRsvrR::getTm)
|
.orderBy(true, true, StRsvrR::getTm)
|
||||||
.list();
|
.list();
|
||||||
|
//TODO or 获取从河道水位表获取
|
||||||
|
// List<StRiverR> riverList = riverRService.lambdaQuery()
|
||||||
|
// .eq(StRiverR::getStcd, obj.getStcd())
|
||||||
|
// .between(StRiverR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
||||||
|
// .orderBy(true, true, StRiverR::getTm)
|
||||||
|
// .list();
|
||||||
//查询水位-流量关系
|
//查询水位-流量关系
|
||||||
List<StZqrlB> zqrlList = stZqrlBService.list();
|
List<StZqrlB> zqrlList = stZqrlBService.list();
|
||||||
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -81,6 +82,7 @@ public class StZvarlBService extends ServiceImpl<StZvarlBMapper, StZvarlB> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BigDecimal getWByZvarl(List<StZvarlB> zvarlBS, BigDecimal rz) {
|
public BigDecimal getWByZvarl(List<StZvarlB> zvarlBS, BigDecimal rz) {
|
||||||
|
//对数据进行排序
|
||||||
// 1. 参数校验
|
// 1. 参数校验
|
||||||
if (zvarlBS == null || zvarlBS.isEmpty()) {
|
if (zvarlBS == null || zvarlBS.isEmpty()) {
|
||||||
throw new IllegalArgumentException("水位-库容关系列表不能为空");
|
throw new IllegalArgumentException("水位-库容关系列表不能为空");
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -86,6 +87,7 @@ public class WaterCountAnalysisService {
|
||||||
public List<WaterCapacityAnalysisVo> waterCapacityAnalysis(DateRangeSo dateRangeSo){
|
public List<WaterCapacityAnalysisVo> waterCapacityAnalysis(DateRangeSo dateRangeSo){
|
||||||
List<WaterCapacityAnalysisVo> res = new ArrayList<>();
|
List<WaterCapacityAnalysisVo> res = new ArrayList<>();
|
||||||
List<StZvarlB> stZvarlBList = stZvarlBService.list();//获取水位-蓄水量
|
List<StZvarlB> stZvarlBList = stZvarlBService.list();//获取水位-蓄水量
|
||||||
|
stZvarlBList.sort(Comparator.comparing(StZvarlB::getRz));
|
||||||
//查询时间段的
|
//查询时间段的
|
||||||
LambdaQueryWrapper<StRsvrR> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<StRsvrR> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.apply("date_part('hour',tm) = 8") // 获取每天早上八点的数据
|
queryWrapper.apply("date_part('hour',tm) = 8") // 获取每天早上八点的数据
|
||||||
|
|
@ -99,8 +101,7 @@ public class WaterCountAnalysisService {
|
||||||
String rz = stRsvrRS.get(i).getRz();//历史水位
|
String rz = stRsvrRS.get(i).getRz();//历史水位
|
||||||
BigDecimal currentCap = BigDecimal.ZERO;
|
BigDecimal currentCap = BigDecimal.ZERO;
|
||||||
if(rz != null){
|
if(rz != null){
|
||||||
//TODO 这里需要根据公式进行计算
|
currentCap = stZvarlBService.getWByZvarl(stZvarlBList,new BigDecimal(rz));//根据水位计算出库容
|
||||||
currentCap = stZvarlBService.getWFromZvarl(new BigDecimal(rz).setScale(0,RoundingMode.DOWN),null,stZvarlBList);//获取库容
|
|
||||||
vo.setCap(currentCap);
|
vo.setCap(currentCap);
|
||||||
}
|
}
|
||||||
if(i > 0){
|
if(i > 0){
|
||||||
|
|
@ -112,9 +113,8 @@ public class WaterCountAnalysisService {
|
||||||
//计算变化率: (当天 - 上一天) / 上一天 * 100
|
//计算变化率: (当天 - 上一天) / 上一天 * 100
|
||||||
BigDecimal diff = currentCap.subtract(prevCap);
|
BigDecimal diff = currentCap.subtract(prevCap);
|
||||||
BigDecimal rate = diff.divide(prevCap, 4, RoundingMode.HALF_UP)
|
BigDecimal rate = diff.divide(prevCap, 4, RoundingMode.HALF_UP)
|
||||||
.multiply(new BigDecimal(100))
|
.multiply(new BigDecimal(100));
|
||||||
.setScale(2, RoundingMode.DOWN);
|
vo.setRate(rate.setScale(2, RoundingMode.HALF_UP));
|
||||||
vo.setRate(rate);
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
vo.setRate(new BigDecimal(0).setScale(2, RoundingMode.DOWN));
|
vo.setRate(new BigDecimal(0).setScale(2, RoundingMode.DOWN));
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
GROUP BY stcd
|
GROUP BY stcd
|
||||||
) latest ON t.stcd = latest.stcd AND t.tm = latest.max_tm
|
) latest ON t.stcd = latest.stcd AND t.tm = latest.max_tm
|
||||||
<where>
|
<where>
|
||||||
|
|
||||||
<!-- stb.sttp in ('QQ', 'PQ','ZI') 站点类型 站点编码是唯一的,所以不用对类型进行 -->
|
<!-- stb.sttp in ('QQ', 'PQ','ZI') 站点类型 站点编码是唯一的,所以不用对类型进行 -->
|
||||||
and stb.stcd in ('1112','1113','1114') <!-- 站点编码 -->
|
and stb.stcd in ('1112','1113','1114') <!-- 站点编码 -->
|
||||||
</where>
|
</where>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue