parent
e1d7a2e593
commit
c938104c59
|
|
@ -30,6 +30,8 @@ public class CopyWritingTask {
|
|||
*/
|
||||
public void execute() {
|
||||
log.info("---------------文案定时任务Start-------------------");
|
||||
|
||||
//该循环会导致执行i次重复删除sql
|
||||
for (int i = 0; i < 8; i++) {
|
||||
LocalDateTime localDateTime1 = DateUtil.date().toLocalDateTime();
|
||||
R<CopyWriting> r = remoteCopyWritingFeign.copyWriting();
|
||||
|
|
@ -38,6 +40,7 @@ public class CopyWritingTask {
|
|||
long between = ChronoUnit.MILLIS.between(localDateTime1, localDateTime2);
|
||||
log.info("文案[{}]定时任务Job耗费时间:{}ms", i,between);
|
||||
}
|
||||
|
||||
log.info("---------------文案定时任务end---------------------");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* feign配置
|
||||
* @author xiejs
|
||||
* @desc
|
||||
* @create 2021-12-25
|
||||
* @since 2021-12-25
|
||||
*/
|
||||
@Configuration
|
||||
public class FeignConfig{
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全局序列化处理配置
|
||||
* @author xiejs
|
||||
* @desc 全局序列化处理配置
|
||||
* @create 2021-12-26
|
||||
* @since 2021-12-26
|
||||
*/
|
||||
@Configuration
|
||||
public class JsonConfig {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.consts;
|
||||
|
||||
/**
|
||||
* api预警处理常量
|
||||
* @author xiejs
|
||||
* @desc api预警处理常量
|
||||
* @create 2022-01-07
|
||||
* @since 2022-01-07
|
||||
*/
|
||||
public class ApiWarnHandleConst {
|
||||
//已处理
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.consts;
|
||||
|
||||
/**
|
||||
* 文案各个平台常量类
|
||||
* @author xiejs
|
||||
* @desc 各个数据平台常量类
|
||||
* @create 2021-12-28
|
||||
* @since 2021-12-28
|
||||
*/
|
||||
public class CopyWritingConst {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.consts;
|
||||
|
||||
/**
|
||||
* 英语单词常量类
|
||||
* @author xiejs
|
||||
* @desc 英语单词常量类
|
||||
* @create 2021-12-31
|
||||
* @since 2021-12-31
|
||||
*/
|
||||
public class EnglishWordConst {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.consts;
|
||||
|
||||
/**
|
||||
* 请求是否成功常量
|
||||
* @author xiejs
|
||||
* @desc 请求是否成功常量
|
||||
* @create 2021-12-26
|
||||
* @since 2021-12-26
|
||||
*/
|
||||
public class ReqConst {
|
||||
public static final Integer SUCCESS = 1;
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
|
|||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* 状态类型枚举 需要返回什么参数就在toString实现 这个枚举需要mp在配置文件中配置扫描路径
|
||||
* @author xiejs
|
||||
* @desc 状态类型枚举 需要返回什么参数就在toString实现 这个枚举需要mp在配置文件中配置扫描路径
|
||||
* @create 2021-12-27
|
||||
* @since 2021-12-27
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.enums;
|
||||
|
||||
/**
|
||||
* 预警等级枚举
|
||||
* @author xiejs
|
||||
* @desc 预警等级枚举
|
||||
* @create 2022-01-07
|
||||
* @since 2022-01-07
|
||||
*/
|
||||
public enum WarnLevelEnum {
|
||||
/* 普通 **/
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.enums;
|
||||
|
||||
/**
|
||||
* 预警类型枚举
|
||||
* @author xiejs
|
||||
* @desc 预警类型枚举
|
||||
* @create 2022-01-07
|
||||
* @since 2022-01-07
|
||||
*/
|
||||
public enum WarnTypeEnum {
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package com.xjs.exception;
|
|||
import lombok.extern.log4j.Log4j2;
|
||||
|
||||
/**
|
||||
* 自定义业务api异常
|
||||
* @author xiejs
|
||||
* @desc
|
||||
* @create 2021-12-27
|
||||
* @since 2021-12-27
|
||||
*/
|
||||
@Log4j2
|
||||
public class ApiException extends RuntimeException{
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package com.xjs.exception;
|
|||
import lombok.extern.log4j.Log4j2;
|
||||
|
||||
/**
|
||||
* 自定义业务异常
|
||||
* @author xiejs
|
||||
* @desc
|
||||
* @create 2021-12-25
|
||||
* @since 2021-12-25
|
||||
*/
|
||||
@Log4j2
|
||||
public class BusinessException extends RuntimeException{
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* mp字段自动填充处理器
|
||||
* @author xiejs
|
||||
* @desc mp字段自动填充处理器
|
||||
* @create 2021-12-27
|
||||
* @since 2021-12-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.xjs.utils;
|
||||
|
||||
/**
|
||||
* 中文工具类
|
||||
* @author xiejs
|
||||
* @desc 中文工具类
|
||||
* @create 2021-12-29
|
||||
* @since 2021-12-29
|
||||
*/
|
||||
public class ChineseUtils {
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@ package com.xjs.utils;
|
|||
import java.io.Closeable;
|
||||
|
||||
/**
|
||||
* @author meteor
|
||||
*
|
||||
* @description 用于关闭各种连接,缺啥补啥
|
||||
* @date 2021-03-05
|
||||
* 用于关闭各种连接,缺啥补啥
|
||||
* @author xiejs
|
||||
* @since 2021-03-05
|
||||
**/
|
||||
public class CloseUtils {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package com.xjs.utils;
|
||||
|
||||
import ch.qos.logback.core.util.CloseUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.poi.excel.BigExcelWriter;
|
||||
|
|
@ -28,9 +27,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* File工具类,扩展 hutool 工具包
|
||||
*
|
||||
* @author meteor
|
||||
* @date 2021-12-27
|
||||
* @author xiejs
|
||||
* @since 2021-12-27
|
||||
*/
|
||||
public class FileUtils extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
|
|
|
|||
|
|
@ -283,23 +283,5 @@ public class IPUtils {
|
|||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
//String nowIP1 = IPUtils.getNowIP1();
|
||||
//String nowIP2 = IPUtils.getNowIP2();
|
||||
//String nowIP3 = IPUtils.getNowIP3();
|
||||
//String nowIP4 = IPUtils.getNowIP4();
|
||||
//System.out.println(nowIP1);
|
||||
//System.out.println(nowIP2);
|
||||
//System.out.println(nowIP3);
|
||||
//System.out.println(nowIP4);
|
||||
|
||||
//String nowIP5 = IPUtils.getNowIP5();
|
||||
//System.out.println(nowIP5);
|
||||
|
||||
String nowIP6 = IPUtils.getNowIP6();
|
||||
System.out.println(nowIP6);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ import com.xjs.common.client.api.gaode.GaodeWeatherFeignClient;
|
|||
import com.xjs.common.client.api.lq.LqAWordFeignClient;
|
||||
import com.xjs.common.client.api.lq.LqDogDiaryFeignClient;
|
||||
import com.xjs.common.client.api.lq.LqPoisonChickenFeignClient;
|
||||
import com.xjs.common.client.api.roll.RollBeautyPictureFeignClient;
|
||||
import com.xjs.common.client.api.roll.RollChineseDictFeignClient;
|
||||
import com.xjs.common.client.api.roll.*;
|
||||
import com.xjs.properties.AlApiProperties;
|
||||
import com.xjs.properties.BaiduProperties;
|
||||
import com.xjs.properties.GaodeProperties;
|
||||
|
|
@ -88,6 +87,13 @@ public class CheckApiStatusTask {
|
|||
private RollBeautyPictureFeignClient rollBeautyPictureFeignClient;
|
||||
@Autowired
|
||||
private RollChineseDictFeignClient rollChineseDictFeignClient;
|
||||
@Autowired
|
||||
private RollGarbageSortingDeignClient rollGarbageSortingDeignClient;
|
||||
@Autowired
|
||||
private RollHistoryTodayFeignClient rollHistoryTodayFeignClient;
|
||||
@Autowired
|
||||
private RollHolidayFeignClient rollHolidayFeignClient;
|
||||
|
||||
|
||||
/**
|
||||
* 检查api状态 <br>
|
||||
|
|
@ -95,18 +101,87 @@ public class CheckApiStatusTask {
|
|||
*/
|
||||
public void checkApiStatus() {
|
||||
try {
|
||||
this.checkAlapiJoke();
|
||||
|
||||
this.checkBaiduTranslation();
|
||||
Runnable runCheckAlapiJoke = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkAlapiJoke();
|
||||
};
|
||||
new Thread(runCheckAlapiJoke).start();
|
||||
|
||||
this.checkGaodeWeather();
|
||||
Runnable runCheckBaiduTranslation = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkBaiduTranslation();
|
||||
};
|
||||
new Thread(runCheckBaiduTranslation).start();
|
||||
|
||||
this.checkLqAWord();
|
||||
Runnable runCheckGaodeWeather = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkGaodeWeather();
|
||||
};
|
||||
new Thread(runCheckGaodeWeather).start();
|
||||
|
||||
this.checkLqDogDiary();
|
||||
Runnable runCheckLqAWord = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkLqAWord();
|
||||
};
|
||||
new Thread(runCheckLqAWord).start();
|
||||
|
||||
this.checkRollBeautyPicture();
|
||||
Runnable runCheckLqDogDiary = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkLqDogDiary();
|
||||
};
|
||||
new Thread(runCheckLqDogDiary).start();
|
||||
|
||||
Runnable runCheckLqPoisonChicken = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkLqPoisonChicken();
|
||||
};
|
||||
new Thread(runCheckLqPoisonChicken).start();
|
||||
|
||||
Runnable runCheckRollBeautyPicture = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkRollBeautyPicture();
|
||||
};
|
||||
new Thread(runCheckRollBeautyPicture).start();
|
||||
|
||||
Runnable runCheckRollChineseDict = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkRollChineseDict();
|
||||
};
|
||||
new Thread(runCheckRollChineseDict).start();
|
||||
|
||||
Runnable runCheckRollGarbageSorting = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkRollGarbageSorting();
|
||||
};
|
||||
new Thread(runCheckRollGarbageSorting).start();
|
||||
|
||||
Runnable runCheckRollHistoryToday = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkRollHistoryToday();
|
||||
};
|
||||
new Thread(runCheckRollHistoryToday).start();
|
||||
|
||||
Runnable runCheckRollHoliday = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkRollHoliday();
|
||||
};
|
||||
new Thread(runCheckRollHoliday).start();
|
||||
|
||||
|
||||
|
||||
|
||||
//this.checkAlapiJoke();
|
||||
//this.checkBaiduTranslation();
|
||||
//this.checkGaodeWeather();
|
||||
//this.checkLqAWord();
|
||||
//this.checkLqDogDiary();
|
||||
//this.checkLqPoisonChicken();
|
||||
//this.checkRollBeautyPicture();
|
||||
//this.checkRollChineseDict();
|
||||
this.checkRollGarbageSorting();
|
||||
this.checkRollHistoryToday();
|
||||
this.checkRollHoliday();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -204,7 +279,7 @@ public class CheckApiStatusTask {
|
|||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class);
|
||||
String[] info = this.getAnnotationInfo(LqAWordFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现零七平台 一言API异常");
|
||||
}
|
||||
|
|
@ -219,7 +294,7 @@ public class CheckApiStatusTask {
|
|||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class);
|
||||
String[] info = this.getAnnotationInfo(LqDogDiaryFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现零七平台 舔狗日记API异常");
|
||||
}
|
||||
|
|
@ -233,7 +308,7 @@ public class CheckApiStatusTask {
|
|||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class);
|
||||
String[] info = this.getAnnotationInfo(LqPoisonChickenFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现零七平台 毒鸡汤API异常");
|
||||
}
|
||||
|
|
@ -243,38 +318,92 @@ public class CheckApiStatusTask {
|
|||
* 检查ROLL平台 美女图片API
|
||||
*/
|
||||
private void checkRollBeautyPicture() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = new com.xjs.apitools.domain.RequestBody();
|
||||
requestBody.setApp_secret(rollProperties.getApp_secret());
|
||||
requestBody.setApp_id(rollProperties.getApp_id());
|
||||
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
|
||||
JSONObject jsonObject = rollBeautyPictureFeignClient.beautyPictureApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class);
|
||||
String[] info = this.getAnnotationInfo(RollBeautyPictureFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现ROLL平台 美女图片API异常");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ROLL平台 汉语字典API
|
||||
*/
|
||||
private void checkRollChineseDict() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
|
||||
JSONObject jsonObject = rollChineseDictFeignClient.chineseDictApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(RollChineseDictFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现ROLL平台 汉语字典API异常");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ROLL平台 垃圾分类API
|
||||
*/
|
||||
private void checkRollGarbageSorting() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
|
||||
JSONObject jsonObject = rollGarbageSortingDeignClient.garbageSortingApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(RollGarbageSortingDeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现ROLL平台 垃圾分类API异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ROLL平台 历史今天API
|
||||
*/
|
||||
private void checkRollHistoryToday() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
|
||||
requestBody.setType(0);
|
||||
JSONObject jsonObject = rollHistoryTodayFeignClient.historyTodayApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(RollHistoryTodayFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现ROLL平台 历史今天API异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ROLL平台 节假日API
|
||||
*/
|
||||
private void checkRollHoliday() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
|
||||
JSONObject jsonObject = rollHolidayFeignClient.holidayApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] info = this.getAnnotationInfo(RollHolidayFeignClient.class);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查发现ROLL平台 节假日API异常");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取requestBody并封装密钥
|
||||
*
|
||||
* @return requestBody
|
||||
*/
|
||||
private com.xjs.apitools.domain.RequestBody getRequestBody() {
|
||||
com.xjs.apitools.domain.RequestBody requestBody = new com.xjs.apitools.domain.RequestBody();
|
||||
requestBody.setApp_secret(rollProperties.getApp_secret());
|
||||
requestBody.setApp_id(rollProperties.getApp_id());
|
||||
return requestBody;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue