parent
66675bcc87
commit
1df4784507
|
|
@ -15,6 +15,7 @@
|
||||||
<el-form label-width="80px" label-position="right">
|
<el-form label-width="80px" label-position="right">
|
||||||
<el-form-item label="节假日" label-width="auto">
|
<el-form-item label="节假日" label-width="auto">
|
||||||
<el-popover
|
<el-popover
|
||||||
|
v-loading="loading1"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
width="400"
|
width="400"
|
||||||
v-model="holidayVisible">
|
v-model="holidayVisible">
|
||||||
|
|
@ -39,6 +40,7 @@
|
||||||
<el-form-item label="MM图片" label-width="auto">
|
<el-form-item label="MM图片" label-width="auto">
|
||||||
|
|
||||||
<el-popover
|
<el-popover
|
||||||
|
v-loading="loading2"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
width="988"
|
width="988"
|
||||||
v-model="beautyPictureVisible">
|
v-model="beautyPictureVisible">
|
||||||
|
|
@ -61,10 +63,22 @@
|
||||||
<el-form-item label="历史今天" label-width="auto">
|
<el-form-item label="历史今天" label-width="auto">
|
||||||
|
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom"
|
v-loading="loading3"
|
||||||
width="988"
|
placement="right"
|
||||||
|
width="400"
|
||||||
v-model="historyTodayVisible">
|
v-model="historyTodayVisible">
|
||||||
|
|
||||||
|
<div v-for="data in historyTodayData" v-loading="loading3">
|
||||||
|
<span>
|
||||||
|
{{ data.date }}
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<span style="font-size: 12px">
|
||||||
|
{{ data.title }}
|
||||||
|
</span>
|
||||||
|
<el-divider><i class="el-icon-chat-round"></i></el-divider>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="getHistoryToday()" size="mini"
|
<el-button type="primary" icon="el-icon-search" @click="getHistoryToday()" size="mini"
|
||||||
slot="reference">搜索
|
slot="reference">搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -199,6 +213,7 @@ export default {
|
||||||
//遮罩层
|
//遮罩层
|
||||||
loading1: false,
|
loading1: false,
|
||||||
loading2: false,
|
loading2: false,
|
||||||
|
loading3: false,
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -211,8 +226,12 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
//获取历史今天数据信息
|
//获取历史今天数据信息
|
||||||
getHistoryToday() {
|
getHistoryToday() {
|
||||||
|
this.loading3 = true
|
||||||
getHistoryToday().then(res => {
|
getHistoryToday().then(res => {
|
||||||
|
this.loading3 = false
|
||||||
this.historyTodayData = res.data
|
this.historyTodayData = res.data
|
||||||
|
}).catch(err =>{
|
||||||
|
this.loading3 = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -222,7 +241,9 @@ export default {
|
||||||
getHoliday().then(res => {
|
getHoliday().then(res => {
|
||||||
this.loading1 = false
|
this.loading1 = false
|
||||||
this.holidayData = res.data
|
this.holidayData = res.data
|
||||||
});
|
}).catch(err =>{
|
||||||
|
this.loading3 = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//获取mm图片信息
|
//获取mm图片信息
|
||||||
|
|
@ -236,6 +257,8 @@ export default {
|
||||||
res.data.forEach(data => {
|
res.data.forEach(data => {
|
||||||
this.pictureList.push(data.imageUrl)
|
this.pictureList.push(data.imageUrl)
|
||||||
})
|
})
|
||||||
|
}).catch(err =>{
|
||||||
|
this.loading3 = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.xjs.run;
|
|
||||||
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* springboot启动成功后执行
|
|
||||||
* @author xiejs
|
|
||||||
* @since 2022-01-19
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class ApplicationRunnerImpl implements ApplicationRunner {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
|
||||||
System.out.println("-----------------启动成功!!!---------------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -165,7 +165,7 @@ public class ApiToolsServiceImpl implements ApiToolsService {
|
||||||
public List<ApiHistoryToday> getHistoryTodayList() {
|
public List<ApiHistoryToday> getHistoryTodayList() {
|
||||||
List<ApiHistoryToday> historyTodayList = historyTodayFactory.apiDataList();
|
List<ApiHistoryToday> historyTodayList = historyTodayFactory.apiDataList();
|
||||||
if (CollUtil.isNotEmpty(historyTodayList)) {
|
if (CollUtil.isNotEmpty(historyTodayList)) {
|
||||||
return historyTodayList.stream().limit(5).collect(Collectors.toList());
|
return historyTodayList.stream().limit(7).collect(Collectors.toList());
|
||||||
}else {
|
}else {
|
||||||
throw new ApiException("获取历史上的今天api调用异常!!!");
|
throw new ApiException("获取历史上的今天api调用异常!!!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ public class DeleteRepeatTask {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2022-01-07 07:00:00
|
* 2022-01-07 07:00:00<br>
|
||||||
* 2022-01-07 08:00:00
|
* 2022-01-07 08:00:00<br>
|
||||||
* 2022-01-07 09:00:00
|
* 2022-01-07 09:00:00<br>
|
||||||
* 2022-01-07 10:00:00
|
* 2022-01-07 10:00:00<br>
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 10,14,20 * * ? ")
|
@Scheduled(cron = "0 0 10,14,20 * * ? ")
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
|
@EnableScheduling
|
||||||
public class XjsWarningApp {
|
public class XjsWarningApp {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(XjsWarningApp.class, args);
|
SpringApplication.run(XjsWarningApp.class, args);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.xjs.handler;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xjs.domain.ApiRecord;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期的处理
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-21
|
||||||
|
*/
|
||||||
|
public class RecordDateHandler {
|
||||||
|
|
||||||
|
protected List<ApiRecord> handleDate(List<ApiRecord> apiRecordList) {
|
||||||
|
if (CollUtil.isNotEmpty(apiRecordList)) {
|
||||||
|
apiRecordList.forEach(apiRecord -> {
|
||||||
|
String dateTime = DateUtil.formatDateTime(apiRecord.getUpdateTime());
|
||||||
|
Date date = DateUtil.parseDate(dateTime).toJdkDate();
|
||||||
|
//当前时间和最后一次修改时间间隔天数(超过1 就清零)
|
||||||
|
long compareTime = DateUtil.between(date, new Date(), DateUnit.DAY);
|
||||||
|
if (compareTime > 0) {
|
||||||
|
apiRecord.setDayCount(0L);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return apiRecordList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.xjs.run;
|
||||||
|
|
||||||
|
import com.xjs.domain.ApiRecord;
|
||||||
|
import com.xjs.handler.RecordDateHandler;
|
||||||
|
import com.xjs.service.ApiWarningService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* springboot启动成功后执行
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-19
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ApplicationRunnerImpl extends RecordDateHandler implements ApplicationRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiWarningService apiWarningService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
System.out.println("-----------------启动成功!!!---------------------");
|
||||||
|
|
||||||
|
//启动后处理每日预警数量
|
||||||
|
List<ApiRecord> apiRecordList = apiWarningService.selectApiRecordList(new ApiRecord());
|
||||||
|
List<ApiRecord> handleDate = super.handleDate(apiRecordList);
|
||||||
|
handleDate.forEach(data ->{
|
||||||
|
apiWarningService.updateApiRecordByUrl(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.xjs.task;
|
||||||
|
|
||||||
|
import com.xjs.domain.ApiRecord;
|
||||||
|
import com.xjs.handler.RecordDateHandler;
|
||||||
|
import com.xjs.service.ApiWarningService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警相关定时任务
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-21
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class WarningTask extends RecordDateHandler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiWarningService apiWarningService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理预警api信息的每天调用次数<br>
|
||||||
|
* 最近10次运行:<br>
|
||||||
|
* 2022-01-22 00:00:10<br>
|
||||||
|
* 2022-01-23 00:00:10<br>
|
||||||
|
* 2022-01-24 00:00:10<br>
|
||||||
|
* 2022-01-25 00:00:10<br>
|
||||||
|
* 2022-01-26 00:00:10<br>
|
||||||
|
* 2022-01-27 00:00:10<br>
|
||||||
|
* 2022-01-28 00:00:10<br>
|
||||||
|
* 2022-01-29 00:00:10<br>
|
||||||
|
* 2022-01-30 00:00:10<br>
|
||||||
|
* 2022-01-31 00:00:10<br>
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "10 0 0 * * ? ")
|
||||||
|
public void handleRecordDate() {
|
||||||
|
List<ApiRecord> apiRecordList = apiWarningService.selectApiRecordList(new ApiRecord());
|
||||||
|
List<ApiRecord> handleDate = super.handleDate(apiRecordList);
|
||||||
|
handleDate.forEach(data ->{
|
||||||
|
apiWarningService.updateApiRecordByUrl(data);
|
||||||
|
});
|
||||||
|
log.info("定时任务处理预警api信息的每天调用次数完毕");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue