汛情简报功能

master
李一帆 2025-04-25 17:01:53 +08:00
parent 1589e0da41
commit d7fddda58c
17 changed files with 632 additions and 18 deletions

View File

@ -0,0 +1,39 @@
package com.gunshi.project.xyt.controller;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gunshi.project.xyt.model.ResBriefR;
import com.gunshi.project.xyt.service.ResBriefRService;
import com.ruoyi.common.core.domain.R;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
/**
* @author lyf
* @since 2025-04-25
*/
@Tag(name = "汛情简报接口")
@RestController
@RequestMapping(value="/resBrief")
public class ResBriefController {
@Autowired
private ResBriefRService resBriefRService;
@GetMapping("/getResBriefList")
public R<List<ResBriefR>> getResBriefList(
@RequestParam(value = "startDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate
) {
if (startDate.after(endDate)) {
return R.fail("开始日期不能大于结束日期");
}
return R.ok(resBriefRService.getResBriefList(startDate, endDate));
}
}

View File

@ -0,0 +1,34 @@
package com.gunshi.project.xyt.entity.vo;
import com.gunshi.project.xyt.model.ResBriefR;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author lyf
* @since 2025-04-25
*/
@Data
public class ResBriefVo extends ResBriefR {
@Data
public static class PptnVo {
private String stcd;
private String stnm;
private BigDecimal drp24Sum;
private BigDecimal drp24Max;
private Date maxTm;
}
@Data
public static class RsvrVo {
private String stcd;
private String stnm;
private BigDecimal rz8;
private BigDecimal rzYesterday8;
private BigDecimal w;
}
}

View File

@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
import com.gunshi.project.xyt.entity.so.PicQuerySo;
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
import com.gunshi.project.xyt.entity.vo.AttRvBaseVo;
import com.gunshi.project.xyt.entity.vo.AttRvMonitorVo;
import com.gunshi.project.xyt.entity.vo.*;
import com.gunshi.project.xyt.model.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -232,4 +229,21 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
</script>
""")
Page<AttResMonitorVo> rzDataPage(Page<AttResMonitorVo> page,@Param("obj") PicQuerySo picQuerySo);
@Select("""
select * from public.dam_brief_r dbr
where 1=1
and date=#{todayStr}
order by date desc
limit 1;
""")
ResBriefVo getBrief(String todayStr);
@Select("""
select * from public.dam_brief_r dbr
where 1=1
and date between #{startDate} and #{endDate}
order by date desc
""")
List<ResBriefVo> getBriefList(String startDate, String endDate);
}

View File

@ -37,4 +37,39 @@ public interface StPptnRMapper extends BaseMapper<StPptnR> {
List<Map<String, Object>> getPptnRDataListByTask(@Param("resCode") String resCode, @Param("stcd") String stcd, @Param("tm") String tm);
List<StPptnR> getStcdFirstPptnData();
@Select("""
select DISTINCT ON (r.stcd) r.stcd, r.drp, r.tm
from public.st_stbprp_b_elem b
join public.st_pptn_r r on b.stcd=r.stcd
ORDER BY r.stcd, r.tm DESC
""")
List<StPptnR> getNewestDataOfEachStcd();
/**
* stcd24
*/
@Select("""
select SUM(drp) from public.st_pptn_r
where stcd=#{stcd} and tm >= now() - interval '24 hours'
""")
BigDecimal getdrp24SumByStcd(String stcd);
/**
* stcd24
*/
@Select("""
SELECT *
FROM public.st_pptn_r
WHERE stcd = #{stcd}
AND drp = (
SELECT MAX(drp)
FROM public.st_pptn_r
WHERE stcd = #{stcd}
AND tm >= NOW() - INTERVAL '24 hours'
)
AND tm >= NOW() - INTERVAL '24 hours'
LIMIT 1
""")
StPptnR getdrp24MaxByStcd(String stcd);
}

View File

@ -3,7 +3,9 @@ package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.model.StRsvrR;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
/**
@ -17,4 +19,24 @@ public interface StRsvrRMapper extends BaseMapper<StRsvrR> {
List<StRsvrR> getStcdLastRsvrData();
List<StRsvrR> getStcdFirstRsvrData();
/**
* stcd8rz
*/
@Select("""
select rz from public.st_rsvr_r
where stcd = #{stcd}
and tm = date_trunc('day', now()) + interval '8 hours'
""")
BigDecimal getRz8ByStcd(String stcd);
/**
* stcd8rz
*/
@Select("""
select rz from public.st_rsvr_r
where stcd = #{stcd}
and tm = date_trunc('day', now() - interval '1 day') + interval '8 hours'
""")
BigDecimal getRzYesterday8ByStcd(String stcd);
}

View File

@ -121,4 +121,18 @@ public interface StStbprpBMapper extends BaseMapper<StStbprpB> {
</script>
""")
List<StZqrlBVo> flowList(@Param("obj") StZqrlBDto obj);
@Select("""
select * from public.st_stbprp_b b
join public.st_stbprp_b_elem e
on b.stcd = e.stcd
where e.elem='drp'
""")
List<StStbprpB> getPptnStations();
@Select("""
select * from public.st_stbprp_b b
where b.sttp='RR'
""")
List<StStbprpB> getRsvrStations();
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gunshi.core.dateformat.DateFormatString;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
@ -602,4 +604,8 @@ public class AttResBase implements Serializable {
@TableField(exist = false)
@Schema(description = "文件集合")
private List<FileAssociations> files;
@TableField(value="brief_tpl")
@JsonIgnore
private String briefTpl;
}

View File

@ -14,6 +14,7 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.Getter;
import java.io.Serializable;
import java.math.BigDecimal;
@ -29,6 +30,67 @@ import java.util.Date;
@TableName("public.osmotic_warn_rule")
public class OsmoticWarnRule implements Serializable {
@Getter
public enum Type {
PRESS(1), FLOW(2), SHIFT(3);
private final int type;
Type(int type) {
this.type = type;
}
}
@Getter
public enum Status {
DISABLE(0), ENABLE(1);
private final int status;
Status(int status) {
this.status = status;
}
}
@Getter
public enum Relation {
AND(1), OR(2);
private final int rel;
Relation(int rel) {
this.rel = rel;
}
public static Relation match(int rel) {
for (Relation value : values()) {
if (value.rel == rel) {
return value;
}
}
return null;
}
}
public enum Condition {
GT(">"), GTE(">="), LT("<"), LTE("<="), EQ("="), NE("!=");
private final String condition;
Condition(String condition) {
this.condition = condition;
}
public static Condition match(String condition) {
for (Condition value : values()) {
if (value.condition.equals(condition)) {
return value;
}
}
return null;
}
}
private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,85 @@
package com.gunshi.project.xyt.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gunshi.core.dateformat.DateFormatString;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author lyf
* @since 2025-04-25
*/
@Data
@TableName("public.res_brief_r")
@Slf4j
public class ResBriefR {
@TableId(value="id", type= IdType.AUTO)
private Integer id;
@TableField
private BigDecimal drp24Sum;
@TableField
private String sumStnm;
@TableField
private BigDecimal drp24Max;
@TableField
private String maxStnm;
@TableField
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date maxTm;
@TableField
private BigDecimal rz8;
@TableField
private BigDecimal rzYesterday8;
@TableField
private BigDecimal w;
@TableField
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
private Date date;
@TableField
//设计洪水位
private BigDecimal flLowLimLev;
@TableField(exist = false)
private String brief;
public String getBrief() {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");
SimpleDateFormat sdf2 = new SimpleDateFormat("dd日HH时");
BigDecimal gap;
if (rz8 != null && rzYesterday8 != null) {
gap = rz8.subtract(rzYesterday8);
} else {
gap = null;
}
String dir;
if (gap != null && gap.compareTo(BigDecimal.ZERO) > 0) {
dir = "上涨";
} else if (gap != null && gap.compareTo(BigDecimal.ZERO) < 0) {
dir = "下跌";
} else {
dir = "上涨";
}
return String.format("%s08时过去24小时最大累计降雨量%smm(%s),最大点雨量%smm/h(%s%s)。当前水库水位%sm(汛限水位%sm),较昨日%s%sm库容达%s万m³",
date == null ? "" : sdf1.format(date),
drp24Sum == null ? "" : drp24Sum.setScale(1, RoundingMode.DOWN),
sumStnm == null ? "" : sumStnm,
drp24Max == null ? "" : drp24Max.setScale(1, RoundingMode.DOWN),
maxStnm == null ? "" : maxStnm,
maxTm == null ? "" : sdf2.format(maxTm),
rz8 == null ? "" : rz8.setScale(2, RoundingMode.DOWN),
flLowLimLev == null ? "" : flLowLimLev.setScale(0, RoundingMode.DOWN),
gap == null ? "" :dir,
gap == null ? "" : gap.setScale(2, RoundingMode.DOWN),
w == null ? "" : w.setScale(2, RoundingMode.DOWN)
);
}
}

View File

@ -7,8 +7,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* :
* author: xusan
@ -17,8 +15,7 @@ import java.util.Date;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class AttResBaseService extends ServiceImpl<AttResBaseMapper, AttResBase>
{
public class AttResBaseService extends ServiceImpl<AttResBaseMapper, AttResBase> {
}

View File

@ -16,6 +16,7 @@ import com.gunshi.project.xyt.model.MessageCenter;
import com.gunshi.project.xyt.model.OsmoticWarnR;
import com.gunshi.project.xyt.model.StRsvrR;
import com.gunshi.project.xyt.util.DateUtil;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -171,8 +172,15 @@ public class MessageCenterService extends ServiceImpl<MessageCenterMapper, Messa
}
public List<MessageCenter> listMes(DateTimeRangeSo dateTimeRangeSo) {
Long userId;
try {
userId = SecurityUtils.getUserId();
} catch (Exception e) {
return null;
}
LambdaQueryWrapper<MessageCenter> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(MessageCenter::getReceiveUserId, SecurityUtils.getUserId());
queryWrapper.eq(MessageCenter::getReceiveUserId, userId);
if (ObjectUtils.isNotNull(dateTimeRangeSo) && ObjectUtils.isNotNull(dateTimeRangeSo.getStart())) {
queryWrapper.gt(MessageCenter::getPublishTime, dateTimeRangeSo.getStart());
}

View File

@ -1,17 +1,23 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.xyt.entity.so.WarnRulePageSo;
import com.gunshi.project.xyt.mapper.OsmoticWarnRuleMapper;
import com.gunshi.project.xyt.model.OsmoticWarnRule;
import com.gunshi.project.xyt.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* :
* author: xusan
@ -20,19 +26,161 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, OsmoticWarnRule>
{
public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, OsmoticWarnRule> {
@Autowired
private OsmoticWarnRService warnRService;
public Page<OsmoticWarnRule> queryPage(WarnRulePageSo warnRulePageSo) {
LambdaQueryWrapper<OsmoticWarnRule> queryWrapper = Wrappers.lambdaQuery();
if(warnRulePageSo.getType() != null){
queryWrapper.eq(OsmoticWarnRule::getType,warnRulePageSo.getType());
if (warnRulePageSo.getType() != null) {
queryWrapper.eq(OsmoticWarnRule::getType, warnRulePageSo.getType());
}
if(StringUtils.isNotEmpty(warnRulePageSo.getStationCode())){
queryWrapper.like(OsmoticWarnRule::getStationCode,warnRulePageSo.getStationCode());
if (StringUtils.isNotEmpty(warnRulePageSo.getStationCode())) {
queryWrapper.like(OsmoticWarnRule::getStationCode, warnRulePageSo.getStationCode());
}
queryWrapper.orderByDesc(OsmoticWarnRule::getStatus).orderByDesc(OsmoticWarnRule::getCreateTime);
return this.page(warnRulePageSo.getPageSo().toPage(),queryWrapper);
return this.page(warnRulePageSo.getPageSo().toPage(), queryWrapper);
}
/*
value
*/
public void checkWarn(OsmoticPressR press) {
List<OsmoticWarnRule> rules = lambdaQuery().eq(OsmoticWarnRule::getStationCode, press.getStationCode())
.eq(OsmoticWarnRule::getType, OsmoticWarnRule.Type.PRESS.getType())
.eq(OsmoticWarnRule::getStatus, OsmoticWarnRule.Status.ENABLE.getStatus())
.list();
}
private boolean checkWarn(OsmoticPressR press, OsmoticWarnRule rule) {
BigDecimal valueToCompare = press.getValue();
OsmoticWarnRule.Relation matchRel = OsmoticWarnRule.Relation.match(rule.getCondition());
OsmoticWarnRule.Condition cond1 = OsmoticWarnRule.Condition.match(rule.getConditionOne());
if (cond1 == null) return false;
BigDecimal cond1value = rule.getValueOne();
if (cond1value == null) return false;
boolean cond1Violating = isViolating(valueToCompare, cond1, cond1value);
boolean cond2Violating = false;
if (matchRel != null) {
OsmoticWarnRule.Condition cond2 = OsmoticWarnRule.Condition.match(rule.getConditionTwo());
if (cond2 != null) {
BigDecimal cond2value = rule.getValueTwo();
if (cond2value != null) {
cond2Violating = isViolating(valueToCompare, cond2, cond2value);
}
}
}
boolean shoudWarn = false;
if (matchRel == null) {
if (cond1Violating) {
shoudWarn = true;
}
} else {
if (matchRel == OsmoticWarnRule.Relation.AND) {
if (cond1Violating && cond2Violating) {
shoudWarn = true;
}
} else if (matchRel == OsmoticWarnRule.Relation.OR) {
if (cond1Violating || cond2Violating) {
shoudWarn = true;
}
}
}
if (shoudWarn) {
insertWarn(press.getStationCode(), rule.getId(), press.getValue(), OsmoticWarnRule.Type.PRESS.getType(), rule.getLevel());
return true;
}
return false;
}
private void insertWarn(String stationCode, Long ruleId, BigDecimal value, Integer type, Integer level) {
OsmoticWarnR warn = new OsmoticWarnR();
warn.setId(IdWorker.getId());
warn.setTm(new Date());
warn.setStationCode(stationCode);
warn.setRuleId(ruleId);
warn.setValue(value);
warn.setType(type);
warn.setLevel(level);
warnRService.save(warn);
}
private boolean isViolating(BigDecimal value, OsmoticWarnRule.Condition cond, BigDecimal condValue) {
return switch (cond) {
case GT -> value.compareTo(condValue) > 0;
case GTE -> value.compareTo(condValue) >= 0;
case LT -> value.compareTo(condValue) < 0;
case LTE -> value.compareTo(condValue) <= 0;
case EQ -> value.compareTo(condValue) == 0;
case NE -> value.compareTo(condValue) != 0;
};
}
/*
xyh
*/
public void checkWarn(OsmoticShiftR shift) {
}
/*
q
*/
public void checkWarn(OsmoticFlowR flow) {
List<OsmoticWarnRule> rules = lambdaQuery().eq(OsmoticWarnRule::getStationCode, flow.getStationCode())
.eq(OsmoticWarnRule::getType, OsmoticWarnRule.Type.PRESS.getType())
.eq(OsmoticWarnRule::getStatus, OsmoticWarnRule.Status.ENABLE.getStatus())
.list();
BigDecimal valueToCompare = flow.getQ();
for (OsmoticWarnRule rule : rules) {
OsmoticWarnRule.Relation matchRel = OsmoticWarnRule.Relation.match(rule.getCondition());
OsmoticWarnRule.Condition cond1 = OsmoticWarnRule.Condition.match(rule.getConditionOne());
if (cond1 == null) continue;
BigDecimal cond1value = rule.getValueOne();
if (cond1value == null) continue;
boolean cond1Violating = isViolating(valueToCompare, cond1, cond1value);
boolean cond2Violating = false;
if (matchRel != null) {
OsmoticWarnRule.Condition cond2 = OsmoticWarnRule.Condition.match(rule.getConditionTwo());
if (cond2 != null) {
BigDecimal cond2value = rule.getValueTwo();
if (cond2value != null) {
cond2Violating = isViolating(valueToCompare, cond2, cond2value);
}
}
}
boolean shoudWarn = false;
if (matchRel == null) {
if (cond1Violating) {
shoudWarn = true;
}
} else {
if (matchRel == OsmoticWarnRule.Relation.AND) {
if (cond1Violating && cond2Violating) {
shoudWarn = true;
}
} else if (matchRel == OsmoticWarnRule.Relation.OR) {
if (cond1Violating || cond2Violating) {
shoudWarn = true;
}
}
}
if (shoudWarn) {
insertWarn(flow.getStationCode(), rule.getId(), flow.getQ(), OsmoticWarnRule.Type.PRESS.getType(), rule.getLevel());
}
}
}
}

View File

@ -0,0 +1,103 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gunshi.project.xyt.entity.vo.ResBriefVo;
import com.gunshi.project.xyt.model.AttResBase;
import com.gunshi.project.xyt.model.ResBriefR;
import com.gunshi.project.xyt.model.StPptnR;
import com.gunshi.project.xyt.model.StStbprpB;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
/**
* @author lyf
* @since 2025-04-25
*/
@EnableScheduling
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class ResBriefRService extends com.gunshi.project.xyt.model.ResBriefRAutoDao {
@Autowired
private StPptnRService pptnService;
@Autowired
private StStbprpBService stbprpService;
@Autowired
private StRsvrRService rsvrService;
@Autowired
private StZvarlBService zvarlService;
@Autowired
private AttResBaseService resService;
//每天早上8点30分执行一次
@Scheduled(cron = "0 30 8 * * ?")
public void scheduledScan() {
List<StStbprpB> pptnStations = stbprpService.getPptnStations();
List<ResBriefVo.PptnVo> pptnVos = new ArrayList<>();
pptnStations.forEach(stStbprpB -> {
String stcd = stStbprpB.getStcd();
String stnm = stStbprpB.getStnm();
ResBriefVo.PptnVo pptnVo = new ResBriefVo.PptnVo();
pptnVo.setStcd(stcd);
pptnVo.setStnm(stnm);
pptnVos.add(pptnVo);
BigDecimal drp24 = pptnService.getdrp24SumByStcd(stcd);
StPptnR drpMax = pptnService.getdrp24MaxByStcd(stcd);
pptnVo.setDrp24Sum(drp24);
pptnVo.setDrp24Max(new BigDecimal(drpMax.getDrp()));
pptnVo.setMaxTm(drpMax.getTm());
});
AttResBase res = resService.list().getFirst();
BigDecimal flLowLimLev = res.getFlLowLimLev();
String stcd = res.getStcd();
BigDecimal rz8 = rsvrService.getRz8ByStcd(stcd);
BigDecimal rzYesterday8 = rsvrService.getRzYesterday8ByStcd(stcd);
BigDecimal w = zvarlService.getWFromZvarl(rz8, null);
ResBriefVo vo = new ResBriefVo();
vo.setRz8(rz8);
vo.setRzYesterday8(rzYesterday8);
vo.setW(w);
vo.setFlLowLimLev(flLowLimLev);
ResBriefVo.PptnVo pptnDrp24Sum = pptnVos.stream().max(Comparator.comparing(ResBriefVo.PptnVo::getDrp24Sum)).orElse(null);
vo.setDrp24Sum(pptnDrp24Sum != null ? pptnDrp24Sum.getDrp24Sum() : null);
vo.setSumStnm(pptnDrp24Sum != null ? pptnDrp24Sum.getStnm() : null);
ResBriefVo.PptnVo pptnDrp24Max = pptnVos.stream().max(Comparator.comparing(ResBriefVo.PptnVo::getDrp24Max)).orElse(null);
vo.setDrp24Max(pptnDrp24Max != null ? pptnDrp24Max.getDrp24Max() : null);
vo.setMaxTm(pptnDrp24Max != null ? pptnDrp24Max.getMaxTm() : null);
vo.setMaxStnm(pptnDrp24Max != null ? pptnDrp24Max.getStnm() : null);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
vo.setDate(calendar.getTime());
save(vo);
}
public List<ResBriefR> getResBriefList(Date startDate, Date endDate) {
List<ResBriefR> list = list(new QueryWrapper<ResBriefR>().between("date", startDate, endDate).orderByDesc("date"));
list.forEach(item -> {
item.setBrief(item.getBrief());
});
return list;
}
}

View File

@ -1,5 +1,6 @@
package com.gunshi.project.xyt.service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -38,6 +39,24 @@ public class StPptnRService extends ServiceImpl<StPptnRMapper, StPptnR>
public List<StPptnR> getStcdFirstPptnData() {
return baseMapper.getStcdFirstPptnData();
}
public List<StPptnR> getNewestDataOfEachStcd() {
return baseMapper.getNewestDataOfEachStcd();
}
/**
* stcd24
*/
public BigDecimal getdrp24SumByStcd(String stcd) {
return baseMapper.getdrp24SumByStcd(stcd);
}
/**
* stcd24
*/
public StPptnR getdrp24MaxByStcd(String stcd) {
return baseMapper.getdrp24MaxByStcd(stcd);
}
}

View File

@ -103,9 +103,13 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
ObjectMapper om = new ObjectMapper();
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(shqxjsWarnPath);
log.info("请求气象预警接口:{}", shqxjsWarnPath);
StringEntity stringEntity;
long start = System.currentTimeMillis();
try {
stringEntity = new StringEntity(om.writeValueAsString(apiVo), ContentType.APPLICATION_JSON);
String params = om.writeValueAsString(apiVo);
log.info("请求气象预警接口参数:{}", params);
stringEntity = new StringEntity(params, ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
HttpResponse response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity();
@ -117,6 +121,8 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
} catch (Exception e) {
e.printStackTrace();
}
long end = System.currentTimeMillis();
log.info("查询气象预警耗时:{} 秒", (end - start) / 1000);
return list;
}

View File

@ -1,5 +1,6 @@
package com.gunshi.project.xyt.service;
import java.math.BigDecimal;
import java.util.List;
import org.springframework.stereotype.Service;
@ -29,6 +30,20 @@ public class StRsvrRService extends ServiceImpl<StRsvrRMapper, StRsvrR>
public List<StRsvrR> getStcdFirstRsvrData() {
return baseMapper.getStcdFirstRsvrData();
}
/**
* stcd8rz
*/
public BigDecimal getRz8ByStcd(String stcd) {
return baseMapper.getRz8ByStcd(stcd);
}
/**
* stcd8rz
*/
public BigDecimal getRzYesterday8ByStcd(String stcd) {
return baseMapper.getRzYesterday8ByStcd(stcd);
}
}

View File

@ -345,6 +345,13 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
return null;
}
public List<StStbprpB> getPptnStations() {
return baseMapper.getPptnStations();
}
public List<StStbprpB> getRsvrStations() {
return baseMapper.getRsvrStations();
}
}