parent
dae66822bc
commit
1fd47cae72
|
|
@ -53,28 +53,28 @@ public class AttResBase implements Serializable {
|
|||
*/
|
||||
@TableField(value="low_left_long")
|
||||
@Schema(description="左下角经度")
|
||||
private String lowLeftLong;
|
||||
private BigDecimal lowLeftLong;
|
||||
|
||||
/**
|
||||
* 左下角纬度
|
||||
*/
|
||||
@TableField(value="low_left_lat")
|
||||
@Schema(description="左下角纬度")
|
||||
private String lowLeftLat;
|
||||
private BigDecimal lowLeftLat;
|
||||
|
||||
/**
|
||||
* 右上角经度
|
||||
*/
|
||||
@TableField(value="up_right_long")
|
||||
@Schema(description="右上角经度")
|
||||
private String upRightLong;
|
||||
private BigDecimal upRightLong;
|
||||
|
||||
/**
|
||||
* 右上角纬度
|
||||
*/
|
||||
@TableField(value="up_right_lat")
|
||||
@Schema(description="右上角纬度")
|
||||
private String upRightLat;
|
||||
private BigDecimal upRightLat;
|
||||
|
||||
/**
|
||||
* 水库所在位置
|
||||
|
|
@ -113,14 +113,14 @@ public class AttResBase implements Serializable {
|
|||
*/
|
||||
@TableField(value="wat_shed_area")
|
||||
@Schema(description="坝址控制流域面积")
|
||||
private String watShedArea;
|
||||
private BigDecimal watShedArea;
|
||||
|
||||
/**
|
||||
* 防洪高水位
|
||||
*/
|
||||
@TableField(value="upp_lev_flco")
|
||||
@Schema(description="防洪高水位")
|
||||
private String uppLevFlco;
|
||||
private BigDecimal uppLevFlco;
|
||||
|
||||
/**
|
||||
* 正常蓄水位
|
||||
|
|
@ -128,7 +128,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="norm_wat_lev")
|
||||
@Schema(description="正常蓄水位")
|
||||
// @Size(max = 0,message = "正常蓄水位最大长度要小于 0")
|
||||
private String normWatLev;
|
||||
private BigDecimal normWatLev;
|
||||
|
||||
/**
|
||||
* 正常蓄水位相应水面面积
|
||||
|
|
@ -136,7 +136,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="norm_pool_stag_area")
|
||||
@Schema(description="正常蓄水位相应水面面积")
|
||||
// @Size(max = 0,message = "正常蓄水位相应水面面积最大长度要小于 0")
|
||||
private String normPoolStagArea;
|
||||
private BigDecimal normPoolStagArea;
|
||||
|
||||
/**
|
||||
* 正常蓄水位相应库容
|
||||
|
|
@ -144,7 +144,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="norm_pool_stag_cap")
|
||||
@Schema(description="正常蓄水位相应库容")
|
||||
// @Size(max = 0,message = "正常蓄水位相应库容最大长度要小于 0")
|
||||
private String normPoolStagCap;
|
||||
private BigDecimal normPoolStagCap;
|
||||
|
||||
/**
|
||||
* 主汛期防洪限制水位
|
||||
|
|
@ -159,7 +159,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="fl_low_lim_lev_cap")
|
||||
@Schema(description="防洪限制水位库容")
|
||||
// @Size(max = 0,message = "防洪限制水位库容最大长度要小于 0")
|
||||
private String flLowLimLevCap;
|
||||
private BigDecimal flLowLimLevCap;
|
||||
|
||||
/**
|
||||
* 死水位
|
||||
|
|
@ -167,7 +167,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="dead_lev")
|
||||
@Schema(description="死水位")
|
||||
// @Size(max = 0,message = "死水位最大长度要小于 0")
|
||||
private String deadLev;
|
||||
private BigDecimal deadLev;
|
||||
|
||||
/**
|
||||
* 总库容
|
||||
|
|
@ -175,7 +175,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="tot_cap")
|
||||
@Schema(description="总库容")
|
||||
// @Size(max = 0,message = "总库容最大长度要小于 0")
|
||||
private String totCap;
|
||||
private BigDecimal totCap;
|
||||
|
||||
/**
|
||||
* 兴利库容
|
||||
|
|
@ -183,7 +183,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="ben_res_cap")
|
||||
@Schema(description="兴利库容")
|
||||
// @Size(max = 0,message = "兴利库容最大长度要小于 0")
|
||||
private String benResCap;
|
||||
private BigDecimal benResCap;
|
||||
|
||||
/**
|
||||
* 死库容
|
||||
|
|
@ -191,7 +191,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="dead_cap")
|
||||
@Schema(description="死库容")
|
||||
// @Size(max = 0,message = "死库容最大长度要小于 0")
|
||||
private String deadCap;
|
||||
private BigDecimal deadCap;
|
||||
|
||||
/**
|
||||
* 调洪库容
|
||||
|
|
@ -199,7 +199,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="stor_fl_cap")
|
||||
@Schema(description="调洪库容")
|
||||
// @Size(max = 0,message = "调洪库容最大长度要小于 0")
|
||||
private String storFlCap;
|
||||
private BigDecimal storFlCap;
|
||||
|
||||
/**
|
||||
* 防洪库容
|
||||
|
|
@ -207,7 +207,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="flco_cap")
|
||||
@Schema(description="防洪库容")
|
||||
// @Size(max = 0,message = "防洪库容最大长度要小于 0")
|
||||
private String flcoCap;
|
||||
private BigDecimal flcoCap;
|
||||
|
||||
/**
|
||||
* 工程建设情况 在建 0 已建 1
|
||||
|
|
@ -332,7 +332,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="elev_dat")
|
||||
@Schema(description="高程基准面 基面名称")
|
||||
@Size(max = 256,message = "高程基准面 基面名称最大长度要小于 256")
|
||||
private String elevDat;
|
||||
private BigDecimal elevDat;
|
||||
|
||||
/**
|
||||
* 水库功能 功能名称
|
||||
|
|
@ -372,7 +372,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="crest_elev")
|
||||
@Schema(description="坝顶高程")
|
||||
// @Size(max = 0,message = "坝顶高程最大长度要小于 0")
|
||||
private String crestElev;
|
||||
private BigDecimal crestElev;
|
||||
|
||||
/**
|
||||
* 最大坝高
|
||||
|
|
@ -380,7 +380,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="max_dam_heig")
|
||||
@Schema(description="最大坝高")
|
||||
// @Size(max = 0,message = "最大坝高最大长度要小于 0")
|
||||
private String maxDamHeig;
|
||||
private BigDecimal maxDamHeig;
|
||||
|
||||
/**
|
||||
* 设计洪水位时最大下泄流量
|
||||
|
|
@ -388,7 +388,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="max_des_flood_flow")
|
||||
@Schema(description="设计洪水位时最大下泄流量")
|
||||
// @Size(max = 0,message = "设计洪水位时最大下泄流量最大长度要小于 0")
|
||||
private String maxDesFloodFlow;
|
||||
private BigDecimal maxDesFloodFlow;
|
||||
|
||||
/**
|
||||
* 校核洪水位时最大下泄流量
|
||||
|
|
@ -396,7 +396,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="max_cal_flood_flow")
|
||||
@Schema(description="校核洪水位时最大下泄流量")
|
||||
// @Size(max = 0,message = "校核洪水位时最大下泄流量最大长度要小于 0")
|
||||
private String maxCalFloodFlow;
|
||||
private BigDecimal maxCalFloodFlow;
|
||||
|
||||
/**
|
||||
* 下游河道安全流量
|
||||
|
|
@ -404,7 +404,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="ds_saft_flow")
|
||||
@Schema(description="下游河道安全流量")
|
||||
// @Size(max = 0,message = "下游河道安全流量最大长度要小于 0")
|
||||
private String dsSaftFlow;
|
||||
private BigDecimal dsSaftFlow;
|
||||
|
||||
/**
|
||||
* 工程概况
|
||||
|
|
@ -436,7 +436,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="danger_overview")
|
||||
@Schema(description="病险概况")
|
||||
// @Size(max = 0,message = "病险概况最大长度要小于 0")
|
||||
private String dangerOverview;
|
||||
private BigDecimal dangerOverview;
|
||||
|
||||
/**
|
||||
* 重点水库
|
||||
|
|
@ -452,7 +452,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="lgtd")
|
||||
@Schema(description="经度 (°)")
|
||||
// @Size(max = 0,message = "经度 (°)最大长度要小于 0")
|
||||
private String lgtd;
|
||||
private BigDecimal lgtd;
|
||||
|
||||
/**
|
||||
* 纬度 (°)
|
||||
|
|
@ -460,7 +460,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="lttd")
|
||||
@Schema(description="纬度 (°)")
|
||||
// @Size(max = 0,message = "纬度 (°)最大长度要小于 0")
|
||||
private String lttd;
|
||||
private BigDecimal lttd;
|
||||
|
||||
/**
|
||||
* geojson
|
||||
|
|
@ -468,7 +468,7 @@ public class AttResBase implements Serializable {
|
|||
@TableField(value="geometry")
|
||||
@Schema(description="geojson")
|
||||
// @Size(max = 0,message = "geojson最大长度要小于 0")
|
||||
private String geometry;
|
||||
private BigDecimal geometry;
|
||||
|
||||
/**
|
||||
* 是否有大坝安监数据
|
||||
|
|
@ -519,7 +519,7 @@ public class AttResBase implements Serializable {
|
|||
*/
|
||||
@TableField(value="benefit")
|
||||
@Schema(description="供水效益")
|
||||
private String benefit;
|
||||
private BigDecimal benefit;
|
||||
|
||||
/**
|
||||
* 全流域面积
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.gunshi.project.xyt.service;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.dto.StZqrlBDto;
|
||||
import com.gunshi.project.xyt.entity.so.HomeStStbprpBSo;
|
||||
|
|
@ -10,8 +11,10 @@ import com.gunshi.project.xyt.entity.vo.*;
|
|||
import com.gunshi.project.xyt.mapper.OsmoticPressRMapper;
|
||||
import com.gunshi.project.xyt.mapper.OsmoticShiftRMapper;
|
||||
import com.gunshi.project.xyt.mapper.StStbprpBMapper;
|
||||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.model.StZqrlB;
|
||||
import com.gunshi.project.xyt.model.StZvarlB;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -35,8 +38,7 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
||||
{
|
||||
public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
|
||||
@Resource
|
||||
private OsmoticPressRMapper pressRMapper;
|
||||
|
||||
|
|
@ -46,15 +48,20 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
@Autowired
|
||||
private StZqrlBService stZqrlBService;
|
||||
|
||||
@Autowired
|
||||
private StZvarlBService stZvarlBService;
|
||||
|
||||
@Autowired
|
||||
private StRsvrRService rsvrRService;
|
||||
|
||||
public List<HomeStStbprpBVo> rainfallStationDetailsList(HomeStStbprpBSo dto) {
|
||||
return baseMapper.rainfallStationDetailsList(dto);
|
||||
}
|
||||
|
||||
public List<HomeStStbprpBVo> reservoirStationDetailsList() {
|
||||
return baseMapper.reservoirStationDetailsList();
|
||||
}
|
||||
|
||||
public List<HomeStStbprpBVo> flowStationDetailsList() {
|
||||
return baseMapper.flowStationDetailsList();
|
||||
}
|
||||
|
|
@ -73,20 +80,20 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
List<StStatusVo> imgList = baseMapper.imgList();
|
||||
rainList.addAll(rzList);
|
||||
rainList.addAll(imgList);
|
||||
rainList.stream().collect(Collectors.toMap(obj->obj.getStcd(),obj-> obj,(obj1,obj2)->
|
||||
rainList.stream().collect(Collectors.toMap(obj -> obj.getStcd(), obj -> obj, (obj1, obj2) ->
|
||||
DateUtil.convertStringToDate(obj1.getTm()).after(DateUtil.convertStringToDate(obj2.getTm())) ? obj1 : obj2
|
||||
)).values().stream().collect(Collectors.toList());
|
||||
for(StStatusVo statusVo : rainList){
|
||||
for (StStatusVo statusVo : rainList) {
|
||||
String tm = statusVo.getTm();
|
||||
if(StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm),new Date()) > 2){
|
||||
if (StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 2) {
|
||||
offLineList.add(statusVo);
|
||||
}else {
|
||||
} else {
|
||||
onLineList.add(statusVo);
|
||||
}
|
||||
}
|
||||
//渗压
|
||||
List<OsmoticPressVo> pressList = pressRMapper.listValue();
|
||||
list.addAll(pressList.stream().map(o->{
|
||||
list.addAll(pressList.stream().map(o -> {
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
|
|
@ -94,7 +101,7 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
}).collect(Collectors.toList()));
|
||||
//渗流
|
||||
List<OsmoticPressVo> flowList = pressRMapper.flowListValue();
|
||||
list.addAll(flowList.stream().map(o->{
|
||||
list.addAll(flowList.stream().map(o -> {
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
|
|
@ -102,23 +109,23 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
}).collect(Collectors.toList()));
|
||||
//位移
|
||||
List<OsmoticShiftListVo> shiftList = shiftRMapper.listValue();
|
||||
list.addAll(shiftList.stream().map(o->{
|
||||
list.addAll(shiftList.stream().map(o -> {
|
||||
StStatusVo vo = new StStatusVo();
|
||||
vo.setStnm(o.getStationCode());
|
||||
vo.setTm(o.getTm());
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
for (StStatusVo vo : list){
|
||||
for (StStatusVo vo : list) {
|
||||
String tm = vo.getTm();
|
||||
if(StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm),new Date()) > 24){
|
||||
if (StringUtils.isEmpty(tm) || DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24) {
|
||||
offLineList.add(vo);
|
||||
}else {
|
||||
} else {
|
||||
onLineList.add(vo);
|
||||
}
|
||||
}
|
||||
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()));
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -126,38 +133,70 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
return this.baseMapper.rainList();
|
||||
}
|
||||
|
||||
public List<StZqrlBVo> flowList(StZqrlBDto obj){
|
||||
public List<StZqrlBVo> flowList(StZqrlBDto obj) {
|
||||
/*
|
||||
* 查出时段内的水位列表,按时间升序排,根据水位查水位流量曲线表得到流量
|
||||
* 第一条数据的累计溢洪量设为0,第二条累计溢洪量=上一条累计溢洪量+本条溢洪流量*60分*60秒,以此类推
|
||||
*/
|
||||
// rsvrRService.
|
||||
List<StZqrlBVo> stZqrlBVos = baseMapper.flowList(obj);
|
||||
|
||||
List<StRsvrR> rsvrList = rsvrRService.lambdaQuery()
|
||||
.between(StRsvrR::getTm, obj.getDateSo().getStart(), obj.getDateSo().getEnd())
|
||||
.orderBy(true, true, StRsvrR::getTm)
|
||||
.list();
|
||||
List<StZqrlB> zqrlList = stZqrlBService.list();
|
||||
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));
|
||||
List<StZvarlB> zvarlList = stZvarlBService.list();
|
||||
zvarlList.sort(Comparator.comparing(StZvarlB::getRz));
|
||||
List<StZqrlBVo> ret = new ArrayList<>();
|
||||
|
||||
BigDecimal runningSum = BigDecimal.ZERO;
|
||||
for (int i = 0; i < rsvrList.size(); i++) {
|
||||
StRsvrR rsvr = rsvrList.get(i);
|
||||
BigDecimal rz = new BigDecimal(rsvr.getRz());
|
||||
StZqrlBVo vo = new StZqrlBVo();
|
||||
vo.setStcd(rsvr.getStcd());
|
||||
vo.setTm(rsvr.getTm());
|
||||
vo.setWaterLevel(rz);
|
||||
|
||||
for (StZqrlBVo current : stZqrlBVos) {
|
||||
// 将当前记录的flowNum加到累计和中
|
||||
if (current.getFlowNum() != null) {
|
||||
runningSum = runningSum.add(current.getFlowNum());
|
||||
zqrlList.stream()
|
||||
.filter(zqrl -> zqrl.getZ().equals(new BigDecimal(rsvr.getRz())))
|
||||
.findFirst()
|
||||
.ifPresentOrElse(zqrl -> {
|
||||
vo.setFlowNum(zqrl.getQ());
|
||||
}, () -> vo.setFlowNum(BigDecimal.ZERO));
|
||||
|
||||
zvarlList.stream()
|
||||
.filter(zvarl -> zvarl.getRz().equals(new BigDecimal(rsvr.getRz())))
|
||||
.findFirst()
|
||||
.ifPresentOrElse(zvarl -> {
|
||||
vo.setBoxNum(zvarl.getW());
|
||||
}, () -> vo.setBoxNum(BigDecimal.ZERO));
|
||||
|
||||
if (i == 0) {
|
||||
vo.setQtotal(BigDecimal.ZERO);
|
||||
} else {
|
||||
StZqrlBVo voPrev = ret.get(i - 1);
|
||||
BigDecimal qTotal = vo.getFlowNum().multiply(BigDecimal.valueOf(60 * 60));
|
||||
BigDecimal prevQtotal = voPrev.getQtotal();
|
||||
qTotal = qTotal.add(prevQtotal);
|
||||
vo.setQtotal(qTotal);
|
||||
}
|
||||
// 设置当前记录的qtotal为之前所有flowNum的和
|
||||
current.setQtotal(runningSum);
|
||||
|
||||
ret.add(vo);
|
||||
}
|
||||
return stZqrlBVos;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public StZqrlBCountVo count(Serializable stcd) {
|
||||
StZqrlBCountVo vo = new StZqrlBCountVo();
|
||||
vo.setStcd(stcd.toString());
|
||||
if(Objects.isNull(stcd)){
|
||||
if (Objects.isNull(stcd)) {
|
||||
return vo;
|
||||
}
|
||||
String stcdstr = stcd.toString();
|
||||
|
||||
LambdaQueryWrapper<StZqrlB> qw = new LambdaQueryWrapper();
|
||||
qw.eq(StZqrlB::getStcd,stcdstr).orderByDesc(StZqrlB::getModitime).last(" limit 1");
|
||||
qw.eq(StZqrlB::getStcd, stcdstr).orderByDesc(StZqrlB::getModitime).last(" limit 1");
|
||||
StZqrlB bean = stZqrlBService.getOne(qw);
|
||||
vo.setVal(bean.getQ());
|
||||
vo.setCreateTime(bean.getModitime());
|
||||
|
|
@ -166,21 +205,21 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
LocalDateTime todayStart = LocalDate.now().atStartOfDay();
|
||||
// 获取当前时间 (带时分秒)
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
vo.setCurrDayValSum(sumVal(stcdstr,todayStart,now));
|
||||
vo.setCurrDayValSum(sumVal(stcdstr, todayStart, now));
|
||||
|
||||
// 获取本月1号0点
|
||||
LocalDateTime firstDayOfMonth = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
||||
vo.setCurrMonthSum(sumVal(stcdstr,firstDayOfMonth,now));
|
||||
vo.setCurrMonthSum(sumVal(stcdstr, firstDayOfMonth, now));
|
||||
|
||||
// 获取本年第一天 00:00:00
|
||||
LocalDateTime firstDayOfYear = LocalDate.now().withDayOfYear(1).atStartOfDay();
|
||||
vo.setCurrYearSum(sumVal(stcdstr,firstDayOfYear,now));
|
||||
vo.setCurrYearSum(sumVal(stcdstr, firstDayOfYear, now));
|
||||
|
||||
//年次数
|
||||
vo.setCurrYearCount(countVal(stcdstr,firstDayOfYear,now));
|
||||
vo.setCurrYearCount(countVal(stcdstr, firstDayOfYear, now));
|
||||
|
||||
//本年最大
|
||||
vo.setCurrYearMaxVal(maxVal(stcdstr,firstDayOfYear,now));
|
||||
vo.setCurrYearMaxVal(maxVal(stcdstr, firstDayOfYear, now));
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
|
@ -203,7 +242,7 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
// 获取24小时前的时间
|
||||
LocalDateTime before24 = now.minusHours(24);
|
||||
List<StZqrlB> list = getList(stcdstr, before24, now);
|
||||
if(CollectionUtil.isEmpty(list)){
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return vo;
|
||||
}
|
||||
StZqrlB stZqrlB = list.stream()
|
||||
|
|
@ -245,45 +284,46 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB>
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<StZqrlB> getList(String stcd, LocalDateTime start, LocalDateTime end){
|
||||
private List<StZqrlB> getList(String stcd, LocalDateTime start, LocalDateTime end) {
|
||||
LambdaQueryWrapper<StZqrlB> qw = new LambdaQueryWrapper();
|
||||
qw.eq(StZqrlB::getStcd, stcd);
|
||||
qw.ge(StZqrlB::getModitime,start);
|
||||
qw.le(StZqrlB::getModitime,end);
|
||||
qw.ge(StZqrlB::getModitime, start);
|
||||
qw.le(StZqrlB::getModitime, end);
|
||||
List<StZqrlB> list = stZqrlBService.list(qw);
|
||||
return list;
|
||||
}
|
||||
|
||||
private BigDecimal sumVal(String stcd, LocalDateTime start, LocalDateTime end){
|
||||
private BigDecimal sumVal(String stcd, LocalDateTime start, LocalDateTime end) {
|
||||
LambdaQueryWrapper<StZqrlB> qw = new LambdaQueryWrapper();
|
||||
qw.eq(StZqrlB::getStcd, stcd);
|
||||
qw.ge(StZqrlB::getModitime,start);
|
||||
qw.le(StZqrlB::getModitime,end);
|
||||
qw.ge(StZqrlB::getModitime, start);
|
||||
qw.le(StZqrlB::getModitime, end);
|
||||
List<StZqrlB> list = stZqrlBService.list(qw);
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(StZqrlB::getQ).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private Long countVal(String stcd, LocalDateTime start, LocalDateTime end){
|
||||
|
||||
private Long countVal(String stcd, LocalDateTime start, LocalDateTime end) {
|
||||
LambdaQueryWrapper<StZqrlB> qw = new LambdaQueryWrapper();
|
||||
qw.eq(StZqrlB::getStcd, stcd);
|
||||
qw.ge(StZqrlB::getModitime,start);
|
||||
qw.le(StZqrlB::getModitime,end);
|
||||
qw.ge(StZqrlB::getModitime, start);
|
||||
qw.le(StZqrlB::getModitime, end);
|
||||
List<StZqrlB> list = stZqrlBService.list(qw);
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(StZqrlB::getQ).filter(Objects::nonNull).filter(q -> q.compareTo(BigDecimal.ZERO) > 0).count();
|
||||
}
|
||||
return 0l;
|
||||
}
|
||||
|
||||
private BigDecimal maxVal(String stcd, LocalDateTime start, LocalDateTime end){
|
||||
private BigDecimal maxVal(String stcd, LocalDateTime start, LocalDateTime end) {
|
||||
LambdaQueryWrapper<StZqrlB> qw = new LambdaQueryWrapper();
|
||||
qw.eq(StZqrlB::getStcd, stcd);
|
||||
qw.ge(StZqrlB::getModitime,start);
|
||||
qw.le(StZqrlB::getModitime,end);
|
||||
qw.ge(StZqrlB::getModitime, start);
|
||||
qw.le(StZqrlB::getModitime, end);
|
||||
List<StZqrlB> list = stZqrlBService.list(qw);
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(StZqrlB::getQ).filter(Objects::nonNull).max(Comparator.naturalOrder()).orElse(null);
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue