parent
b6be46b880
commit
790200a947
@ -0,0 +1,31 @@
|
|||||||
|
package com.xjs.business.english.api;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.system.api.domain.SysFile;
|
||||||
|
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
|
||||||
|
import com.xjs.business.english.api.domain.CopyWriting;
|
||||||
|
import com.xjs.business.english.api.factory.RemoteCopyWritingFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiejs
|
||||||
|
* @desc RPC远程调用文案接口服务
|
||||||
|
* @create 2021-12-27
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteCopyWritingFeign", value = ServiceNameConstants.BUSINESS_ENGLISH_SERVICE, fallbackFactory = RemoteCopyWritingFactory.class)
|
||||||
|
public interface RemoteCopyWritingFeign {
|
||||||
|
/**
|
||||||
|
* 获取文案
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/copyWriting/forPRC")
|
||||||
|
R<CopyWriting> copyWriting();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.xjs.business.english.api.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiejs
|
||||||
|
* @desc 文案实体类
|
||||||
|
* @create 2021-12-27
|
||||||
|
*/
|
||||||
|
public class CopyWriting implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 文案内容 */
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/** 文案来源 */
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(String createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.xjs.business.english.api.factory;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
|
||||||
|
import com.xjs.business.english.api.RemoteCopyWritingFeign;
|
||||||
|
import com.xjs.business.english.api.domain.CopyWriting;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiejs
|
||||||
|
* @desc 文案rpc降级服务处理
|
||||||
|
* @create 2021-12-27
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteCopyWritingFactory implements FallbackFactory<RemoteCopyWritingFeign> {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteCopyWritingFeign create(Throwable cause) {
|
||||||
|
log.error("英语模块文案服务调用失败:{}", cause.getMessage());
|
||||||
|
return () -> R.fail("文案服务调用失败" + cause.getMessage());
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
package com.xjs.common.job;
|
|
||||||
|
|
||||||
import com.xjs.copywriting.factory.CopyWritingFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xiejs
|
|
||||||
* @desc 获取文案定时任务
|
|
||||||
* @create 2021-12-27
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class CopyWritingJob {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CopyWritingFactory tianXingcopyWritingFactory;
|
|
||||||
}
|
|
Loading…
Reference in new issue