1、补齐某些类的注释

2、开发完成检查API可用性功能
pull/254/head
xjs 4 years ago
parent c938104c59
commit 9e761fdd69

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.TIANXING_MMMY;
import static com.xjs.consts.ApiConst.TIANXING_MMMY_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-29
* @since 2021-12-29
*/
@FeignClient(name = "tianXingMMMY",url = TIANXING_MMMY_URL,fallbackFactory = TianXingMMMYFeignFactory.class)
public interface TianXingMMMYFeignClient {

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.TIANXING_ONE_ENGLISH;
import static com.xjs.consts.ApiConst.TIANXING_ONE_ENGLISH_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-31
* @since 2021-12-31
*/
@FeignClient(name = "tianXingOneEnglish",url = TIANXING_ONE_ENGLISH_URL,fallbackFactory = TianXingOneEnglishFeignFactory.class)
public interface TianXingOneEnglishFeignClient {

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.TIANXING_PYQ;
import static com.xjs.consts.ApiConst.TIANXING_PYQ_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-27
* @since 2021-12-27
*/
@FunctionalInterface
@FeignClient(name = "tianXingPYQ",url = TIANXING_PYQ_URL,fallbackFactory = TianXingPYQFeignFactory.class)

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.TIANXING_TRAN_DICT;
import static com.xjs.consts.ApiConst.TIANXING_TRAN_DICT_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-30
* @since 2021-12-30
*/
@FunctionalInterface
@FeignClient(name = "tianXingTranDict",url = TIANXING_TRAN_DICT_URL,fallbackFactory = TianXingTranDictFeignFactory.class)

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.TIANXING_WYY;
import static com.xjs.consts.ApiConst.TIANXING_WYY_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-28
* @since 2021-12-28
*/
@FunctionalInterface
@FeignClient(name = "tianXingWYY",url = TIANXING_WYY_URL,fallbackFactory = TianXingWYYFeignFactory.class)

@ -12,9 +12,9 @@ import static com.xjs.consts.ApiConst.YOUDAO_FY;
import static com.xjs.consts.ApiConst.YOUDAO_FY_URL;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-25
* @since 2021-12-25
*/
@FeignClient(name = "youdao",url = YOUDAO_FY_URL,fallbackFactory = YouDaoFeignFactory.class)
public interface YouDaoFeignClient {

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
* roll
* @author xiejs
* @since 2022-01-18
*/

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-17
*/

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-11
*/

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-12
*/

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-29
* @since 2021-12-29
*/
@Component
@Log4j2

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-29
* @since 2021-12-29
*/
@Component
@Log4j2

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-08
*/

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-31
* @since 2021-12-31
*/
@Component
@Log4j2

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-28
* @since 2021-12-28
*/
@Log4j2
@Component

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-10
*/

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
* api
* @author xiejs
* @desc api
* @create 2021-12-30
* @since 2021-12-30
*/
@Component
@Log4j2

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-01-11
*/

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-28
* @since 2021-12-28
*/
@Log4j2
@Component

@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @since 2022-02-14
*/

@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-28
* @since 2021-12-28
*/
@Log4j2
@Component

@ -15,11 +15,13 @@ 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.*;
import com.xjs.properties.AlApiProperties;
import com.xjs.properties.BaiduProperties;
import com.xjs.properties.GaodeProperties;
import com.xjs.properties.RollProperties;
import com.xjs.common.client.api.tianxing.*;
import com.xjs.common.client.api.youdao.YouDaoFeignClient;
import com.xjs.consts.ApiConst;
import com.xjs.properties.*;
import com.xjs.translation.domain.qo.translation.BaiDuTranslationQo;
import com.xjs.translation.domain.qo.translation.RollTranslationQo;
import com.xjs.translation.domain.qo.translation.YouDaoTranslationQo;
import com.xjs.weather.domain.IPInfoVo;
import com.xjs.weather.domain.RequestBody;
import com.xjs.weather.service.IPService;
@ -29,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
@ -47,12 +50,22 @@ public class CheckApiStatusTask {
/**
*
*/
public static final String content = "test";
private static final String content = "测试";
/**
*
*/
public static final String cityId = "360100";
private static final String cityId = "360100";
/**
*
*/
public static final String city = "南昌";
/**
*
*/
public static final String mobile = "18907084291";
@Autowired
@ -70,6 +83,8 @@ public class CheckApiStatusTask {
private GaodeProperties gaodeProperties;
@Autowired
private RollProperties rollProperties;
@Autowired
private TianXingProperties tianXingProperties;
@Autowired
private AlapiJokeAllFeignClient alapiJokeAllFeignClient;
@ -93,7 +108,48 @@ public class CheckApiStatusTask {
private RollHistoryTodayFeignClient rollHistoryTodayFeignClient;
@Autowired
private RollHolidayFeignClient rollHolidayFeignClient;
@Autowired
private RollIdcardQueryFeignClient rollIdcardQueryFeignClient;
@Autowired
private RollIPFeignClient rollIPFeignClient;
@Autowired
private RollJokeFeignClient rollJokeFeignClient;
@Autowired
private RollMMYJFeignClient rollMMYJFeignClient;
@Autowired
private RollMobileBelongFeignClient rollMobileBelongFeignClient;
@Autowired
private RollSimpleComplexFeignClient rollSimpleComplexFeignClient;
@Autowired
private RollTranslationFeignClient rollTranslationFeignClient;
@Autowired
private RollWeatherFeignClient rollWeatherFeignClient;
@Autowired
private TianXingBDRSFeignClient tianXingBDRSFeignClient;
@Autowired
private TianXingDYRSFeignClient tianXingDYRSFeignClient;
@Autowired
private TianXingJDTCFeignClient tianXingJDTCFeignClient;
@Autowired
private TianXingMMMYFeignClient tianXingMMMYFeignClient;
@Autowired
private TianXingMMYJFeignClient tianXingMMYJFeignClient;
@Autowired
private TianXingOneEnglishFeignClient tianXingOneEnglishFeignClient;
@Autowired
private TianXingPYQFeignClient tianXingPYQFeignClient;
@Autowired
private TianXingQWRSFeignClient tianXingQWRSFeignClient;
@Autowired
private TianXingTranDictClient tianXingTranDictClient;
@Autowired
private TianXingWBRSFeignClient tianXingWBRSFeignClient;
@Autowired
private TianXingWXRSFeignClient tianXingWXRSFeignClient;
@Autowired
private TianXingWYYFeignClient tianXingWYYFeignClient;
@Autowired
private YouDaoFeignClient youDaoFeignClient;
/**
* api <br>
@ -168,8 +224,131 @@ public class CheckApiStatusTask {
};
new Thread(runCheckRollHoliday).start();
Runnable runCheckRollJoke = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollJoke();
};
new Thread(runCheckRollJoke).start();
Runnable runCheckRollIp = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollIp();
};
new Thread(runCheckRollIp).start();
Runnable runCheckRollIdCardQuery = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollIdCardQuery();
};
new Thread(runCheckRollIdCardQuery).start();
Runnable runCheckRollMMYJ = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollMMYJ();
};
new Thread(runCheckRollMMYJ).start();
Runnable runCheckRollMobileBelong = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollMobileBelong();
};
new Thread(runCheckRollMobileBelong).start();
Runnable runCheckRollSimpleComplex = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollSimpleComplex();
};
new Thread(runCheckRollSimpleComplex).start();
Runnable runCheckRollTranslation = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollTranslation();
};
new Thread(runCheckRollTranslation).start();
Runnable runCheckRollWeather = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkRollWeather();
};
new Thread(runCheckRollWeather).start();
Runnable runCheckTianXingBDRS = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingBDRS();
};
new Thread(runCheckTianXingBDRS).start();
Runnable runCheckTianXingDYRS = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingDYRS();
};
new Thread(runCheckTianXingDYRS).start();
Runnable runCheckTianXingJDTC = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingJDTC();
};
new Thread(runCheckTianXingJDTC).start();
Runnable runCheckTianXingMMMY = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingMMMY();
};
new Thread(runCheckTianXingMMMY).start();
Runnable runCheckTianXingMMYJ = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingMMYJ();
};
new Thread(runCheckTianXingMMYJ).start();
Runnable runCheckTianXingOneEnglish = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingOneEnglish();
};
new Thread(runCheckTianXingOneEnglish).start();
Runnable runCheckTianXingPYQ = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingPYQ();
};
new Thread(runCheckTianXingPYQ).start();
Runnable runCheckTianXingQWRS = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingQWRS();
};
new Thread(runCheckTianXingQWRS).start();
Runnable runCheckTianXingTranDict = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingTranDict();
};
new Thread(runCheckTianXingTranDict).start();
Runnable runCheckTianXingWBRS = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingWBRS();
};
new Thread(runCheckTianXingWBRS).start();
Runnable runCheckTianXingWXRS = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingWXRS();
};
new Thread(runCheckTianXingWXRS).start();
Runnable runCheckTianXingWYY = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkTianXingWYY();
};
new Thread(runCheckTianXingWYY).start();
Runnable runCheckYouDaoTranslation = () -> {
log.info("线程启动:" + Thread.currentThread().getName());
this.checkYouDaoTranslation();
};
new Thread(runCheckYouDaoTranslation).start();
//this.checkAlapiJoke();
//this.checkBaiduTranslation();
@ -179,9 +358,30 @@ public class CheckApiStatusTask {
//this.checkLqPoisonChicken();
//this.checkRollBeautyPicture();
//this.checkRollChineseDict();
this.checkRollGarbageSorting();
this.checkRollHistoryToday();
this.checkRollHoliday();
//this.checkRollGarbageSorting();
//this.checkRollHistoryToday();
//this.checkRollHoliday();
//this.checkRollJoke();
//this.checkRollIp();
//this.checkRollIdCardQuery();
//this.checkRollMMYJ();
//this.checkRollMobileBelong();
//this.checkRollSimpleComplex();
//this.checkRollTranslation();
//this.checkRollWeather();
//this.checkTianXingBDRS();
//this.checkTianXingDYRS();
//this.checkTianXingJDTC();
//this.checkTianXingMMMY();
//this.checkTianXingMMYJ();
//this.checkTianXingOneEnglish();
//this.checkTianXingPYQ();
//this.checkTianXingQWRS();
//this.checkTianXingTranDict();
//this.checkTianXingWBRS();
//this.checkTianXingWXRS();
//this.checkTianXingWYY();
//this.checkYouDaoTranslation();
} catch (Exception e) {
@ -189,10 +389,361 @@ public class CheckApiStatusTask {
}
// todo 还剩20多个api检查没写
}
/**
* API
*/
private void checkYouDaoTranslation() {
YouDaoTranslationQo youDaoTranslationQo = new YouDaoTranslationQo();
youDaoTranslationQo.setI(content);
JSONObject jsonObject = youDaoFeignClient.translationApi(youDaoTranslationQo);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(YouDaoFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现有道平台 翻译API异常");
}
/**
* API
*/
private void checkTianXingWYY() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingWYYFeignClient.copyWritingApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingWYYFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 网易云热评API异常");
}
/**
* API
*/
private void checkTianXingWXRS() {
JSONObject jsonObject = tianXingWXRSFeignClient.topSearchApi(tianXingProperties.getKey());
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingWXRSFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 微信热搜榜API异常");
}
/**
* API
*/
private void checkTianXingWBRS() {
JSONObject jsonObject = tianXingWBRSFeignClient.topSearchApi(tianXingProperties.getKey());
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingWBRSFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 微博热搜榜API异常");
}
/**
* API
*/
private void checkTianXingTranDict() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setWord(content);
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingTranDictClient.tranDictApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingTranDictClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 翻译字典API异常");
}
/**
* API
*/
private void checkTianXingQWRS() {
JSONObject jsonObject = tianXingQWRSFeignClient.topSearchApi(tianXingProperties.getKey());
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingQWRSFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 全网热搜榜API异常");
}
/**
* API
*/
private void checkTianXingPYQ() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingPYQFeignClient.copyWritingApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingPYQFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 朋友圈文案API异常");
}
/**
* API
*/
private void checkTianXingOneEnglish() {
com.xjs.oneenglish.domain.RequestBody requestBody = new com.xjs.oneenglish.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingOneEnglishFeignClient.oneEnglishApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingOneEnglishFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 英语一言API异常");
}
/**
* API
*/
private void checkTianXingMMYJ() {
com.xjs.aword.domain.RequestBody requestBody = new com.xjs.aword.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingMMYJFeignClient.aWordApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingMMYJFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 每日一句API异常");
}
/**
* API
*/
private void checkTianXingMMMY() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingMMMYFeignClient.copyWritingApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingMMMYFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 名人名言API异常");
}
/**
* API
*/
private void checkTianXingJDTC() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingJDTCFeignClient.copyWritingApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingJDTCFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 经典台词API异常");
}
/**
* API
*/
private void checkTianXingDYRS() {
JSONObject jsonObject = tianXingDYRSFeignClient.topSearchApi(tianXingProperties.getKey());
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingDYRSFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 抖音热搜榜API异常");
}
/**
* API
*/
private void checkTianXingBDRS() {
JSONObject jsonObject = tianXingBDRSFeignClient.topSearchApi(tianXingProperties.getKey());
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(TianXingBDRSFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现天行平台 百度热搜榜API异常");
}
/**
* ROLL API
*/
private void checkRollWeather() {
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
JSONObject jsonObject1 = rollWeatherFeignClient.nowWeatherApi(requestBody, city);
JSONObject jsonObject2 = rollWeatherFeignClient.forecastWeatherApi(requestBody, city);
if (jsonObject1.containsKey(DEMOTE_ERROR)) {
String[] info = this.getAnnotationInfo(RollWeatherFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 实时天气API异常");
}
if (jsonObject2.containsKey(DEMOTE_ERROR)) {
String[] info = this.getAnnotationInfo(RollWeatherFeignClient.class).get(1);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 预报天气API异常");
}
}
/**
* ROLL API
*/
private void checkRollTranslation() {
RollTranslationQo rollTranslationQo = new RollTranslationQo();
rollTranslationQo.setApp_id(rollProperties.getApp_id());
rollTranslationQo.setApp_secret(rollProperties.getApp_secret());
rollTranslationQo.setContent(content);
JSONObject jsonObject = rollTranslationFeignClient.translationApi(rollTranslationQo);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollTranslationFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 翻译API异常");
}
/**
* ROLL API
*/
private void checkRollSimpleComplex() {
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
requestBody.setType(1);
requestBody.setContent(content);
JSONObject jsonObject = rollSimpleComplexFeignClient.simpleComplexApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollSimpleComplexFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 简繁转换API异常");
}
/**
* ROLL API
*/
private void checkRollMobileBelong() {
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
requestBody.setMobile(mobile);
JSONObject jsonObject = rollMobileBelongFeignClient.mobileBelongApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollMobileBelongFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 手机归属地API异常");
}
/**
* ROLL API
*/
private void checkRollMMYJ() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setCount(20);
requestBody.setApp_id(rollProperties.getApp_id());
requestBody.setApp_secret(rollProperties.getApp_secret());
JSONObject jsonObject = rollMMYJFeignClient.copyWritingApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollMMYJFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 每日一句API异常");
}
/**
* ROLL API
*/
private void checkRollJoke() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setApp_id(rollProperties.getApp_id());
requestBody.setApp_secret(rollProperties.getApp_secret());
JSONObject jsonObject = rollJokeFeignClient.jokeApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollJokeFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 搞笑段子API异常");
}
/**
* ROLL IPAPI
*/
private void checkRollIp() {
com.xjs.copywriting.domain.RequestBody requestBody = new com.xjs.copywriting.domain.RequestBody();
requestBody.setIp(ApiConst.LOCAL_IP);
requestBody.setApp_id(rollProperties.getApp_id());
requestBody.setApp_secret(rollProperties.getApp_secret());
JSONObject jsonObject = rollIPFeignClient.ipApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollIPFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 IP信息API异常");
}
/**
* ROLL API
*/
private void checkRollIdCardQuery() {
com.xjs.apitools.domain.RequestBody requestBody = getRequestBody();
JSONObject jsonObject = rollIdcardQueryFeignClient.idcardQueryApi(requestBody);
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollIdcardQueryFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 身份证查询API异常");
}
/**
* alapiAPI
*/
@ -203,7 +754,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(AlapiJokeAllFeignClient.class);
String[] info = this.getAnnotationInfo(AlapiJokeAllFeignClient.class).get(0);
this.selectAndUpdate(info);
@ -231,7 +782,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(BaiduFeignClient.class);
String[] info = this.getAnnotationInfo(BaiduFeignClient.class).get(0);
this.selectAndUpdate(info);
@ -262,7 +813,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class);
String[] info = this.getAnnotationInfo(GaodeWeatherFeignClient.class).get(0);
this.selectAndUpdate(info);
@ -279,7 +830,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(LqAWordFeignClient.class);
String[] info = this.getAnnotationInfo(LqAWordFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现零七平台 一言API异常");
}
@ -294,7 +845,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(LqDogDiaryFeignClient.class);
String[] info = this.getAnnotationInfo(LqDogDiaryFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现零七平台 舔狗日记API异常");
}
@ -308,7 +859,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(LqPoisonChickenFeignClient.class);
String[] info = this.getAnnotationInfo(LqPoisonChickenFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现零七平台 毒鸡汤API异常");
}
@ -324,7 +875,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(RollBeautyPictureFeignClient.class);
String[] info = this.getAnnotationInfo(RollBeautyPictureFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 美女图片API异常");
@ -340,7 +891,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(RollChineseDictFeignClient.class);
String[] info = this.getAnnotationInfo(RollChineseDictFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 汉语字典API异常");
@ -356,7 +907,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(RollGarbageSortingDeignClient.class);
String[] info = this.getAnnotationInfo(RollGarbageSortingDeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 垃圾分类API异常");
}
@ -372,7 +923,7 @@ public class CheckApiStatusTask {
return;
}
String[] info = this.getAnnotationInfo(RollHistoryTodayFeignClient.class);
String[] info = this.getAnnotationInfo(RollHistoryTodayFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 历史今天API异常");
}
@ -386,8 +937,8 @@ public class CheckApiStatusTask {
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
return;
}
String[] info = this.getAnnotationInfo(RollHolidayFeignClient.class);
this.getAnnotationInfo(RollHolidayFeignClient.class);
String[] info = this.getAnnotationInfo(RollHolidayFeignClient.class).get(0);
this.selectAndUpdate(info);
log.error("检查发现ROLL平台 节假日API异常");
}
@ -412,22 +963,25 @@ public class CheckApiStatusTask {
* @param cls
* @return [0]=name [1]=url
*/
private String[] getAnnotationInfo(Class<?> cls) {
private List<String[]> getAnnotationInfo(Class<?> cls) {
Method[] publicMethods = ReflectUtil.getPublicMethods(cls);
List<String[]> strings = new ArrayList<>();
if (publicMethods.length > 0) {
for (Method method : publicMethods) {
ApiLog annotation = method.getAnnotation(ApiLog.class);
if (annotation != null) {
String name = annotation.name();
String url = annotation.url();
return new String[]{name, url};
strings.add(new String[]{name, url});
}
}
return strings;
}
return null;
strings.add(new String[]{});
return strings;
}
@ -437,7 +991,7 @@ public class CheckApiStatusTask {
* @param info [0]=name [1]=url
*/
private void selectAndUpdate(String[] info) {
if (info != null) {
if (info != null && info.length != 0) {
ApiRecord apiRecord = new ApiRecord();
apiRecord.setApiName(info[0]);
apiRecord.setApiUrl(info[1]);

@ -20,9 +20,9 @@ import javax.annotation.Resource;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-29
* @since 2021-12-29
*/
@Service
public class TianXingJDTCCopyWritingFactory implements CopyWritingFactory {

@ -20,16 +20,16 @@ import javax.annotation.Resource;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-29
* @since 2021-12-29
*/
@Service
public class TianXingMMMYCopyWritingFactory implements CopyWritingFactory {
@Autowired
private TianXingProperties tianXingProperties;
@Autowired
private TianXingMMMYFeignClient tianXingMMMYeignClient;
private TianXingMMMYFeignClient tianXingMMMYFeignClient;
@Resource
private CopyWritingMapper copyWritingMapper;
@ -37,7 +37,7 @@ public class TianXingMMMYCopyWritingFactory implements CopyWritingFactory {
@Transactional
public CopyWriting productCopyWriting(RequestBody requestBody) {
requestBody.setKey(tianXingProperties.getKey());
JSONObject jsonObject = tianXingMMMYeignClient.copyWritingApi(requestBody);
JSONObject jsonObject = tianXingMMMYFeignClient.copyWritingApi(requestBody);
if(jsonObject.containsKey("code")){
if (HttpStatus.HTTP_OK !=jsonObject.getInteger("code")) {
throw new ApiException("天行数据名人名言接口调用异常");

@ -20,9 +20,9 @@ import javax.annotation.Resource;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-27
* @since 2021-12-27
*/
@Service
public class TianXingPYQCopyWritingFactory implements CopyWritingFactory {

@ -20,9 +20,9 @@ import javax.annotation.Resource;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-28
* @since 2021-12-28
*/
@Service
public class TianXingWYYCopyWritingFactory implements CopyWritingFactory {

@ -3,9 +3,9 @@ package com.xjs.oneenglish.domain;
import lombok.Data;
/**
*
* @author xiejs
* @desc
* @create 2021-12-31
* @since 2021-12-31
*/
@Data
public class RequestBody {

@ -25,9 +25,9 @@ import static com.xjs.consts.RedisConst.ONE_ENGLISH;
import static com.xjs.consts.RedisConst.ONE_ENGLISH_EXPIRE;
/**
*
* @author xiejs
* @desc
* @create 2021-12-31
* @since 2021-12-31
*/
@Component
public class TianXingOneEnglishFactory implements OneEnglishFactory {

@ -16,9 +16,10 @@ import org.springframework.stereotype.Component;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
*
* @author xiejs
* @desc
* @create 2021-12-30
* @since 2021-12-30
*/
@Component
public class TianXingTranDictFactory implements TranslationFactory {
@ -47,7 +48,7 @@ public class TianXingTranDictFactory implements TranslationFactory {
} else {
throw new ApiException("api调用成功但返回错误信息");
}
}else {
} else {
translationVo.setTo(" - ");
}
return translationVo;

@ -18,9 +18,9 @@ import java.util.Map;
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
/**
*
* @author xiejs
* @desc
* @create 2021-12-25
* @since 2021-12-25
*/
@Service
public class YouDaoTranslationFactory implements TranslationFactory {

Loading…
Cancel
Save