同步檀树岗预警规则配置定时任务
parent
f4d59ed1e0
commit
0d1080affa
|
|
@ -58,7 +58,7 @@ public class RiceSupportBalance implements Serializable {
|
||||||
* 状态:0-计算中,1-已完成
|
* 状态:0-计算中,1-已完成
|
||||||
*/
|
*/
|
||||||
@TableField(value = "status")
|
@TableField(value = "status")
|
||||||
@Schema(description = "状态:0-计算中,1-已完成")
|
@Schema(description = "状态:0-计算中,1-已完成 2-计算失败")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,9 +71,9 @@ public class RiceSupportBalance implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 总计划供水量(万m³)
|
* 总计划供水量(万m³)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "total_support")
|
@TableField(value = "total_plan")
|
||||||
@Schema(description = "总计划供水量(万m³)")
|
@Schema(description = "总计划供水量(万m³)")
|
||||||
private BigDecimal totalSupport;
|
private BigDecimal totalPlan;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 制定时间
|
* 制定时间
|
||||||
|
|
@ -104,7 +104,13 @@ public class RiceSupportBalance implements Serializable {
|
||||||
@Schema(description = "来水预测主键")
|
@Schema(description = "来水预测主键")
|
||||||
private Long icWaterId;
|
private Long icWaterId;
|
||||||
|
|
||||||
|
@TableField(value = "fail_reason")
|
||||||
|
@Schema(description = "计算失败原因")
|
||||||
|
private String failReason;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<RiceSupportBalanceDetail> details;
|
private List<RiceSupportBalanceDetail> details;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -9,9 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.hsz.common.model.JcskGnssR;
|
import com.gunshi.project.hsz.common.model.JcskGnssR;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSlR;
|
import com.gunshi.project.hsz.common.model.JcskSlR;
|
||||||
import com.gunshi.project.hsz.common.model.JcskSyR;
|
import com.gunshi.project.hsz.common.model.JcskSyR;
|
||||||
|
import com.gunshi.project.hsz.common.util.LocalDateTimeConverter;
|
||||||
import com.gunshi.project.hsz.entity.so.WarnRulePageSo;
|
import com.gunshi.project.hsz.entity.so.WarnRulePageSo;
|
||||||
import com.gunshi.project.hsz.mapper.OsmoticWarnRuleMapper;
|
import com.gunshi.project.hsz.mapper.OsmoticWarnRuleMapper;
|
||||||
import com.gunshi.project.hsz.model.*;
|
import com.gunshi.project.hsz.model.OsmoticWarnR;
|
||||||
|
import com.gunshi.project.hsz.model.OsmoticWarnRule;
|
||||||
|
import com.gunshi.project.hsz.service.OsmoticWarnRService;
|
||||||
import com.gunshi.project.hsz.util.DateTransforUtil;
|
import com.gunshi.project.hsz.util.DateTransforUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -103,7 +106,7 @@ public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, O
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shoudWarn) {
|
if (shoudWarn) {
|
||||||
insertWarn(stationCode, rule.getId(), flow.getSpprwl(), OsmoticWarnRule.Type.PRESS.getType(), rule.getLevel(),DateTransforUtil.transforLocalDateTimeToDate(flow.getMstm()),rule.getResolveSuggest());
|
insertWarn(stationCode, rule.getId(), flow.getSpprwl(), OsmoticWarnRule.Type.PRESS.getType(), rule.getLevel(),LocalDateTimeConverter.toDate(flow.getMstm()),rule.getResolveSuggest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +218,7 @@ public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, O
|
||||||
if (cond1value == null) continue;
|
if (cond1value == null) continue;
|
||||||
boolean cond1Violating;
|
boolean cond1Violating;
|
||||||
if(rule.getDirection().contains("x")){
|
if(rule.getDirection().contains("x")){
|
||||||
cond1Violating = isViolating(valueXToCompare, cond1, cond1value);
|
cond1Violating = isViolating(valueXToCompare, cond1, cond1value);
|
||||||
}else if(rule.getDirection().contains("y")){
|
}else if(rule.getDirection().contains("y")){
|
||||||
cond1Violating = isViolating(valueYToCompare, cond1, cond1value);
|
cond1Violating = isViolating(valueYToCompare, cond1, cond1value);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -256,11 +259,11 @@ public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, O
|
||||||
|
|
||||||
if (shoudWarn) {
|
if (shoudWarn) {
|
||||||
if(rule.getDirection().contains("x")){
|
if(rule.getDirection().contains("x")){
|
||||||
insertWarn(stationCode, rule.getId(), shift.getDe(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(), DateTransforUtil.transforLocalDateTimeToDate(shift.getTm()), rule.getResolveSuggest());
|
insertWarn(stationCode, rule.getId(), shift.getDe(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(), LocalDateTimeConverter.toDate(shift.getTm()), rule.getResolveSuggest());
|
||||||
}else if(rule.getDirection().contains("y")){
|
}else if(rule.getDirection().contains("y")){
|
||||||
insertWarn(stationCode, rule.getId(), shift.getDn(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(),DateTransforUtil.transforLocalDateTimeToDate(shift.getTm()), rule.getResolveSuggest());
|
insertWarn(stationCode, rule.getId(), shift.getDn(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(),LocalDateTimeConverter.toDate(shift.getTm()), rule.getResolveSuggest());
|
||||||
}else{
|
}else{
|
||||||
insertWarn(stationCode, rule.getId(), shift.getDu(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(),DateTransforUtil.transforLocalDateTimeToDate(shift.getTm()), rule.getResolveSuggest());
|
insertWarn(stationCode, rule.getId(), shift.getDu(), OsmoticWarnRule.Type.SHIFT.getType(), rule.getLevel(),LocalDateTimeConverter.toDate(shift.getTm()), rule.getResolveSuggest());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +324,7 @@ public class OsmoticWarnRuleService extends ServiceImpl<OsmoticWarnRuleMapper, O
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shoudWarn) {
|
if (shoudWarn) {
|
||||||
insertWarn(stationCode, rule.getId(), flow.getSpqn(), OsmoticWarnRule.Type.FLOW.getType(), rule.getLevel(),DateTransforUtil.transforLocalDateTimeToDate(flow.getMstm()), rule.getResolveSuggest());
|
insertWarn(stationCode, rule.getId(), flow.getSpqn(), OsmoticWarnRule.Type.FLOW.getType(), rule.getLevel(),LocalDateTimeConverter.toDate(flow.getMstm()), rule.getResolveSuggest());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,6 @@ public class RiceSupportBalanceService extends ServiceImpl<RiceSupportBalanceMap
|
||||||
BigDecimal deadW = stZvarlBService.getWByZvarl(list, deadLev);//死水位库容
|
BigDecimal deadW = stZvarlBService.getWByZvarl(list, deadLev);//死水位库容
|
||||||
Integer year = riceRqWater.getRiceGrowConfig().getYear();//获取相似年
|
Integer year = riceRqWater.getRiceGrowConfig().getYear();//获取相似年
|
||||||
if(dto.getStartTime().isAfter(today)){
|
if(dto.getStartTime().isAfter(today)){
|
||||||
// 总来水量 = 当前~开始时间这一段时间的来水量 + 来回方案来水
|
|
||||||
//方案来水量的时间范围 今天1号,开始时间4号,需要计算1-3号共3天
|
|
||||||
Integer gapDay = LocalDateTimeUtils.getTotalDayByRangeDate(today, dto.getStartTime().minusDays(1)); // 注意:这里应该是到开始时间前一天
|
|
||||||
//获取降雨相似年资料
|
//获取降雨相似年资料
|
||||||
BigDecimal totalRainfallWater = BigDecimal.ZERO;
|
BigDecimal totalRainfallWater = BigDecimal.ZERO;
|
||||||
for (TyYearRainfallVo tyYearRainfallVo : tyYearRainfallService.queryList()) {
|
for (TyYearRainfallVo tyYearRainfallVo : tyYearRainfallService.queryList()) {
|
||||||
|
|
@ -186,7 +183,7 @@ public class RiceSupportBalanceService extends ServiceImpl<RiceSupportBalanceMap
|
||||||
riceSupportBalance.setStartTime(dto.getStartTime());
|
riceSupportBalance.setStartTime(dto.getStartTime());
|
||||||
riceSupportBalance.setEndTime(dto.getEndTime());
|
riceSupportBalance.setEndTime(dto.getEndTime());
|
||||||
riceSupportBalance.setCreateTime(LocalDateTime.now());
|
riceSupportBalance.setCreateTime(LocalDateTime.now());
|
||||||
riceSupportBalance.setTotalSupport(totalPlan);//实际供水量
|
riceSupportBalance.setTotalPlan(totalPlan);//实际供水量
|
||||||
riceSupportBalance.setTotalCost(totalNeedWater);//计划供水量
|
riceSupportBalance.setTotalCost(totalNeedWater);//计划供水量
|
||||||
riceSupportBalance.setCreateName(dto.getCreateName());
|
riceSupportBalance.setCreateName(dto.getCreateName());
|
||||||
riceSupportBalance.setStatus(0);
|
riceSupportBalance.setStatus(0);
|
||||||
|
|
@ -281,6 +278,9 @@ public class RiceSupportBalanceService extends ServiceImpl<RiceSupportBalanceMap
|
||||||
updateById(riceSupportBalance);
|
updateById(riceSupportBalance);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存水稻平衡供水明细失败", e);
|
log.error("保存水稻平衡供水明细失败", e);
|
||||||
|
riceSupportBalance.setStatus(2);
|
||||||
|
riceSupportBalance.setFailReason(e.getMessage());
|
||||||
|
updateById(riceSupportBalance);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
// 主线程立即返回,不等待明细计算完成
|
// 主线程立即返回,不等待明细计算完成
|
||||||
|
|
@ -341,6 +341,7 @@ public class RiceSupportBalanceService extends ServiceImpl<RiceSupportBalanceMap
|
||||||
if(!StringUtils.isBlank(page.getPlanName())){
|
if(!StringUtils.isBlank(page.getPlanName())){
|
||||||
queryWrapper.like(RiceSupportBalance::getPlanName, page.getPlanName());
|
queryWrapper.like(RiceSupportBalance::getPlanName, page.getPlanName());
|
||||||
}
|
}
|
||||||
|
queryWrapper.orderByDesc(RiceSupportBalance::getCreateTime);
|
||||||
Page<RiceSupportBalance> riceSupportBalancePage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
Page<RiceSupportBalance> riceSupportBalancePage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||||
for (RiceSupportBalance record : riceSupportBalancePage.getRecords()) {
|
for (RiceSupportBalance record : riceSupportBalancePage.getRecords()) {
|
||||||
List<RiceSupportBalanceDetail> details = riceSupportBalanceDetailService.selectByRCId(record.getId());
|
List<RiceSupportBalanceDetail> details = riceSupportBalanceDetailService.selectByRCId(record.getId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue