|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.supervise.rms.biz.riskrecord; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateField; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.thread.ThreadUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.supervise.rms.api.riskalarm.RiskAlarm; |
|
|
@ -40,25 +42,29 @@ public class RiskRecordService extends MybatisBaseService<RiskRecordMapper, Risk |
|
|
|
RiskAlarmService riskAlarmService; |
|
|
|
public ResultBean saveRecord(RiskRecordDto dto){ |
|
|
|
ResultBean rb=new ResultBean(); |
|
|
|
baseMapper.delete(new QueryWrapper<RiskRecord>()); |
|
|
|
RiskRecord riskRecord = new RiskRecord(); |
|
|
|
BeanUtil.copyProperties(dto, riskRecord); |
|
|
|
baseMapper.insert(riskRecord); |
|
|
|
RiskRecord r=baseMapper.selectOne(new QueryWrapper<>()); |
|
|
|
//baseMapper.delete(new QueryWrapper<RiskRecord>());
|
|
|
|
// RiskRecord riskRecord = new RiskRecord();
|
|
|
|
// BeanUtil.copyProperties(dto, riskRecord);
|
|
|
|
r.setDate(dto.getDate()); |
|
|
|
baseMapper.updateById(r); |
|
|
|
return rb.success().setMsg("更新成功"); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 定时查询推送情况 |
|
|
|
*/ |
|
|
|
@Scheduled(cron = "55 * * * * ?") |
|
|
|
@Scheduled(cron = "57 * * * * ?") |
|
|
|
public void build() throws InterruptedException { |
|
|
|
//Thread.sleep(58000);
|
|
|
|
System.out.println("查询推送情况"); |
|
|
|
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
|
|
|
String date=ft.format(new Date()); |
|
|
|
Date end =new Date(); |
|
|
|
String endDate=ft.format(end); |
|
|
|
RiskAlarm riskAlarm = new RiskAlarm(); |
|
|
|
System.out.println(date); |
|
|
|
RiskRecord riskRecord=baseMapper.selectOne(new QueryWrapper<RiskRecord>().like("date",date)); |
|
|
|
if(null==riskRecord){ |
|
|
|
Date start =DateUtil.offset(end, DateField.MINUTE,-3); |
|
|
|
String startDate=ft.format(start); |
|
|
|
Integer riskRecord=baseMapper.getCount(startDate,endDate); |
|
|
|
if(riskRecord==0){ |
|
|
|
RiskIndicators riskIndicators = riskIndicatorsService.getOne(new QueryWrapper<RiskIndicators>().eq("code", "030406")); |
|
|
|
riskAlarm.setIndicatorSid(riskIndicators.getSid()); |
|
|
|
riskAlarm.setIndicatorCode(riskIndicators.getCode()); |
|
|
|