修改了很多BUG
parent
8779081d62
commit
384e907a8f
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.controller;
|
|||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.hsz.timetask.JcskDataTask;
|
||||
import com.gunshi.project.hsz.timetask.PaDataTask;
|
||||
import com.gunshi.project.hsz.timetask.StWaterDataTask;
|
||||
import com.gunshi.project.hsz.timetask.WarningRuleTask;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
@ -28,6 +29,21 @@ public class DebugController {
|
|||
@Autowired
|
||||
private WarningRuleTask warningRuleTask;
|
||||
|
||||
@Autowired
|
||||
private StWaterDataTask stWaterDataTask;
|
||||
|
||||
@GetMapping("/syncWateData")
|
||||
public String syncWateData() {
|
||||
try {
|
||||
stWaterDataTask.syncFlowToWater();
|
||||
Thread.sleep(1000);
|
||||
stWaterDataTask.syncWaterToReorganize();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
@GetMapping("/syRegressionCaculate")
|
||||
public String syRegressionCaculate(){
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
|
|
@ -246,7 +247,7 @@ public class StWaterRReorganizeController {
|
|||
if(CollectionUtils.isNotEmpty(page.getRecords())){
|
||||
for(StWaterRReorganize dto : page.getRecords()){
|
||||
//水量小计
|
||||
dto.setSumV(dto.getMci1V().add(dto.getMci2V()).add(dto.getEcologyV()));
|
||||
dto.setSumV(dto.getMci1V() == null?BigDecimal.ZERO:dto.getMci1V().add(dto.getMci2V() == null? BigDecimal.ZERO:dto.getMci2V()).add(dto.getEcologyV() == null?BigDecimal.ZERO:dto.getEcologyV()));
|
||||
}
|
||||
}
|
||||
return R.ok(page);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public class SzRegulatoryFrameworkController extends AbstractCommonFileControlle
|
|||
dto.setCreateTime(new Date());
|
||||
dto.setId(IdWorker.getId());
|
||||
dto.setUploadDate(new Date());
|
||||
dto.setUpdateTime(new Date());
|
||||
dto.setMinUpTime(new Date());
|
||||
boolean result = service.save(dto);
|
||||
|
||||
|
||||
|
|
@ -120,7 +122,7 @@ public class SzRegulatoryFrameworkController extends AbstractCommonFileControlle
|
|||
query.le(SzRegulatoryFramework::getReleaseDate, page.getEtm());
|
||||
}
|
||||
|
||||
query.orderByDesc(SzRegulatoryFramework::getUploadDate);
|
||||
query.orderByDesc(SzRegulatoryFramework::getUpdateTime);
|
||||
Page<SzRegulatoryFramework> data = service.page(page.getPageSo().toPage(), query);
|
||||
data.getRecords().forEach(item -> {
|
||||
List<FileAssociations> files = fileService.getFiles(getGroupId(), String.valueOf(item.getId()));
|
||||
|
|
|
|||
|
|
@ -36,4 +36,10 @@ public class TermiteSurveyPageSo {
|
|||
|
||||
@Schema(description = "监测点")
|
||||
private String pileNumber;
|
||||
|
||||
@Schema(description="普查类型(1日常检查排查 2定期普查 3专项调查)")
|
||||
private Integer surveyType;
|
||||
|
||||
@Schema(description="普查方式(1人工排查法 2引诱法 3仪器探测法 4其它)")
|
||||
private Integer surveyWay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,8 +308,7 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
List<String> getRiverStcd();
|
||||
|
||||
@Select("""
|
||||
select t1.stcd,t1.stnm,t1.lgtd lgtd,t1lttd lttd,t1source,t1.sttp,t1.stlc,t1.adcd,t1.esstym, from st_stbprp_b t1
|
||||
join st_stbprp_b_elem t2 on t1.stcd = t2.stcd
|
||||
select t1.stcd,t1.stnm,t1.lgtd lgtd,t1.lttd lttd,t1.source,t1.sttp,t1.stlc,t1.adcd,t1.esstym from st_stbprp_b t1
|
||||
where t1.stcd = #{stcd}
|
||||
""")
|
||||
List<AttResBaseVo> queryYhd(@Param("stcd") String stcd);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.hsz.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.hsz.model.StWaterRReal;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -15,4 +16,9 @@ import java.util.List;
|
|||
public interface StWaterRRealMapper extends BaseMapper<StWaterRReal> {
|
||||
|
||||
List<StWaterRReal> listRelated();
|
||||
|
||||
@Select("""
|
||||
select * from st_water_r_real
|
||||
""")
|
||||
List<StWaterRReal> listNewData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ public interface StbprpBVoMapper {
|
|||
<script>
|
||||
SELECT st.*,COALESCE (r.q, 0 ) v FROM st_stbprp_b st
|
||||
LEFT JOIN st_water_r_real r ON st.stcd = r.stcd
|
||||
WHERE st.sttp = 'PQ' OR st.sttp = 'QQ'
|
||||
join st_stbprp_b_elem t2 on st.stcd = t2.stcd
|
||||
WHERE t2.elem = 'flow'
|
||||
</script>
|
||||
""")
|
||||
List<HomeStStbprpBVo> flowStationDetailsList();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ public interface TermiteSurveyMapper extends BaseMapper<TermiteSurvey> {
|
|||
<if test="obj.year != null and obj.year != ''">
|
||||
m1.year = #{obj.year}
|
||||
</if>
|
||||
<if test="obj.surveyType != null">
|
||||
and m1.survey_type = #{obj.surveyType}
|
||||
</if>
|
||||
<if test="obj.surveyWay != null">
|
||||
and m1.survey_way = #{obj.surveyWay}
|
||||
</if>
|
||||
<if test="obj.isHarm != null and obj.isHarm == 1">
|
||||
and m2.harmNum > 0
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description="制度管理表")
|
||||
@Data
|
||||
@TableName("public.sz_regulatory_framework")
|
||||
@TableName("public.sz_regulatory_framework")
|
||||
public class SzRegulatoryFramework extends CommUpdate implements Serializable {
|
||||
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ public class SzRegulatoryFramework extends CommUpdate implements Serializable {
|
|||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
@TableField(exist = false)
|
||||
@TableField(value = "min_up_time")
|
||||
@Schema(description = "第一次上次时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date minUpTime;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,9 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
|
|||
@Autowired
|
||||
private StFlowRService stFlowRService;
|
||||
|
||||
@Autowired
|
||||
private StWaterRRealService stWaterRRealService;
|
||||
|
||||
public Map<BigDecimal, String> supplyTime(Integer year, Integer month) {
|
||||
Map<BigDecimal, String> result = new HashMap<>();
|
||||
|
||||
|
|
@ -160,9 +163,9 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
|
|||
}
|
||||
|
||||
// 获取当前流量数据
|
||||
List<StFlowR> waterFlowList = stFlowRService.listNewData();
|
||||
List<StWaterRReal> waterFlowList = stWaterRRealService.listNewData();
|
||||
BigDecimal totalFlow = waterFlowList.stream()
|
||||
.map(StFlowR::getQ)
|
||||
.map(StWaterRReal::getQ)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 计算日供水量 (m³/d) 并转换为万m³/d
|
||||
BigDecimal dailySupply = totalFlow.multiply(new BigDecimal(3600 * 24));
|
||||
|
|
|
|||
|
|
@ -114,12 +114,18 @@ public class MentencePlanService extends ServiceImpl<MentencePlanMapper, Menten
|
|||
List<MentencePlan> records = mentencePlanPage.getRecords();
|
||||
for (MentencePlan record : records) {
|
||||
Long id = record.getId();
|
||||
if(record.getCreateId() != null){
|
||||
if(record.getApprovePersonId() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(record.getApprovePersonId()));
|
||||
if(sysUser != null){
|
||||
record.setApprovePersonName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
if(record.getCreateId() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(record.getCreateId()));
|
||||
if(sysUser != null){
|
||||
record.setCreateName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
List<MentencePlanDetail> details = mentencePlanDetailMapper.selectDetail(id);
|
||||
for (MentencePlanDetail detail : details) {
|
||||
if(detail.getChargePersonId() != null){
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ public class RainBasinDivisionService {
|
|||
stPptnDetailsVo.setH24(null);
|
||||
stPptnDetailsVo.setH48(null);
|
||||
stPptnDetailsVo.setDrp(null);
|
||||
stPptnDetailsVo.setToday(null);
|
||||
}
|
||||
}else {
|
||||
stPptnDetailsVo.setStcd(stcd);
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ public class ReservoirWaterService {
|
|||
}
|
||||
|
||||
public List<AttResBaseVo> listV3() {
|
||||
String stcd = "9999";
|
||||
String stcd = "199999";
|
||||
List<AttResBaseVo> voList = attResBaseMapper.queryYhd(stcd);
|
||||
return voList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.hsz.common.mapper.StStbprpBMapper;
|
||||
import com.gunshi.project.hsz.common.model.StRiverR;
|
||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||
import com.gunshi.project.hsz.common.model.vo.OsmoticShiftListVo2;
|
||||
import com.gunshi.project.hsz.entity.dto.StZqrlBDto;
|
||||
|
|
@ -15,9 +16,7 @@ import com.gunshi.project.hsz.mapper.OsmoticShiftRMapper;
|
|||
import com.gunshi.project.hsz.mapper.StWaterFlowMapper;
|
||||
import com.gunshi.project.hsz.mapper.StbprpBVoMapper;
|
||||
import com.gunshi.project.hsz.common.model.StRsvrR;
|
||||
import com.gunshi.project.hsz.model.StWaterFlow;
|
||||
import com.gunshi.project.hsz.model.StZqrlB;
|
||||
import com.gunshi.project.hsz.model.StZvarlB;
|
||||
import com.gunshi.project.hsz.model.*;
|
||||
import com.gunshi.project.hsz.util.DateUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -66,6 +65,12 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
|||
@Autowired
|
||||
private StWaterFlowMapper stWaterFlowMapper;
|
||||
|
||||
@Autowired
|
||||
private AttCctvBaseService attCctvBaseService;
|
||||
|
||||
@Autowired
|
||||
private StZqRSerivce stZqRSerivce;
|
||||
|
||||
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
||||
return stbprpBVoMapper.rainfallStationDetailsList(dto);
|
||||
}
|
||||
|
|
@ -130,7 +135,6 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
|||
vo.setTm(o.getTm());
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
//视频点
|
||||
for (StStatusVo vo : list) {
|
||||
String tm = vo.getTm();
|
||||
if (StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24) {
|
||||
|
|
@ -139,6 +143,16 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
|||
onLineList.add(vo);
|
||||
}
|
||||
}
|
||||
// 视频点
|
||||
List<AttCctvBase> attCctvBases = attCctvBaseService.queryList();
|
||||
List<StStatusVo> cctvVos = new ArrayList<>();
|
||||
cctvVos.addAll( attCctvBases.stream().map(o ->{
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getName());
|
||||
vo.setTm(null);
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
offLineList.addAll(cctvVos);
|
||||
res.setOnline(onLineList.stream().sorted(Comparator.comparing(StStatusVo::getTm, Comparator.nullsFirst(String::compareTo)).reversed()).collect(Collectors.toList()));
|
||||
res.setOffLine(offLineList.stream().sorted(Comparator.comparing(StStatusVo::getTm, Comparator.nullsFirst(String::compareTo)).reversed()).collect(Collectors.toList()));
|
||||
return res;
|
||||
|
|
@ -156,35 +170,36 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
|||
|
||||
//TODO 这里得确定一下,这个新建的泄洪道水位站是不是从水库历史水位表中查
|
||||
//获取水位历史数据
|
||||
List<StRsvrR> rsvrList = rsvrRService.lambdaQuery()
|
||||
.eq(StRsvrR::getStcd, obj.getStcd())
|
||||
.between(StRsvrR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
||||
.orderBy(true, true, StRsvrR::getTm)
|
||||
.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<StRsvrR> rsvrList = rsvrRService.lambdaQuery()
|
||||
// .eq(StRsvrR::getStcd, obj.getStcd())
|
||||
// .between(StRsvrR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
||||
// .orderBy(true, true, StRsvrR::getTm)
|
||||
// .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();
|
||||
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
||||
List<StZqR> zqrlList = stZqRSerivce.lambdaQuery().eq(StZqR::getStcd, obj.getStcd()).list();
|
||||
zqrlList.sort(Comparator.comparing(StZqR::getZ));
|
||||
//获取水位-库容关系
|
||||
List<StZvarlB> zvarlList = stZvarlBService.list();
|
||||
zvarlList.sort(Comparator.comparing(StZvarlB::getRz));
|
||||
List<StZqrlBVo> ret = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < rsvrList.size(); i++) {
|
||||
StRsvrR rsvr = rsvrList.get(i);
|
||||
BigDecimal rz = new BigDecimal(rsvr.getRz());
|
||||
for (int i = 0; i < riverList.size(); i++) {
|
||||
StRiverR rsvr = riverList.get(i);
|
||||
BigDecimal rz = rsvr.getZ();
|
||||
StZqrlBVo vo = new StZqrlBVo();
|
||||
vo.setStcd(rsvr.getStcd());
|
||||
vo.setTm(rsvr.getTm());
|
||||
vo.setWaterLevel(rz);
|
||||
//溢洪流量计算
|
||||
//TODO 这里水位->流量 需要计算公式
|
||||
BigDecimal q = stZqrlBService.getQByZqrl(zqrlList, rz);//根据水位计算流量
|
||||
//BigDecimal q = stZqrlBService.getQByZqrl(zqrlList, rz);//根据水位计算流量
|
||||
BigDecimal q = stZqRSerivce.getQByZqr(zqrlList,rz);
|
||||
vo.setFlowNum(q);//计算溢洪量(非累加值)
|
||||
BigDecimal w = stZvarlBService.getWByZvarl(zvarlList, rz);//根据水位计算库容
|
||||
vo.setBoxNum(w);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ public class StWaterRRealService extends ServiceImpl<StWaterRRealMapper, StWater
|
|||
public List<StWaterRReal> listRelated() {
|
||||
return baseMapper.listRelated();
|
||||
}
|
||||
|
||||
public List<StWaterRReal> listNewData() {
|
||||
return this.baseMapper.listNewData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ public class StWaterRReorganizeService extends ServiceImpl<StWaterRReorganizeMap
|
|||
|
||||
public Map<String, BigDecimal> getWaterSupplyerYeaarOrMonth(Integer type,String date) {
|
||||
Map<String, BigDecimal> res = new HashMap<>();
|
||||
BigDecimal ggTotal = BigDecimal.ZERO;
|
||||
BigDecimal stTotal = BigDecimal.ZERO;
|
||||
BigDecimal ggTotal = null;
|
||||
BigDecimal stTotal = null;
|
||||
List<StWaterRReorganize> rReorganizes;
|
||||
if(type == 0){
|
||||
rReorganizes = baseMapper.getWaterSupplyerYeaarOrMonth(type,date);
|
||||
|
|
@ -313,11 +313,20 @@ public class StWaterRReorganizeService extends ServiceImpl<StWaterRReorganizeMap
|
|||
}
|
||||
|
||||
if(rReorganizes.size() > 0){
|
||||
ggTotal = BigDecimal.ZERO;
|
||||
stTotal = BigDecimal.ZERO;
|
||||
for (StWaterRReorganize o : rReorganizes) {
|
||||
ggTotal = ggTotal.add(o.getMci1V()).add(o.getMci2V());
|
||||
if(o.getMci1V() != null){
|
||||
ggTotal = ggTotal.add(o.getMci1V());
|
||||
}
|
||||
if(o.getMci2V() != null){
|
||||
ggTotal = ggTotal.add(o.getMci2V());
|
||||
}
|
||||
if(o.getEcologyV() != null){
|
||||
stTotal = stTotal.add(o.getEcologyV());
|
||||
}
|
||||
}
|
||||
}
|
||||
res.put("gg",ggTotal);
|
||||
res.put("st",stTotal);
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.gunshi.project.hsz.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.hsz.mapper.StZqRMapper;
|
||||
import com.gunshi.project.hsz.model.StZqR;
|
||||
import com.gunshi.project.hsz.model.StZqrlB;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StZqRSerivce extends ServiceImpl<StZqRMapper, StZqR> {
|
||||
|
||||
|
||||
public BigDecimal getQByZqr(List<StZqR> zvarlList, BigDecimal rz) {
|
||||
// 1. 参数校验
|
||||
if (zvarlList == null || zvarlList.isEmpty()) {
|
||||
throw new IllegalArgumentException("水位-流量关系列表不能为空");
|
||||
}
|
||||
if (rz == null) {
|
||||
throw new IllegalArgumentException("水位值不能为空");
|
||||
}
|
||||
|
||||
// 2. 检查边界情况:如果目标水位低于最低水位或高于最高水位
|
||||
BigDecimal minRz = zvarlList.get(0).getZ();
|
||||
BigDecimal maxRz = zvarlList.get(zvarlList.size() - 1).getZ();
|
||||
if (rz.compareTo(minRz) < 0) {
|
||||
// 低于最低水位,返回0流量
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (rz.compareTo(maxRz) > 0) {
|
||||
// 高于最高水位,返回0流量
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
// 3. 二分查找水位区间
|
||||
int l = 0;
|
||||
int r = zvarlList.size() - 1;
|
||||
|
||||
while (l <= r) {
|
||||
int mid = l + (r - l) / 2;
|
||||
BigDecimal midRz = zvarlList.get(mid).getZ();
|
||||
int compareResult = midRz.compareTo(rz);
|
||||
|
||||
if (compareResult == 0) {
|
||||
// 找到完全匹配的水位,直接返回对应的流量
|
||||
return zvarlList.get(mid).getQ();
|
||||
} else if (compareResult < 0) {
|
||||
l = mid + 1;
|
||||
} else {
|
||||
r = mid - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 此时:
|
||||
* l 指向第一个大于rz的位置
|
||||
* r 指向最后一个小于rz的位置
|
||||
* 即:r为 (x1, y1) - 下限水位和流量
|
||||
* l为 (x2, y2) - 上限水位和流量
|
||||
*/
|
||||
if (l >= zvarlList.size() || r < 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
// 获取前后相邻的两个点
|
||||
StZqR lowerPoint = zvarlList.get(r);
|
||||
StZqR upperPoint = zvarlList.get(l);
|
||||
|
||||
// 使用线性插值计算流量
|
||||
return linearInterpolation(
|
||||
lowerPoint.getZ(), lowerPoint.getQ(),
|
||||
upperPoint.getZ(), upperPoint.getQ(),
|
||||
rz
|
||||
).setScale(3, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线性插值辅助方法(可以复用之前的)
|
||||
* @param x1 已知点1的水位
|
||||
* @param y1 已知点1的流量
|
||||
* @param x2 已知点2的水位
|
||||
* @param y2 已知点2的流量
|
||||
* @param x 目标水位
|
||||
* @return 目标水位对应的流量
|
||||
*/
|
||||
private BigDecimal linearInterpolation(BigDecimal x1, BigDecimal y1,
|
||||
BigDecimal x2, BigDecimal y2,
|
||||
BigDecimal x) {
|
||||
// 使用公式: y = y1 + ( (y2 - y1) / (x2 - x1) ) * (x - x1)
|
||||
|
||||
// 计算斜率: (y2 - y1) / (x2 - x1)
|
||||
BigDecimal slope = y2.subtract(y1)
|
||||
.divide(x2.subtract(x1), 10, RoundingMode.HALF_UP);
|
||||
|
||||
// 计算: slope * (x - x1)
|
||||
BigDecimal xDiff = x.subtract(x1);
|
||||
BigDecimal product = slope.multiply(xDiff);
|
||||
|
||||
// 计算最终结果: y1 + product
|
||||
return y1.add(product);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,10 +72,17 @@ public class WaterCountAnalysisService {
|
|||
map = stWaterRReorganizeService.getWaterSupplyerYeaarOrMonth(byId.YEAR,byId.getPlanDate());
|
||||
}
|
||||
waterAnalysisGGVo.setRealSupply(map.get("gg"));
|
||||
if(waterAnalysisGGVo.getRealSupply() == null){
|
||||
waterAnalysisGGVo.setGapSupply(null);
|
||||
}else{
|
||||
waterAnalysisGGVo.setGapSupply(waterAnalysisGGVo.getRealSupply().subtract(waterAnalysisGGVo.getPlanSupply()));
|
||||
}
|
||||
waterAnalysisSTVo.setRealSupply(map.get("st"));
|
||||
if(waterAnalysisSTVo.getRealSupply() == null){
|
||||
waterAnalysisSTVo.setGapSupply(null);
|
||||
}else{
|
||||
waterAnalysisSTVo.setGapSupply(waterAnalysisSTVo.getRealSupply().subtract(waterAnalysisSTVo.getPlanSupply()));
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ public class WaterDispatchService extends ServiceImpl<WaterDispatchMapper, Water
|
|||
if(byId == null){
|
||||
throw new IllegalArgumentException("抱歉,该调度不存在");
|
||||
}
|
||||
// if(!dto.getExePersonId().equals(byId.getExePersonId())){
|
||||
// throw new IllegalArgumentException("对不起,您没有权限进行反馈");
|
||||
// }
|
||||
if(dto.getIsCompelete() == 0){
|
||||
dto.setExeStatus(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,31 +192,6 @@ public class SysUserLoginLogController {
|
|||
})
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
// vo.setWebList(logs.stream()
|
||||
// .filter(o -> "0".equals(o.getLoginType()))
|
||||
// .collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
||||
// .entrySet().stream()
|
||||
// .map(o -> {
|
||||
// VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||
// dataVo.setCount(o.getValue());
|
||||
// dataVo.setName(o.getKey());
|
||||
// return dataVo;
|
||||
// }).collect(Collectors.toList())
|
||||
// );
|
||||
// vo.setAppList(logs.stream()
|
||||
// .filter(o -> "1".equals(o.getLoginType()))
|
||||
// .collect(Collectors.groupingBy(SysUserLoginLog::getUserName, Collectors.counting()))
|
||||
// .entrySet().stream()
|
||||
// .map(o -> {
|
||||
// VisitCountVo.VisitCountDataVo dataVo = new VisitCountVo.VisitCountDataVo();
|
||||
// dataVo.setCount(o.getValue());
|
||||
// dataVo.setName(o.getKey());
|
||||
// return dataVo;
|
||||
// })
|
||||
// .limit(10)
|
||||
// .collect(Collectors.toList())
|
||||
//
|
||||
// );
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ public class StWaterDataTask {
|
|||
).getSeconds();
|
||||
v = queryData.get(i).getQ().multiply(new BigDecimal(seconds));
|
||||
}
|
||||
if(queryData.size() == 1){
|
||||
v = null;
|
||||
}
|
||||
entity.setV(v);
|
||||
syncData.add(entity);
|
||||
}
|
||||
|
|
@ -108,6 +111,9 @@ public class StWaterDataTask {
|
|||
).getSeconds();
|
||||
v = queryData.get(i).getQ().multiply(new BigDecimal(seconds));
|
||||
}
|
||||
if(queryData.size() == 1){
|
||||
v = null;
|
||||
}
|
||||
entity.setV(v);
|
||||
syncData.add(entity);
|
||||
}
|
||||
|
|
@ -184,17 +190,17 @@ public class StWaterDataTask {
|
|||
reorganize.setTm(hourKey);
|
||||
|
||||
// 获取三个站点的数据(根据实际情况调整站点代码)
|
||||
StWaterR ecologyData = stationData.get("333"); // 生态供水
|
||||
StWaterR mci1Data = stationData.get("444"); // 干渠灌溉1
|
||||
StWaterR mci2Data = stationData.get("555"); // 干渠灌溉2
|
||||
StWaterR ecologyData = stationData.get("1114"); // 生态供水
|
||||
StWaterR mci1Data = stationData.get("1112"); // 干渠灌溉1
|
||||
StWaterR mci2Data = stationData.get("1113"); // 干渠灌溉2
|
||||
|
||||
// 设置生态供水数据
|
||||
if (ecologyData != null) {
|
||||
reorganize.setEcologyQ(ecologyData.getQ());
|
||||
reorganize.setEcologyV(ecologyData.getV());
|
||||
} else {
|
||||
reorganize.setEcologyQ(BigDecimal.ZERO);
|
||||
reorganize.setEcologyV(BigDecimal.ZERO);
|
||||
reorganize.setEcologyQ(null);
|
||||
reorganize.setEcologyV(null);
|
||||
}
|
||||
|
||||
// 设置干渠灌溉1数据
|
||||
|
|
@ -202,8 +208,8 @@ public class StWaterDataTask {
|
|||
reorganize.setMci1Q(mci1Data.getQ());
|
||||
reorganize.setMci1V(mci1Data.getV());
|
||||
} else {
|
||||
reorganize.setMci1Q(BigDecimal.ZERO);
|
||||
reorganize.setMci1V(BigDecimal.ZERO);
|
||||
reorganize.setMci1Q(null);
|
||||
reorganize.setMci1V(null);
|
||||
}
|
||||
|
||||
// 设置干渠灌溉2数据
|
||||
|
|
@ -211,14 +217,14 @@ public class StWaterDataTask {
|
|||
reorganize.setMci2Q(mci2Data.getQ());
|
||||
reorganize.setMci2V(mci2Data.getV());
|
||||
} else {
|
||||
reorganize.setMci2Q(BigDecimal.ZERO);
|
||||
reorganize.setMci2V(BigDecimal.ZERO);
|
||||
reorganize.setMci2Q(null);
|
||||
reorganize.setMci2V(null);
|
||||
}
|
||||
|
||||
// 计算水量小计(三个站点的总和)
|
||||
BigDecimal sumV = reorganize.getEcologyV()
|
||||
.add(reorganize.getMci1V())
|
||||
.add(reorganize.getMci2V());
|
||||
BigDecimal sumV = reorganize.getEcologyV() == null? BigDecimal.ZERO: reorganize.getEcologyV()
|
||||
.add(reorganize.getMci1V() == null? BigDecimal.ZERO: reorganize.getMci1V())
|
||||
.add(reorganize.getMci2V() == null? BigDecimal.ZERO: reorganize.getMci2V());
|
||||
reorganize.setSumV(sumV);
|
||||
|
||||
syncData.add(reorganize);
|
||||
|
|
@ -255,17 +261,17 @@ public class StWaterDataTask {
|
|||
reorganize.setTm(hourKey);
|
||||
|
||||
// 获取三个站点的数据
|
||||
StWaterR ecologyData = stationData.get("333"); // 生态供水
|
||||
StWaterR mci1Data = stationData.get("444"); // 干渠灌溉1
|
||||
StWaterR mci2Data = stationData.get("555"); // 干渠灌溉2
|
||||
StWaterR ecologyData = stationData.get("1114"); // 生态供水
|
||||
StWaterR mci1Data = stationData.get("1112"); // 干渠灌溉1
|
||||
StWaterR mci2Data = stationData.get("1113"); // 干渠灌溉2
|
||||
|
||||
// 设置生态供水数据
|
||||
if (ecologyData != null) {
|
||||
reorganize.setEcologyQ(ecologyData.getQ());
|
||||
reorganize.setEcologyV(ecologyData.getV());
|
||||
} else {
|
||||
reorganize.setEcologyQ(BigDecimal.ZERO);
|
||||
reorganize.setEcologyV(BigDecimal.ZERO);
|
||||
reorganize.setEcologyQ(null);
|
||||
reorganize.setEcologyV(null);
|
||||
}
|
||||
|
||||
// 设置干渠灌溉1数据
|
||||
|
|
@ -273,8 +279,8 @@ public class StWaterDataTask {
|
|||
reorganize.setMci1Q(mci1Data.getQ());
|
||||
reorganize.setMci1V(mci1Data.getV());
|
||||
} else {
|
||||
reorganize.setMci1Q(BigDecimal.ZERO);
|
||||
reorganize.setMci1V(BigDecimal.ZERO);
|
||||
reorganize.setMci1Q(null);
|
||||
reorganize.setMci1V(null);
|
||||
}
|
||||
|
||||
// 设置干渠灌溉2数据
|
||||
|
|
@ -282,14 +288,14 @@ public class StWaterDataTask {
|
|||
reorganize.setMci2Q(mci2Data.getQ());
|
||||
reorganize.setMci2V(mci2Data.getV());
|
||||
} else {
|
||||
reorganize.setMci2Q(BigDecimal.ZERO);
|
||||
reorganize.setMci2V(BigDecimal.ZERO);
|
||||
reorganize.setMci2Q(null);
|
||||
reorganize.setMci2V(null);
|
||||
}
|
||||
|
||||
// 计算水量小计(三个站点的总和)
|
||||
BigDecimal sumV = reorganize.getEcologyV()
|
||||
.add(reorganize.getMci1V())
|
||||
.add(reorganize.getMci2V());
|
||||
BigDecimal sumV = reorganize.getEcologyV() == null? BigDecimal.ZERO: reorganize.getEcologyV()
|
||||
.add(reorganize.getMci1V() == null? BigDecimal.ZERO: reorganize.getMci1V())
|
||||
.add(reorganize.getMci2V() == null? BigDecimal.ZERO: reorganize.getMci2V());
|
||||
reorganize.setSumV(sumV);
|
||||
|
||||
syncData.add(reorganize);
|
||||
|
|
|
|||
Loading…
Reference in New Issue