parent
2a5305bd2d
commit
dd463a7fff
|
|
@ -38,6 +38,8 @@ public interface JcskGnssRMapper extends BaseMapper<JcskGnssR> {
|
|||
t1.cd,
|
||||
t1.ch,
|
||||
t1.cd_nm as cdnm,
|
||||
t1.lgtd,
|
||||
t1.lttd,
|
||||
t2.de,
|
||||
t2.dn,
|
||||
t2.du,
|
||||
|
|
|
|||
|
|
@ -169,4 +169,11 @@ public class StPptnRReal implements Serializable {
|
|||
@TableField(exist = false)
|
||||
@Schema(description = "站点名称")
|
||||
private String stnm;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal lttd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,8 @@ public class JcskGnessListVo {
|
|||
|
||||
@JsonIgnore
|
||||
private String direction;
|
||||
|
||||
private BigDecimal lgtd;
|
||||
|
||||
private BigDecimal lttd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.ss.common.model.StationNormalVo;
|
||||
import com.gunshi.project.ss.entity.so.AttCctvBasePage;
|
||||
import com.gunshi.project.ss.entity.vo.CctvControlVo;
|
||||
import com.gunshi.project.ss.model.AttCctvBase;
|
||||
|
|
@ -108,12 +109,22 @@ public class AttCctvBaseController {
|
|||
public R<List<AttCctvBase>> list() {
|
||||
List<AttCctvBase> res = service.queryList();
|
||||
//没时间只能默认为离线
|
||||
for (AttCctvBase re : res) {
|
||||
re.setStatus(0);
|
||||
}
|
||||
handlerCCTVStauts(res);
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
public void handlerCCTVStauts(List<AttCctvBase> res ){
|
||||
for (AttCctvBase station : res) {
|
||||
//建议自测的时候别用这个,如果无法访问那个ip的话,可能一个接口得调用十几分钟
|
||||
String preview = service.preview(station.getIndexCode());
|
||||
if(preview == null || com.ruoyi.common.utils.StringUtils.isBlank(preview) ||!preview.startsWith("ws")){
|
||||
station.setStatus(0);
|
||||
}else{
|
||||
station.setStatus(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<AttCctvBase>> page(@RequestBody @Validated AttCctvBasePage page) {
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package com.gunshi.project.ss.controller;
|
|||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.ss.entity.vo.SysDeptTreeVo;
|
||||
import com.gunshi.project.ss.service.DeptempService;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
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.web.bind.annotation.*;
|
||||
|
|
@ -50,4 +52,12 @@ public class DeptempController {
|
|||
return rspData;
|
||||
}
|
||||
|
||||
|
||||
@Schema(description = "部门-员工树")
|
||||
@GetMapping("/tree")
|
||||
public R<SysDeptTreeVo> tree(){
|
||||
SysDeptTreeVo res = deptempService.tree();
|
||||
return R.ok(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -55,6 +55,10 @@ public class RainBasinDivisionController {
|
|||
return R.ok(rainBasinDivisionService.queryStPptnDetailsByStcd(stcd));
|
||||
}
|
||||
|
||||
@Get(path = "/rainBasinDivision/queryStPptnDetails/list",summary = "查看所有测站详细雨量情况")
|
||||
public R<List<StPptnDetailsVo>> queryStPptnDetailsByList(){
|
||||
return R.ok(rainBasinDivisionService.queryStPptnDetailsByStcdList());
|
||||
}
|
||||
@Post(path = "/maxRain",summary = "根据测站编码查询时间段内最大小时雨量")
|
||||
public R<StPptnRReal> maxRain(@RequestBody @Validated StPptnSo stPptnSo){
|
||||
return R.ok(rainBasinDivisionService.maxRain(stPptnSo));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/river/water")
|
||||
@Tag(name = "河道水情")
|
||||
@Deprecated(since = "双石水库没有河道水位站")
|
||||
public class RiverWaterController {
|
||||
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class StationController {
|
|||
@GetMapping("/syList")
|
||||
public R<List<StationNormalVo>> syList(){
|
||||
List<StationNormalVo> tree = jcskSyBService.queryNormalList();
|
||||
handlerStatus(tree);
|
||||
return R.ok(tree);
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +84,7 @@ public class StationController {
|
|||
@GetMapping("/gnssList")
|
||||
public R<List<StationNormalVo>> gnssList(){
|
||||
List<StationNormalVo> tree = jcskGnssBService.queryNormalList();
|
||||
handlerStatus(tree);
|
||||
return R.ok(tree);
|
||||
}
|
||||
|
||||
|
|
@ -90,6 +92,7 @@ public class StationController {
|
|||
@GetMapping("/slList")
|
||||
public R<List<StationNormalVo>> slList(){
|
||||
List<StationNormalVo> tree = jcskSlBService.queryNormalList();
|
||||
handlerStatus(tree);
|
||||
return R.ok(tree);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
//@Document(indexName="ss_object")
|
||||
@Document(indexName="ss_object")
|
||||
public class EsObjectDocument {
|
||||
@Id // 必须添加这个注解
|
||||
private String id; // 字段名可以是id或自定义
|
||||
|
|
|
|||
|
|
@ -43,4 +43,10 @@ public class StFlowRListVo {
|
|||
@TableField(exist = false)
|
||||
private BigDecimal total24V;
|
||||
|
||||
|
||||
private BigDecimal lgtd;
|
||||
|
||||
private BigDecimal lttd;
|
||||
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,10 @@ public class StPptnDetailsVo extends StPptnRReal {
|
|||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date maxDrpTime;
|
||||
|
||||
@Schema(description = "今日雨量")
|
||||
private BigDecimal todayDrp;
|
||||
|
||||
@Schema(description = "24h预测数据")
|
||||
private BigDecimal force24hDrp;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.gunshi.project.ss.entity.vo;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SysDeptTreeVo {
|
||||
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String deptName;
|
||||
|
||||
List<SysDeptTreeVo> children;
|
||||
|
||||
private List<SysUser> sysUsers;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.gunshi.project.ss.entity.vo;
|
||||
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
public class SysUserVo {
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
/** 用户账号 */
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
}
|
||||
|
|
@ -118,8 +118,9 @@ public interface RealRainMapper {
|
|||
|
||||
@Select("""
|
||||
<script>
|
||||
SELECT * FROM "public".st_pptn_r_real
|
||||
WHERE stcd = #{stcd}
|
||||
SELECT t1.*,t2.stnm,t2.lgtd,t2.lttd FROM "public".st_pptn_r_real t1
|
||||
left join "public".st_stbprp_b t2 on t1.stcd = t2.stcd
|
||||
WHERE t1.stcd = #{stcd}
|
||||
ORDER BY tm DESC
|
||||
limit 1
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.gunshi.project.ss.service;
|
||||
|
||||
import com.gunshi.project.ss.entity.vo.SysDeptTreeVo;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
|
|
@ -8,7 +9,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: APP版本记录
|
||||
|
|
@ -34,6 +37,54 @@ public class DeptempService{
|
|||
return deptMapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
public SysDeptTreeVo tree() {
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDelFlag("0");
|
||||
List<SysDept> allDepts = selectDeptList(dept);
|
||||
SysUser user = new SysUser();
|
||||
user.setDelFlag("0");
|
||||
List<SysUser> allUsers = selectUserList(user);
|
||||
allUsers = allUsers.stream().filter(o -> o.getDeptId() != null).collect(Collectors.toList());
|
||||
SysDeptTreeVo root = getRoot(allDepts, allUsers);
|
||||
return root;
|
||||
}
|
||||
|
||||
public SysDeptTreeVo getRoot(List<SysDept> allDepts,List<SysUser> allUsers){
|
||||
SysDeptTreeVo root = null;
|
||||
for (SysDept allDept : allDepts) {
|
||||
if(allDept.getParentId().toString().equals("0")){
|
||||
root = new SysDeptTreeVo();
|
||||
root.setDeptName(allDept.getDeptName());
|
||||
root.setDeptId(allDept.getDeptId());
|
||||
List<SysDeptTreeVo> children = getChildren(allDepts,allUsers, root.getDeptId());
|
||||
root.setChildren(children);
|
||||
List<SysUser> users = getUsers(root.getDeptId(), allUsers);
|
||||
root.setSysUsers(users);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
public List<SysDeptTreeVo> getChildren(List<SysDept> allDepts,List<SysUser> allUsers,Long parentId){
|
||||
List<SysDeptTreeVo> children = new ArrayList<>();
|
||||
for (SysDept allDept : allDepts) {
|
||||
if(allDept.getParentId().toString().equals(parentId.toString())){
|
||||
SysDeptTreeVo child = new SysDeptTreeVo();
|
||||
child.setDeptName(allDept.getDeptName());
|
||||
child.setDeptId(allDept.getDeptId());
|
||||
child.setChildren(getChildren(allDepts,allUsers,allDept.getDeptId()));
|
||||
child.setSysUsers(getUsers(child.getDeptId(),allUsers));
|
||||
children.add(child);
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
public List<SysUser> getUsers(Long deptId,List<SysUser> allUsers){
|
||||
List<SysUser> collect = allUsers.stream().filter(u -> u.getDeptId().equals(deptId)).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ package com.gunshi.project.ss.service;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.gunshi.project.ss.entity.so.StPptnSo;
|
||||
import com.gunshi.project.ss.entity.vo.CartogramVo;
|
||||
import com.gunshi.project.ss.entity.vo.StPptnDetailsVo;
|
||||
import com.gunshi.project.ss.entity.vo.StPptnVo;
|
||||
import com.gunshi.project.ss.entity.so.WeatherSo;
|
||||
import com.gunshi.project.ss.entity.vo.*;
|
||||
import com.gunshi.project.ss.mapper.RealRainMapper;
|
||||
import com.gunshi.project.ss.common.mapper.StPptnRMapper;
|
||||
import com.gunshi.project.ss.model.StPptnRD;
|
||||
|
|
@ -240,21 +239,13 @@ public class RainBasinDivisionService {
|
|||
}
|
||||
Date date = new Date();
|
||||
|
||||
// //48小时降雨量
|
||||
// BigDecimal h48 = stStbprpBMapper.queryStPptn48HByStcd(stcd);
|
||||
// if (h48 == null) {
|
||||
// stPptnDetailsVo.setH48(value0);
|
||||
// } else {
|
||||
// stPptnDetailsVo.setH48(h48);
|
||||
// }
|
||||
//
|
||||
// //今日雨量
|
||||
// BigDecimal todayDrp = queryTodayDrpByStcdAndTime(stcd, date);
|
||||
// if (todayDrp == null) {
|
||||
// stPptnDetailsVo.setTodayDrp(value0);
|
||||
// } else {
|
||||
// stPptnDetailsVo.setTodayDrp(todayDrp);
|
||||
// }
|
||||
BigDecimal todayDrp = queryTodayDrpByStcdAndTime(stcd, date);
|
||||
if (todayDrp == null) {
|
||||
stPptnDetailsVo.setTodayDrp(null);
|
||||
} else {
|
||||
stPptnDetailsVo.setTodayDrp(todayDrp);
|
||||
}
|
||||
|
||||
//昨日雨量
|
||||
BigDecimal yesterdayDrp = queryYesterdayDrpByStcdAndTime(stcd, date);
|
||||
|
|
@ -300,6 +291,196 @@ public class RainBasinDivisionService {
|
|||
return stPptnDetailsVo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Autowired
|
||||
private ForecastService forecastService;
|
||||
|
||||
public List<StPptnDetailsVo> queryStPptnDetailsByStcdList() {
|
||||
List<StStatusVo> stStatusVos = stStbprpBService.rainList();
|
||||
List<StPptnDetailsVo> res = new ArrayList<>();
|
||||
for (StStatusVo stStatusVo : stStatusVos) {
|
||||
String stcd = stStatusVo.getStcd();
|
||||
StPptnRReal stPptnRReal = realRainMapper.queryPptnByStcd(stcd);
|
||||
|
||||
StPptnDetailsVo stPptnDetailsVo = new StPptnDetailsVo();
|
||||
if (stPptnRReal != null){
|
||||
BeanUtil.copyProperties(stPptnRReal, stPptnDetailsVo);
|
||||
Date tm = stPptnRReal.getTm();
|
||||
LocalDateTime nowTime = LocalDateTime.now();
|
||||
LocalDateTime latestTime = LocalDateTime.ofInstant(tm.toInstant(), ZoneId.systemDefault());
|
||||
|
||||
boolean isToday = latestTime.toLocalDate().equals(nowTime.toLocalDate());
|
||||
|
||||
if(!isToday){
|
||||
stPptnDetailsVo.setH1(null);
|
||||
stPptnDetailsVo.setH3(null);
|
||||
stPptnDetailsVo.setH6(null);
|
||||
stPptnDetailsVo.setH12(null);
|
||||
stPptnDetailsVo.setH24(null);
|
||||
stPptnDetailsVo.setH48(null);
|
||||
stPptnDetailsVo.setDrp(null);
|
||||
stPptnDetailsVo.setToday(null);
|
||||
}
|
||||
}else {
|
||||
stPptnDetailsVo.setStcd(stcd);
|
||||
}
|
||||
Date date = new Date();
|
||||
|
||||
// //今日雨量
|
||||
BigDecimal todayDrp = queryTodayDrpByStcdAndTime(stcd, date);
|
||||
if (todayDrp == null) {
|
||||
stPptnDetailsVo.setTodayDrp(null);
|
||||
} else {
|
||||
stPptnDetailsVo.setTodayDrp(todayDrp);
|
||||
}
|
||||
|
||||
//昨日雨量
|
||||
BigDecimal yesterdayDrp = queryYesterdayDrpByStcdAndTime(stcd, date);
|
||||
if (yesterdayDrp == null) {
|
||||
stPptnDetailsVo.setYesterdayDrp(null);
|
||||
} else {
|
||||
stPptnDetailsVo.setYesterdayDrp(yesterdayDrp);
|
||||
}
|
||||
|
||||
//本月降雨量
|
||||
BigDecimal monthDay = queryMonthDrpByStcdAndTime(stcd, date);
|
||||
if (monthDay == null) {
|
||||
stPptnDetailsVo.setMonthDrp(null);
|
||||
} else {
|
||||
stPptnDetailsVo.setMonthDrp(monthDay);
|
||||
}
|
||||
|
||||
//本年降雨量
|
||||
BigDecimal yearDrp = queryYearDrpByStcdAndTime(stcd, date);
|
||||
if (yearDrp == null) {
|
||||
stPptnDetailsVo.setYearDrp(null);
|
||||
} else {
|
||||
stPptnDetailsVo.setYearDrp(yearDrp);
|
||||
}
|
||||
|
||||
//本年天数
|
||||
Long yearDay = countYearDay(date);
|
||||
stPptnDetailsVo.setYearDay(yearDay);
|
||||
|
||||
Map<String, Object> map = queryYearDrpDayAndMaxDrpAndMaxDrpTimeByStcdAndTime(stcd, date);
|
||||
|
||||
//本年降雨天数
|
||||
Long yearDrpDay = (Long) map.get("count");
|
||||
stPptnDetailsVo.setYearDrpDay(yearDrpDay);
|
||||
|
||||
//本年最大日雨量
|
||||
BigDecimal maxDrp = (BigDecimal) map.get("maxDrp");
|
||||
stPptnDetailsVo.setMaxDrp(maxDrp);
|
||||
|
||||
//本年最大日雨量时间
|
||||
Date maxDrpTime =(Date) map.get("maxDrpTime");
|
||||
stPptnDetailsVo.setMaxDrpTime(maxDrpTime);
|
||||
|
||||
//降雨预测数据
|
||||
WeatherSo weatherSo = new WeatherSo();
|
||||
String tm;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int hour = now.getHour();
|
||||
if(hour < 8){
|
||||
// 使用昨日20时的tm
|
||||
LocalDateTime yesterday20 = now.minusDays(1).withHour(20).withMinute(0).withSecond(0);
|
||||
tm = formatTm(yesterday20);
|
||||
}else if(hour > 8 && hour < 20){
|
||||
// 使用今日08时的tm
|
||||
LocalDateTime today08 = now.withHour(8).withMinute(0).withSecond(0);
|
||||
tm = formatTm(today08);
|
||||
}else{
|
||||
// 使用今日20时的tm
|
||||
LocalDateTime today20 = now.withHour(20).withMinute(0).withSecond(0);
|
||||
tm = formatTm(today20);
|
||||
}
|
||||
weatherSo.setTm(tm);
|
||||
try {
|
||||
List<ForeRainVo> fore = forecastService.fore(weatherSo);
|
||||
if(fore != null && !fore.isEmpty()){
|
||||
fore.stream().forEach(o ->{
|
||||
if(o.getStcd().equals(stcd)){
|
||||
Double h24 = o.getH24();
|
||||
stPptnDetailsVo.setForce24hDrp(h24 == null?null:new BigDecimal(h24.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//接口不知道是好的还是坏的,反正这个接口坏了别影响其它的接口
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
res.add(stPptnDetailsVo);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间为YYYYMMDDHH格式
|
||||
*/
|
||||
private String formatTm(LocalDateTime dateTime) {
|
||||
return String.format("%04d%02d%02d%02d",
|
||||
dateTime.getYear(),
|
||||
dateTime.getMonthValue(),
|
||||
dateTime.getDayOfMonth(),
|
||||
dateTime.getHour());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测站编码和时间查看今日降雨量
|
||||
*
|
||||
* @param stcd 测站编码
|
||||
* @param time 当前时间
|
||||
* @return 今日降雨量
|
||||
*/
|
||||
private BigDecimal queryTodayDrpByStcdAndTime(String stcd, Date time) {
|
||||
LocalDateTime now = LocalDateTime.ofInstant(time.toInstant(), ZoneId.systemDefault());
|
||||
LocalDateTime startTime;
|
||||
LocalDateTime endTime;
|
||||
|
||||
// 如果当前时间大于等于8:00,则从今日8:00开始计算
|
||||
if (now.getHour() >= 8) {
|
||||
startTime = LocalDateTime.of(
|
||||
now.getYear(),
|
||||
now.getMonthValue(),
|
||||
now.getDayOfMonth(),
|
||||
8,
|
||||
0,
|
||||
0
|
||||
);
|
||||
endTime = now;
|
||||
} else {
|
||||
// 如果当前时间小于8:00,则从昨日8:00开始计算到今日8:00
|
||||
// 因为今日8:00之前的降雨量实际上属于昨日的统计
|
||||
LocalDateTime yesterday = now.minusDays(1);
|
||||
startTime = LocalDateTime.of(
|
||||
yesterday.getYear(),
|
||||
yesterday.getMonthValue(),
|
||||
yesterday.getDayOfMonth(),
|
||||
8,
|
||||
0,
|
||||
0
|
||||
);
|
||||
endTime = LocalDateTime.of(
|
||||
now.getYear(),
|
||||
now.getMonthValue(),
|
||||
now.getDayOfMonth(),
|
||||
8,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
return stPptnRMapper.queryStPptnTimeQuantumByStcdAndTime(
|
||||
stcd,
|
||||
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测站编码和时间查看昨日降雨量
|
||||
*
|
||||
|
|
@ -505,4 +686,6 @@ public class RainBasinDivisionService {
|
|||
public StPptnRReal queryStPptnRealByStcd(String stcd) {
|
||||
return realRainMapper.queryPptnByStcd(stcd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ public class StFlowRService extends ServiceImpl<StFlowRMapper, StFlowR> {
|
|||
StFlowRListVo stFlowR = new StFlowRListVo();
|
||||
stFlowR.setStcd(flowStation.getStcd());
|
||||
stFlowR.setStnm(flowStation.getStnm());
|
||||
|
||||
stFlowR.setLgtd(flowStation.getLgtd());
|
||||
stFlowR.setLttd(flowStation.getLttd());
|
||||
// 获取24小时内的所有流量数据
|
||||
List<StFlowR> list = lambdaQuery()
|
||||
.eq(StFlowR::getStcd, flowStation.getStcd())
|
||||
|
|
@ -90,7 +91,14 @@ public class StFlowRService extends ServiceImpl<StFlowRMapper, StFlowR> {
|
|||
StFlowR latestData = list.get(list.size() - 1);
|
||||
stFlowR.setTm(latestData.getTm());
|
||||
stFlowR.setQ(latestData.getQ());
|
||||
|
||||
//判断状态
|
||||
LocalDateTime tm = latestData.getTm();
|
||||
Duration between = Duration.between(tm, now);
|
||||
if(between.toHours() > 24){
|
||||
stFlowR.setStatus(0);
|
||||
}else{
|
||||
stFlowR.setStatus(1);
|
||||
}
|
||||
// 计算统计值
|
||||
calculateTotalVolume(list, stFlowR);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue