parent
a1a047efa4
commit
8e00b924a9
|
|
@ -0,0 +1,28 @@
|
|||
package com.xjs.common.client.factory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.common.client.YouDaoFeignClient;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @desc 有道翻译平台服务降级处理类
|
||||
* @create 2021-12-28
|
||||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
public class YouDaoFeignFactory implements FallbackFactory<YouDaoFeignClient> {
|
||||
|
||||
@Override
|
||||
public YouDaoFeignClient create(Throwable cause) {
|
||||
log.error("英语模块有道翻译服务调用失败:{},执行降级处理", cause.getMessage());
|
||||
return qo -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//构建一个异常json给下层接口处理
|
||||
jsonObject.put("error", 500);
|
||||
return jsonObject;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.xjs.copywriting;
|
||||
package com.xjs.copywriting.controller;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
|
|
@ -37,14 +37,13 @@ public class CopyWritingController {
|
|||
private CopyWritingService copyWritingService;
|
||||
|
||||
//todo 文案管理前端页面,
|
||||
// 第三方api服务降级,
|
||||
// 天行数据整合一个菜单,
|
||||
// 实现其他天行数据接口,
|
||||
// 实现其他朋友圈文案api,
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("文案接口")
|
||||
@Log(title = "文案管理")
|
||||
@Log(title = "获取文案")
|
||||
@RequiresLogin
|
||||
@RequiresPermissions("english:translation:api")
|
||||
public AjaxResult copyWriting(@Validated RequestBody requestBody) {
|
||||
|
|
@ -33,7 +33,7 @@ public class TranslationController {
|
|||
|
||||
@PostMapping
|
||||
@ApiOperation("翻译接口")
|
||||
@Log(title = "翻译管理")
|
||||
@Log(title = "获取翻译")
|
||||
@RequiresLogin
|
||||
@RequiresPermissions("english:translation:api")
|
||||
public AjaxResult translation(@Validated @RequestBody TranslationQo translationQo) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.xjs" level="info" />
|
||||
<!--打印feign DEBUG日志-->
|
||||
<logger name="com.xjs.translation.client" level="debug"/>
|
||||
<logger name="com.xjs.common.client" level="debug"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue