1、补齐某些类的注释

2、继续开发检查API可用性功能
This commit is contained in:
xjs 2022-02-23 10:34:53 +08:00
parent e1d7a2e593
commit c938104c59
18 changed files with 194 additions and 83 deletions

View File

@ -30,6 +30,8 @@ public class CopyWritingTask {
*/ */
public void execute() { public void execute() {
log.info("---------------文案定时任务Start-------------------"); log.info("---------------文案定时任务Start-------------------");
//该循环会导致执行i次重复删除sql
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
LocalDateTime localDateTime1 = DateUtil.date().toLocalDateTime(); LocalDateTime localDateTime1 = DateUtil.date().toLocalDateTime();
R<CopyWriting> r = remoteCopyWritingFeign.copyWriting(); R<CopyWriting> r = remoteCopyWritingFeign.copyWriting();
@ -38,6 +40,7 @@ public class CopyWritingTask {
long between = ChronoUnit.MILLIS.between(localDateTime1, localDateTime2); long between = ChronoUnit.MILLIS.between(localDateTime1, localDateTime2);
log.info("文案[{}]定时任务Job耗费时间:{}ms", i,between); log.info("文案[{}]定时任务Job耗费时间:{}ms", i,between);
} }
log.info("---------------文案定时任务end---------------------"); log.info("---------------文案定时任务end---------------------");
} }
} }

View File

@ -5,9 +5,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
/** /**
* feign配置
* @author xiejs * @author xiejs
* @desc * @since 2021-12-25
* @create 2021-12-25
*/ */
@Configuration @Configuration
public class FeignConfig{ public class FeignConfig{

View File

@ -18,9 +18,9 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* 全局序列化处理配置
* @author xiejs * @author xiejs
* @desc 全局序列化处理配置 * @since 2021-12-26
* @create 2021-12-26
*/ */
@Configuration @Configuration
public class JsonConfig { public class JsonConfig {

View File

@ -1,9 +1,9 @@
package com.xjs.consts; package com.xjs.consts;
/** /**
* api预警处理常量
* @author xiejs * @author xiejs
* @desc api预警处理常量 * @since 2022-01-07
* @create 2022-01-07
*/ */
public class ApiWarnHandleConst { public class ApiWarnHandleConst {
//已处理 //已处理

View File

@ -1,9 +1,9 @@
package com.xjs.consts; package com.xjs.consts;
/** /**
* 文案各个平台常量类
* @author xiejs * @author xiejs
* @desc 各个数据平台常量类 * @since 2021-12-28
* @create 2021-12-28
*/ */
public class CopyWritingConst { public class CopyWritingConst {

View File

@ -1,9 +1,9 @@
package com.xjs.consts; package com.xjs.consts;
/** /**
* 英语单词常量类
* @author xiejs * @author xiejs
* @desc 英语单词常量类 * @since 2021-12-31
* @create 2021-12-31
*/ */
public class EnglishWordConst { public class EnglishWordConst {

View File

@ -1,9 +1,9 @@
package com.xjs.consts; package com.xjs.consts;
/** /**
* 请求是否成功常量
* @author xiejs * @author xiejs
* @desc 请求是否成功常量 * @since 2021-12-26
* @create 2021-12-26
*/ */
public class ReqConst { public class ReqConst {
public static final Integer SUCCESS = 1; public static final Integer SUCCESS = 1;

View File

@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.annotation.JsonValue;
/** /**
* 状态类型枚举 需要返回什么参数就在toString实现 这个枚举需要mp在配置文件中配置扫描路径
* @author xiejs * @author xiejs
* @desc 状态类型枚举 需要返回什么参数就在toString实现 这个枚举需要mp在配置文件中配置扫描路径 * @since 2021-12-27
* @create 2021-12-27
*/ */
public enum StatusEnum { public enum StatusEnum {

View File

@ -1,9 +1,9 @@
package com.xjs.enums; package com.xjs.enums;
/** /**
* 预警等级枚举
* @author xiejs * @author xiejs
* @desc 预警等级枚举 * @since 2022-01-07
* @create 2022-01-07
*/ */
public enum WarnLevelEnum { public enum WarnLevelEnum {
/* 普通 **/ /* 普通 **/

View File

@ -1,9 +1,9 @@
package com.xjs.enums; package com.xjs.enums;
/** /**
* 预警类型枚举
* @author xiejs * @author xiejs
* @desc 预警类型枚举 * @since 2022-01-07
* @create 2022-01-07
*/ */
public enum WarnTypeEnum { public enum WarnTypeEnum {

View File

@ -3,9 +3,9 @@ package com.xjs.exception;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
/** /**
* 自定义业务api异常
* @author xiejs * @author xiejs
* @desc * @since 2021-12-27
* @create 2021-12-27
*/ */
@Log4j2 @Log4j2
public class ApiException extends RuntimeException{ public class ApiException extends RuntimeException{

View File

@ -3,9 +3,9 @@ package com.xjs.exception;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
/** /**
* 自定义业务异常
* @author xiejs * @author xiejs
* @desc * @since 2021-12-25
* @create 2021-12-25
*/ */
@Log4j2 @Log4j2
public class BusinessException extends RuntimeException{ public class BusinessException extends RuntimeException{

View File

@ -8,9 +8,9 @@ import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
/** /**
* mp字段自动填充处理器
* @author xiejs * @author xiejs
* @desc mp字段自动填充处理器 * @since 2021-12-27
* @create 2021-12-27
*/ */
@Slf4j @Slf4j
@Component @Component

View File

@ -1,9 +1,9 @@
package com.xjs.utils; package com.xjs.utils;
/** /**
* 中文工具类
* @author xiejs * @author xiejs
* @desc 中文工具类 * @since 2021-12-29
* @create 2021-12-29
*/ */
public class ChineseUtils { public class ChineseUtils {

View File

@ -4,10 +4,9 @@ package com.xjs.utils;
import java.io.Closeable; import java.io.Closeable;
/** /**
* @author meteor * 用于关闭各种连接缺啥补啥
* * @author xiejs
* @description 用于关闭各种连接缺啥补啥 * @since 2021-03-05
* @date 2021-03-05
**/ **/
public class CloseUtils { public class CloseUtils {

View File

@ -1,7 +1,6 @@
package com.xjs.utils; package com.xjs.utils;
import ch.qos.logback.core.util.CloseUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.poi.excel.BigExcelWriter; import cn.hutool.poi.excel.BigExcelWriter;
@ -28,9 +27,8 @@ import java.util.Map;
/** /**
* File工具类扩展 hutool 工具包 * File工具类扩展 hutool 工具包
* * @author xiejs
* @author meteor * @since 2021-12-27
* @date 2021-12-27
*/ */
public class FileUtils extends cn.hutool.core.io.FileUtil { public class FileUtils extends cn.hutool.core.io.FileUtil {

View File

@ -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);
}
} }

View File

@ -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.LqAWordFeignClient;
import com.xjs.common.client.api.lq.LqDogDiaryFeignClient; import com.xjs.common.client.api.lq.LqDogDiaryFeignClient;
import com.xjs.common.client.api.lq.LqPoisonChickenFeignClient; import com.xjs.common.client.api.lq.LqPoisonChickenFeignClient;
import com.xjs.common.client.api.roll.RollBeautyPictureFeignClient; import com.xjs.common.client.api.roll.*;
import com.xjs.common.client.api.roll.RollChineseDictFeignClient;
import com.xjs.properties.AlApiProperties; import com.xjs.properties.AlApiProperties;
import com.xjs.properties.BaiduProperties; import com.xjs.properties.BaiduProperties;
import com.xjs.properties.GaodeProperties; import com.xjs.properties.GaodeProperties;
@ -88,6 +87,13 @@ public class CheckApiStatusTask {
private RollBeautyPictureFeignClient rollBeautyPictureFeignClient; private RollBeautyPictureFeignClient rollBeautyPictureFeignClient;
@Autowired @Autowired
private RollChineseDictFeignClient rollChineseDictFeignClient; private RollChineseDictFeignClient rollChineseDictFeignClient;
@Autowired
private RollGarbageSortingDeignClient rollGarbageSortingDeignClient;
@Autowired
private RollHistoryTodayFeignClient rollHistoryTodayFeignClient;
@Autowired
private RollHolidayFeignClient rollHolidayFeignClient;
/** /**
* 检查api状态 <br> * 检查api状态 <br>
@ -95,18 +101,87 @@ public class CheckApiStatusTask {
*/ */
public void checkApiStatus() { public void checkApiStatus() {
try { try {
Runnable runCheckAlapiJoke = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkAlapiJoke(); this.checkAlapiJoke();
};
new Thread(runCheckAlapiJoke).start();
Runnable runCheckBaiduTranslation = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkBaiduTranslation(); this.checkBaiduTranslation();
};
new Thread(runCheckBaiduTranslation).start();
Runnable runCheckGaodeWeather = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkGaodeWeather(); this.checkGaodeWeather();
};
new Thread(runCheckGaodeWeather).start();
Runnable runCheckLqAWord = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkLqAWord(); this.checkLqAWord();
};
new Thread(runCheckLqAWord).start();
Runnable runCheckLqDogDiary = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkLqDogDiary(); 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(); 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) { } catch (Exception e) {
@ -204,7 +279,7 @@ public class CheckApiStatusTask {
return; return;
} }
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class); String[] info = this.getAnnotationInfo(LqAWordFeignClient.class);
this.selectAndUpdate(info); this.selectAndUpdate(info);
log.error("检查发现零七平台 一言API异常"); log.error("检查发现零七平台 一言API异常");
} }
@ -219,7 +294,7 @@ public class CheckApiStatusTask {
return; return;
} }
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class); String[] info = this.getAnnotationInfo(LqDogDiaryFeignClient.class);
this.selectAndUpdate(info); this.selectAndUpdate(info);
log.error("检查发现零七平台 舔狗日记API异常"); log.error("检查发现零七平台 舔狗日记API异常");
} }
@ -233,7 +308,7 @@ public class CheckApiStatusTask {
return; return;
} }
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class); String[] info = this.getAnnotationInfo(LqPoisonChickenFeignClient.class);
this.selectAndUpdate(info); this.selectAndUpdate(info);
log.error("检查发现零七平台 毒鸡汤API异常"); log.error("检查发现零七平台 毒鸡汤API异常");
} }
@ -243,38 +318,92 @@ public class CheckApiStatusTask {
* 检查ROLL平台 美女图片API * 检查ROLL平台 美女图片API
*/ */
private void checkRollBeautyPicture() { private void checkRollBeautyPicture() {
com.xjs.apitools.domain.RequestBody requestBody = new com.xjs.apitools.domain.RequestBody(); com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
requestBody.setApp_secret(rollProperties.getApp_secret());
requestBody.setApp_id(rollProperties.getApp_id());
JSONObject jsonObject = rollBeautyPictureFeignClient.beautyPictureApi(requestBody); JSONObject jsonObject = rollBeautyPictureFeignClient.beautyPictureApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) { if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return; return;
} }
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class); String[] info = this.getAnnotationInfo(RollBeautyPictureFeignClient.class);
this.selectAndUpdate(info); this.selectAndUpdate(info);
log.error("检查发现ROLL平台 美女图片API异常"); 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;
}
/** /**