[重大更新] 使用 spring feign 替代 HttpServiceClient (功能太新 支持不完全 使用成本太高)

This commit is contained in:
疯狂的狮子Li
2026-03-23 11:50:48 +08:00
parent b6d2274b53
commit 485c2001ae
63 changed files with 820 additions and 1163 deletions
+7
View File
@@ -22,4 +22,11 @@
ruoyi-api系统接口
</description>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
</dependency>
</dependencies>
</project>
@@ -1,13 +1,15 @@
package org.dromara.resource.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.dromara.resource.api.domain.RemoteFile;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.List;
@@ -16,8 +18,8 @@ import java.util.List;
*
* @author Lion Li
*/
@RemoteHttpService(value = "ruoyi-resource", fallback = RemoteFileServiceFallback.class)
@HttpExchange("/remote/file")
@FeignClient(contextId = "remoteFileService", name = "ruoyi-resource", path = "/remote/file",
fallbackFactory = RemoteFileServiceFallbackFactory.class, primary = false)
public interface RemoteFileService {
/**
@@ -26,7 +28,7 @@ public interface RemoteFileService {
* @param file 文件信息
* @return 结果
*/
@PostExchange("/upload")
@PostMapping("/upload")
RemoteFile upload(@RequestParam String name, @RequestParam String originalFilename,
@RequestParam String contentType, @RequestBody byte[] file) throws ServiceException;
@@ -36,7 +38,7 @@ public interface RemoteFileService {
* @param ossIds ossId串逗号分隔
* @return url串逗号分隔
*/
@GetExchange("/select-url-by-ids")
@GetMapping("/select-url-by-ids")
String selectUrlByIds(@RequestParam String ossIds);
/**
@@ -45,6 +47,7 @@ public interface RemoteFileService {
* @param ossIds ossId串逗号分隔
* @return 列表
*/
@GetExchange("/select-by-ids")
@GetMapping("/select-by-ids")
List<RemoteFile> selectByIds(@RequestParam String ossIds);
}
@@ -1,53 +0,0 @@
package org.dromara.resource.api;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.resource.api.domain.RemoteFile;
import java.util.List;
/**
* 文件服务熔断降级.
*
* @author Lion Li
*/
@Slf4j
public class RemoteFileServiceFallback implements RemoteFileService {
/**
* 上传文件
*
* @param file 文件信息
* @return 结果
*/
@Override
public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
/**
* 通过ossId查询对应的url
*
* @param ossIds ossId串逗号分隔
* @return url串逗号分隔
*/
@Override
public String selectUrlByIds(String ossIds) {
log.warn("服务调用异常 -> 降级处理");
return StringUtils.EMPTY;
}
/**
* 通过ossId查询列表
*
* @param ossIds ossId串逗号分隔
* @return 列表
*/
@Override
public List<RemoteFile> selectByIds(String ossIds) {
log.warn("服务调用异常 -> 降级处理");
return List.of();
}
}
@@ -0,0 +1,40 @@
package org.dromara.resource.api;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.resource.api.domain.RemoteFile;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
/**
* 文件服务 fallback factory.
*
* @author Lion Li
*/
@Slf4j
public class RemoteFileServiceFallbackFactory implements FallbackFactory<RemoteFileService> {
@Override
public RemoteFileService create(Throwable cause) {
return new RemoteFileService() {
@Override
public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) {
log.warn("文件服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public String selectUrlByIds(String ossIds) {
log.warn("文件服务调用失败, 已触发 fallback", cause);
return StringUtils.EMPTY;
}
@Override
public List<RemoteFile> selectByIds(String ossIds) {
log.warn("文件服务调用失败, 已触发 fallback", cause);
return List.of();
}
};
}
}
@@ -1,18 +1,17 @@
package org.dromara.resource.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
/**
* 邮件服务
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-resource")
@HttpExchange("/remote/mail")
@FeignClient(contextId = "remoteMailService", name = "ruoyi-resource", path = "/remote/mail", primary = false)
public interface RemoteMailService {
/**
@@ -22,7 +21,9 @@ public interface RemoteMailService {
* @param subject 标题
* @param text 内容
*/
@PostExchange("/send")
@PostMapping("/send")
void send(@RequestParam String to, @RequestParam String subject, @RequestParam String text) throws ServiceException;
}
@@ -1,10 +1,13 @@
package org.dromara.resource.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.List;
@@ -13,8 +16,8 @@ import java.util.List;
*
* @author Lion Li
*/
@RemoteHttpService(value = "ruoyi-resource", fallback = RemoteMessageServiceFallback.class)
@HttpExchange("/remote/message")
@FeignClient(contextId = "remoteMessageService", name = "ruoyi-resource", path = "/remote/message",
fallbackFactory = RemoteMessageServiceFallbackFactory.class, primary = false)
public interface RemoteMessageService {
/**
@@ -23,7 +26,7 @@ public interface RemoteMessageService {
* @param sessionKey session主键 一般为用户id
* @param message 消息文本
*/
@PostExchange("/publish-message")
@PostMapping("/publish-message")
void publishMessage(@RequestBody List<Long> sessionKey, @RequestParam String message);
/**
@@ -31,6 +34,7 @@ public interface RemoteMessageService {
*
* @param message 消息内容
*/
@PostExchange("/publish-all")
@PostMapping("/publish-all")
void publishAll(@RequestParam String message);
}
@@ -1,35 +0,0 @@
package org.dromara.resource.api;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* 消息服务熔断降级.
*
* @author Lion Li
*/
@Slf4j
public class RemoteMessageServiceFallback implements RemoteMessageService {
/**
* 发送消息
*
* @param sessionKey session主键 一般为用户id
* @param message 消息文本
*/
@Override
public void publishMessage(List<Long> sessionKey, String message) {
log.warn("消息服务调用失败, 已触发熔断降级");
}
/**
* 发布订阅的消息(群发)
*
* @param message 消息内容
*/
@Override
public void publishAll(String message) {
log.warn("消息服务调用失败, 已触发熔断降级");
}
}
@@ -0,0 +1,30 @@
package org.dromara.resource.api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
/**
* 消息服务 fallback factory.
*
* @author Lion Li
*/
@Slf4j
public class RemoteMessageServiceFallbackFactory implements FallbackFactory<RemoteMessageService> {
@Override
public RemoteMessageService create(Throwable cause) {
return new RemoteMessageService() {
@Override
public void publishMessage(List<Long> sessionKey, String message) {
log.warn("消息服务调用失败, 已触发 fallback", cause);
}
@Override
public void publishAll(String message) {
log.warn("消息服务调用失败, 已触发 fallback", cause);
}
};
}
}
@@ -1,13 +1,16 @@
package org.dromara.resource.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.resource.api.domain.RemoteSms;
import org.dromara.resource.api.domain.RemoteSmsBatch;
import org.dromara.resource.api.domain.RemoteSmsDelayBatch;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.LinkedHashMap;
import java.util.List;
@@ -17,8 +20,7 @@ import java.util.List;
*
* @author Feng
*/
@RemoteHttpService("ruoyi-resource")
@HttpExchange("/inner/remote/resource/sms")
@FeignClient(contextId = "remoteSmsService", name = "ruoyi-resource", path = "/inner/remote/resource/sms", primary = false)
public interface RemoteSmsService {
/**
@@ -28,7 +30,7 @@ public interface RemoteSmsService {
* @param message 短信内容
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/send-text")
@PostMapping("/send-text")
RemoteSms sendMessage(@RequestParam String phone, @RequestParam String message);
/**
@@ -38,7 +40,7 @@ public interface RemoteSmsService {
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/send-vars")
@PostMapping("/send-vars")
RemoteSms sendMessage(@RequestParam String phone, @RequestBody LinkedHashMap<String, String> messages);
/**
@@ -49,7 +51,7 @@ public interface RemoteSmsService {
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/send-template")
@PostMapping("/send-template")
RemoteSms sendMessage(@RequestParam String phone, @RequestParam String templateId,
@RequestBody LinkedHashMap<String, String> messages);
@@ -60,7 +62,7 @@ public interface RemoteSmsService {
* @param message 短信内容
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/message-texting")
@PostMapping("/message-texting")
RemoteSms messageTexting(@RequestBody List<String> phones, @RequestParam String message);
/**
@@ -71,7 +73,7 @@ public interface RemoteSmsService {
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/message-texting-template")
@PostMapping("/message-texting-template")
default RemoteSms messageTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages) {
return messageTextingTemplate(new RemoteSmsBatch(phones, templateId, messages));
}
@@ -82,7 +84,7 @@ public interface RemoteSmsService {
* @param request 群发模板短信请求
* @return 封装了短信发送结果的 RemoteSms 对象
*/
@PostExchange("/message-texting-template")
@PostMapping("/message-texting-template")
RemoteSms messageTextingTemplate(@RequestBody RemoteSmsBatch request);
/**
@@ -91,7 +93,7 @@ public interface RemoteSmsService {
* @param phone 目标手机号
* @param message 短信内容
*/
@PostExchange("/send-async-text")
@PostMapping("/send-async-text")
void sendMessageAsync(@RequestParam String phone, @RequestParam String message);
/**
@@ -101,7 +103,7 @@ public interface RemoteSmsService {
* @param templateId 短信模板ID
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
*/
@PostExchange("/send-async-template")
@PostMapping("/send-async-template")
void sendMessageAsync(@RequestParam String phone, @RequestParam String templateId,
@RequestBody LinkedHashMap<String, String> messages);
@@ -112,7 +114,7 @@ public interface RemoteSmsService {
* @param message 短信内容
* @param delayedTime 延迟发送时间(毫秒)
*/
@PostExchange("/delay-text")
@PostMapping("/delay-text")
void delayMessage(@RequestParam String phone, @RequestParam String message, @RequestParam Long delayedTime);
/**
@@ -123,7 +125,7 @@ public interface RemoteSmsService {
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
* @param delayedTime 延迟发送时间(毫秒)
*/
@PostExchange("/delay-template")
@PostMapping("/delay-template")
void delayMessage(@RequestParam String phone, @RequestParam String templateId,
@RequestBody LinkedHashMap<String, String> messages, @RequestParam Long delayedTime);
@@ -134,7 +136,7 @@ public interface RemoteSmsService {
* @param message 短信内容
* @param delayedTime 延迟发送时间(毫秒)
*/
@PostExchange("/delay-message-texting")
@PostMapping("/delay-message-texting")
void delayMessageTexting(@RequestBody List<String> phones, @RequestParam String message, @RequestParam Long delayedTime);
/**
@@ -145,7 +147,7 @@ public interface RemoteSmsService {
* @param messages 短信模板参数,使用 LinkedHashMap 以保持参数顺序
* @param delayedTime 延迟发送时间(毫秒)
*/
@PostExchange("/delay-message-texting-template")
@PostMapping("/delay-message-texting-template")
default void delayMessageTexting(List<String> phones, String templateId,
LinkedHashMap<String, String> messages, Long delayedTime) {
delayMessageTextingTemplate(new RemoteSmsDelayBatch(phones, templateId, messages, delayedTime));
@@ -156,7 +158,7 @@ public interface RemoteSmsService {
*
* @param request 延迟群发模板短信请求
*/
@PostExchange("/delay-message-texting-template")
@PostMapping("/delay-message-texting-template")
void delayMessageTextingTemplate(@RequestBody RemoteSmsDelayBatch request);
/**
@@ -164,7 +166,7 @@ public interface RemoteSmsService {
*
* @param phone 手机号
*/
@PostExchange("/add-blacklist-one")
@PostMapping("/add-blacklist-one")
void addBlacklist(@RequestParam String phone);
/**
@@ -172,7 +174,7 @@ public interface RemoteSmsService {
*
* @param phones 手机号列表
*/
@PostExchange("/add-blacklist-list")
@PostMapping("/add-blacklist-list")
void addBlacklist(@RequestBody List<String> phones);
/**
@@ -180,7 +182,7 @@ public interface RemoteSmsService {
*
* @param phone 手机号
*/
@PostExchange("/remove-blacklist-one")
@PostMapping("/remove-blacklist-one")
void removeBlacklist(@RequestParam String phone);
/**
@@ -188,7 +190,8 @@ public interface RemoteSmsService {
*
* @param phones 手机号
*/
@PostExchange("/remove-blacklist-list")
@PostMapping("/remove-blacklist-list")
void removeBlacklist(@RequestBody List<String> phones);
}
@@ -1,18 +1,20 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.vo.RemoteClientVo;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
/**
* 客户端服务
*
* @author Michelle.Chung
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/client")
@FeignClient(contextId = "remoteClientService", name = "ruoyi-system", path = "/remote/client", primary = false)
public interface RemoteClientService {
/**
@@ -21,7 +23,8 @@ public interface RemoteClientService {
* @param clientId 客户端id
* @return 客户端对象
*/
@GetExchange("/query-by-client-id")
@GetMapping("/query-by-client-id")
RemoteClientVo queryByClientId(@RequestParam String clientId);
}
@@ -1,12 +1,15 @@
package org.dromara.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Dict;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.dromara.common.json.utils.JsonUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import java.math.BigDecimal;
import java.util.List;
@@ -16,15 +19,14 @@ import java.util.List;
*
* @author Michelle.Chung
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/config")
@FeignClient(contextId = "remoteConfigService", name = "ruoyi-system", path = "/remote/config", primary = false)
public interface RemoteConfigService {
/**
* 获取注册开关
* @return true开启,false关闭
*/
@GetExchange("/select-register-enabled")
@GetMapping("/select-register-enabled")
boolean selectRegisterEnabled();
/**
@@ -33,7 +35,7 @@ public interface RemoteConfigService {
* @param configKey 参数 key
* @return 参数值
*/
@GetExchange("/get-config-value")
@GetMapping("/get-config-value")
String getConfigValue(@RequestParam String configKey);
/**
@@ -121,3 +123,4 @@ public interface RemoteConfigService {
}
}
@@ -1,17 +1,19 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
/**
* 数据权限服务
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/data-scope")
@FeignClient(contextId = "remoteDataScopeService", name = "ruoyi-system", path = "/remote/data-scope", primary = false)
public interface RemoteDataScopeService {
/**
@@ -20,7 +22,7 @@ public interface RemoteDataScopeService {
* @param roleId 角色ID
* @return 返回角色的自定义权限语句,如果没有找到则返回 null
*/
@GetExchange("/role-custom")
@GetMapping("/role-custom")
String getRoleCustom(@RequestParam Long roleId);
/**
@@ -29,7 +31,8 @@ public interface RemoteDataScopeService {
* @param deptId 部门ID
* @return 返回部门及其下级的权限语句,如果没有找到则返回 null
*/
@GetExchange("/dept-and-child")
@GetMapping("/dept-and-child")
String getDeptAndChild(@RequestParam Long deptId);
}
@@ -1,12 +1,14 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.vo.RemoteDeptVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.Collection;
import java.util.List;
@@ -17,8 +19,7 @@ import java.util.Map;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/dept")
@FeignClient(contextId = "remoteDeptService", name = "ruoyi-system", path = "/remote/dept", primary = false)
public interface RemoteDeptService {
/**
@@ -27,7 +28,7 @@ public interface RemoteDeptService {
* @param deptIds 部门ID串逗号分隔
* @return 部门名称串逗号分隔
*/
@GetExchange("/select-dept-name-by-ids")
@GetMapping("/select-dept-name-by-ids")
String selectDeptNameByIds(@RequestParam String deptIds);
/**
@@ -36,7 +37,7 @@ public interface RemoteDeptService {
* @param deptId 部门ID,用于指定需要查询的部门
* @return 返回该部门的负责人ID
*/
@GetExchange("/select-dept-leader-by-id")
@GetMapping("/select-dept-leader-by-id")
Long selectDeptLeaderById(@RequestParam Long deptId);
/**
@@ -44,7 +45,7 @@ public interface RemoteDeptService {
*
* @return 部门列表
*/
@GetExchange("/select-depts-by-list")
@GetMapping("/select-depts-by-list")
List<RemoteDeptVo> selectDeptsByList();
/**
@@ -53,7 +54,8 @@ public interface RemoteDeptService {
* @param deptIds 部门 ID 列表
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
*/
@PostExchange("/select-dept-names-by-ids")
@PostMapping("/select-dept-names-by-ids")
Map<Long, String> selectDeptNamesByIds(@RequestBody Collection<Long> deptIds);
}
@@ -1,11 +1,14 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
import org.dromara.system.api.domain.vo.RemoteDictTypeVo;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import java.util.List;
@@ -14,8 +17,7 @@ import java.util.List;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/dict")
@FeignClient(contextId = "remoteDictService", name = "ruoyi-system", path = "/remote/dict", primary = false)
public interface RemoteDictService {
/**
@@ -24,7 +26,7 @@ public interface RemoteDictService {
* @param dictType 字典类型
* @return 字典类型
*/
@GetExchange("/select-dict-type-by-type")
@GetMapping("/select-dict-type-by-type")
RemoteDictTypeVo selectDictTypeByType(@RequestParam String dictType);
/**
@@ -33,7 +35,8 @@ public interface RemoteDictService {
* @param dictType 字典类型
* @return 字典数据集合信息
*/
@GetExchange("/select-dict-data-by-type")
@GetMapping("/select-dict-data-by-type")
List<RemoteDictDataVo> selectDictDataByType(@RequestParam String dictType);
}
@@ -1,19 +1,21 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.bo.RemoteLoginInfoBo;
import org.dromara.system.api.domain.bo.RemoteOperLogBo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
/**
* 日志服务
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/log")
@FeignClient(contextId = "remoteLogService", name = "ruoyi-system", path = "/remote/log", primary = false)
public interface RemoteLogService {
/**
@@ -21,7 +23,7 @@ public interface RemoteLogService {
*
* @param sysOperLog 日志实体
*/
@PostExchange("/save-log")
@PostMapping("/save-log")
void saveLog(@RequestBody RemoteOperLogBo sysOperLog);
/**
@@ -29,7 +31,8 @@ public interface RemoteLogService {
*
* @param sysLoginInfo 访问实体
*/
@PostExchange("/save-login-info")
@PostMapping("/save-login-info")
void saveLoginInfo(@RequestBody RemoteLoginInfoBo sysLoginInfo);
}
@@ -1,9 +1,12 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import java.util.Set;
@@ -12,8 +15,7 @@ import java.util.Set;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/permission")
@FeignClient(contextId = "remotePermissionService", name = "ruoyi-system", path = "/remote/permission", primary = false)
public interface RemotePermissionService {
/**
@@ -22,7 +24,7 @@ public interface RemotePermissionService {
* @param userId 用户id
* @return 角色权限信息
*/
@GetExchange("/role-permission")
@GetMapping("/role-permission")
Set<String> getRolePermission(@RequestParam Long userId);
/**
@@ -31,7 +33,8 @@ public interface RemotePermissionService {
* @param userId 用户id
* @return 菜单权限信息
*/
@GetExchange("/menu-permission")
@GetMapping("/menu-permission")
Set<String> getMenuPermission(@RequestParam Long userId);
}
@@ -1,9 +1,12 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.Collection;
import java.util.Map;
@@ -13,8 +16,7 @@ import java.util.Map;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/post")
@FeignClient(contextId = "remotePostService", name = "ruoyi-system", path = "/remote/post", primary = false)
public interface RemotePostService {
/**
@@ -23,7 +25,8 @@ public interface RemotePostService {
* @param postIds 岗位 ID 列表
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
*/
@PostExchange("/select-post-names-by-ids")
@PostMapping("/select-post-names-by-ids")
Map<Long, String> selectPostNamesByIds(@RequestBody Collection<Long> postIds);
}
@@ -1,9 +1,12 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.Collection;
import java.util.Map;
@@ -13,8 +16,7 @@ import java.util.Map;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/role")
@FeignClient(contextId = "remoteRoleService", name = "ruoyi-system", path = "/remote/role", primary = false)
public interface RemoteRoleService {
/**
@@ -23,7 +25,8 @@ public interface RemoteRoleService {
* @param roleIds 角色 ID 列表
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
*/
@PostExchange("/select-role-names-by-ids")
@PostMapping("/select-role-names-by-ids")
Map<Long, String> selectRoleNamesByIds(@RequestBody Collection<Long> roleIds);
}
@@ -1,13 +1,15 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.bo.RemoteSocialBo;
import org.dromara.system.api.domain.vo.RemoteSocialVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.List;
@@ -16,8 +18,7 @@ import java.util.List;
*
* @author Michelle.Chung
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/social")
@FeignClient(contextId = "remoteSocialService", name = "ruoyi-system", path = "/remote/social", primary = false)
public interface RemoteSocialService {
/**
@@ -26,7 +27,7 @@ public interface RemoteSocialService {
* @param authId 认证id
* @return 授权信息
*/
@GetExchange("/select-by-auth-id")
@GetMapping("/select-by-auth-id")
List<RemoteSocialVo> selectByAuthId(@RequestParam String authId);
/**
@@ -34,7 +35,7 @@ public interface RemoteSocialService {
*
* @param bo 社会化关系业务对象
*/
@PostExchange("/query-list")
@PostMapping("/query-list")
List<RemoteSocialVo> queryList(@RequestBody RemoteSocialBo bo);
/**
@@ -42,7 +43,7 @@ public interface RemoteSocialService {
*
* @param bo 社会化关系业务对象
*/
@PostExchange("/insert-by-bo")
@PostMapping("/insert-by-bo")
void insertByBo(@RequestBody RemoteSocialBo bo);
/**
@@ -50,7 +51,7 @@ public interface RemoteSocialService {
*
* @param bo 社会化关系业务对象
*/
@PostExchange("/update-by-bo")
@PostMapping("/update-by-bo")
void updateByBo(@RequestBody RemoteSocialBo bo);
/**
@@ -59,7 +60,8 @@ public interface RemoteSocialService {
* @param socialId 社会化关系ID
* @return 结果
*/
@PostExchange("/delete-with-valid-by-id")
@PostMapping("/delete-with-valid-by-id")
Boolean deleteWithValidById(@RequestParam Long socialId);
}
@@ -1,19 +1,21 @@
package org.dromara.system.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.system.api.domain.bo.RemoteTaskAssigneeBo;
import org.dromara.system.api.domain.vo.RemoteTaskAssigneeVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
/**
* 工作流设计器获取任务执行人
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/task-assignee")
@FeignClient(contextId = "remoteTaskAssigneeService", name = "ruoyi-system", path = "/remote/task-assignee", primary = false)
public interface RemoteTaskAssigneeService {
/**
@@ -22,7 +24,7 @@ public interface RemoteTaskAssigneeService {
* @param taskQuery 查询条件
* @return 办理人
*/
@PostExchange("/select-roles")
@PostMapping("/select-roles")
RemoteTaskAssigneeVo selectRolesByTaskAssigneeList(@RequestBody RemoteTaskAssigneeBo taskQuery);
/**
@@ -31,7 +33,7 @@ public interface RemoteTaskAssigneeService {
* @param taskQuery 查询条件
* @return 办理人
*/
@PostExchange("/select-posts")
@PostMapping("/select-posts")
RemoteTaskAssigneeVo selectPostsByTaskAssigneeList(@RequestBody RemoteTaskAssigneeBo taskQuery);
/**
@@ -40,7 +42,7 @@ public interface RemoteTaskAssigneeService {
* @param taskQuery 查询条件
* @return 办理人
*/
@PostExchange("/select-depts")
@PostMapping("/select-depts")
RemoteTaskAssigneeVo selectDeptsByTaskAssigneeList(@RequestBody RemoteTaskAssigneeBo taskQuery);
/**
@@ -49,7 +51,8 @@ public interface RemoteTaskAssigneeService {
* @param taskQuery 查询条件
* @return 办理人
*/
@PostExchange("/select-users")
@PostMapping("/select-users")
RemoteTaskAssigneeVo selectUsersByTaskAssigneeList(@RequestBody RemoteTaskAssigneeBo taskQuery);
}
@@ -1,17 +1,19 @@
package org.dromara.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.exception.user.UserException;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.dromara.system.api.domain.bo.RemoteUserBo;
import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.dromara.system.api.model.LoginUser;
import org.dromara.system.api.model.XcxLoginUser;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.Collection;
import java.util.List;
@@ -22,8 +24,7 @@ import java.util.Map;
*
* @author Lion Li
*/
@RemoteHttpService("ruoyi-system")
@HttpExchange("/remote/user")
@FeignClient(contextId = "remoteUserService", name = "ruoyi-system", path = "/remote/user", primary = false)
public interface RemoteUserService {
/**
@@ -32,7 +33,7 @@ public interface RemoteUserService {
* @param username 用户名
* @return 结果
*/
@GetExchange("/get-by-username")
@GetMapping("/get-by-username")
LoginUser getUserInfo(@RequestParam String username) throws UserException;
/**
@@ -41,7 +42,7 @@ public interface RemoteUserService {
* @param userId 用户id
* @return 结果
*/
@GetExchange("/get-by-id")
@GetMapping("/get-by-id")
LoginUser getUserInfo(@RequestParam Long userId) throws UserException;
/**
@@ -50,7 +51,7 @@ public interface RemoteUserService {
* @param phonenumber 手机号
* @return 结果
*/
@GetExchange("/get-by-phonenumber")
@GetMapping("/get-by-phonenumber")
LoginUser getUserInfoByPhonenumber(@RequestParam String phonenumber) throws UserException;
/**
@@ -59,7 +60,7 @@ public interface RemoteUserService {
* @param email 邮箱
* @return 结果
*/
@GetExchange("/get-by-email")
@GetMapping("/get-by-email")
LoginUser getUserInfoByEmail(@RequestParam String email) throws UserException;
/**
@@ -68,7 +69,7 @@ public interface RemoteUserService {
* @param openid openid
* @return 结果
*/
@GetExchange("/get-by-openid")
@GetMapping("/get-by-openid")
XcxLoginUser getUserInfoByOpenid(@RequestParam String openid) throws UserException;
/**
@@ -77,7 +78,7 @@ public interface RemoteUserService {
* @param remoteUserBo 用户信息
* @return 结果
*/
@PostExchange("/register-user-info")
@PostMapping("/register-user-info")
Boolean registerUserInfo(@RequestBody RemoteUserBo remoteUserBo) throws UserException, ServiceException;
/**
@@ -86,7 +87,7 @@ public interface RemoteUserService {
* @param userId 用户id
* @return 结果
*/
@GetExchange("/select-username-by-id")
@GetMapping("/select-username-by-id")
String selectUserNameById(@RequestParam Long userId);
/**
@@ -95,7 +96,7 @@ public interface RemoteUserService {
* @param userId 用户ID
* @return 用户昵称
*/
@GetExchange("/select-nickname-by-id")
@GetMapping("/select-nickname-by-id")
String selectNicknameById(@RequestParam Long userId);
/**
@@ -104,7 +105,7 @@ public interface RemoteUserService {
* @param userIds 用户ID 多个用逗号隔开
* @return 用户昵称
*/
@GetExchange("/select-nickname-by-ids")
@GetMapping("/select-nickname-by-ids")
String selectNicknameByIds(@RequestParam String userIds);
/**
@@ -113,7 +114,7 @@ public interface RemoteUserService {
* @param userId 用户id
* @return 用户手机号
*/
@GetExchange("/select-phonenumber-by-id")
@GetMapping("/select-phonenumber-by-id")
String selectPhonenumberById(@RequestParam Long userId);
/**
@@ -122,7 +123,7 @@ public interface RemoteUserService {
* @param userId 用户id
* @return 用户邮箱
*/
@GetExchange("/select-email-by-id")
@GetMapping("/select-email-by-id")
String selectEmailById(@RequestParam Long userId);
/**
@@ -131,7 +132,7 @@ public interface RemoteUserService {
* @param userId 用户ID
* @param ip IP地址
*/
@PostExchange("/record-login-info")
@PostMapping("/record-login-info")
void recordLoginInfo(@RequestParam Long userId, @RequestParam String ip);
/**
@@ -140,7 +141,7 @@ public interface RemoteUserService {
* @param userIds 用户ids
* @return 用户列表
*/
@PostExchange("/select-list-by-ids")
@PostMapping("/select-list-by-ids")
List<RemoteUserVo> selectListByIds(@RequestBody Collection<Long> userIds);
/**
@@ -149,7 +150,7 @@ public interface RemoteUserService {
* @param roleIds 角色ids
* @return 用户ids
*/
@PostExchange("/select-user-ids-by-role-ids")
@PostMapping("/select-user-ids-by-role-ids")
List<Long> selectUserIdsByRoleIds(@RequestBody Collection<Long> roleIds);
/**
@@ -158,7 +159,7 @@ public interface RemoteUserService {
* @param roleIds 角色ids
* @return 用户
*/
@PostExchange("/select-users-by-role-ids")
@PostMapping("/select-users-by-role-ids")
List<RemoteUserVo> selectUsersByRoleIds(@RequestBody Collection<Long> roleIds);
/**
@@ -167,7 +168,7 @@ public interface RemoteUserService {
* @param deptIds 部门ids
* @return 用户
*/
@PostExchange("/select-users-by-dept-ids")
@PostMapping("/select-users-by-dept-ids")
List<RemoteUserVo> selectUsersByDeptIds(@RequestBody Collection<Long> deptIds);
/**
@@ -176,7 +177,7 @@ public interface RemoteUserService {
* @param postIds 岗位ids
* @return 用户
*/
@PostExchange("/select-users-by-post-ids")
@PostMapping("/select-users-by-post-ids")
List<RemoteUserVo> selectUsersByPostIds(@RequestBody Collection<Long> postIds);
/**
@@ -185,7 +186,8 @@ public interface RemoteUserService {
* @param userIds 用户 ID 列表
* @return Map,其中 key 为用户 ID,value 为对应的用户昵称
*/
@PostExchange("/select-user-nicks-by-ids")
@PostMapping("/select-user-nicks-by-ids")
Map<Long, String> selectUserNicksByIds(@RequestBody Collection<Long> userIds);
}
@@ -1,14 +1,16 @@
package org.dromara.workflow.api;
import org.dromara.common.core.annotation.RemoteHttpService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.dromara.workflow.api.domain.RemoteCompleteTask;
import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.dromara.workflow.api.domain.RemoteStartProcessReturn;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.List;
import java.util.Map;
@@ -19,8 +21,8 @@ import java.util.Map;
* @Author ZETA
* @Date 2024/6/3
*/
@RemoteHttpService(value = "ruoyi-workflow", fallback = RemoteWorkflowServiceFallback.class)
@HttpExchange("/remote/workflow")
@FeignClient(contextId = "remoteWorkflowService", name = "ruoyi-workflow", path = "/remote/workflow",
fallbackFactory = RemoteWorkflowServiceFallbackFactory.class, primary = false)
public interface RemoteWorkflowService {
/**
@@ -29,7 +31,7 @@ public interface RemoteWorkflowService {
* @param businessIds 业务id
* @return 结果
*/
@PostExchange("/delete-instance")
@PostMapping("/delete-instance")
boolean deleteInstance(@RequestBody List<String> businessIds);
/**
@@ -38,7 +40,7 @@ public interface RemoteWorkflowService {
* @param taskId 任务id
* @return 状态
*/
@GetExchange("/business-status-by-task-id")
@GetMapping("/business-status-by-task-id")
String getBusinessStatusByTaskId(@RequestParam Long taskId);
/**
@@ -47,7 +49,7 @@ public interface RemoteWorkflowService {
* @param businessId 业务id
* @return 状态
*/
@GetExchange("/business-status")
@GetMapping("/business-status")
String getBusinessStatus(@RequestParam String businessId);
/**
@@ -56,7 +58,7 @@ public interface RemoteWorkflowService {
* @param instanceId 流程实例id
* @param variable 流程变量
*/
@PostExchange("/set-variable")
@PostMapping("/set-variable")
void setVariable(@RequestParam Long instanceId, @RequestBody Map<String, Object> variable);
/**
@@ -64,7 +66,7 @@ public interface RemoteWorkflowService {
*
* @param instanceId 流程实例id
*/
@GetExchange("/instance-variable")
@GetMapping("/instance-variable")
Map<String, Object> instanceVariable(@RequestParam Long instanceId);
/**
@@ -73,7 +75,7 @@ public interface RemoteWorkflowService {
* @param businessId 业务id
* @return 结果
*/
@GetExchange("/instance-id-by-business-id")
@GetMapping("/instance-id-by-business-id")
Long getInstanceIdByBusinessId(@RequestParam String businessId);
/**
@@ -82,7 +84,7 @@ public interface RemoteWorkflowService {
* @param startProcess 参数
* @return 结果
*/
@PostExchange("/start-workflow")
@PostMapping("/start-workflow")
RemoteStartProcessReturn startWorkFlow(@RequestBody RemoteStartProcess startProcess);
/**
@@ -91,7 +93,7 @@ public interface RemoteWorkflowService {
* @param completeTask 参数
* @return 结果
*/
@PostExchange("/complete-task")
@PostMapping("/complete-task")
boolean completeTask(@RequestBody RemoteCompleteTask completeTask);
@@ -102,7 +104,7 @@ public interface RemoteWorkflowService {
* @param message 办理意见
* @return 结果
*/
@PostExchange("/complete-task-simple")
@PostMapping("/complete-task-simple")
boolean completeTask(@RequestParam Long taskId, @RequestParam String message);
/**
@@ -111,7 +113,8 @@ public interface RemoteWorkflowService {
* @param startProcess 参数
* @return 结果
*/
@PostExchange("/start-complete-task")
@PostMapping("/start-complete-task")
boolean startCompleteTask(@RequestBody RemoteStartProcess startProcess);
}
@@ -1,78 +0,0 @@
package org.dromara.workflow.api;
import lombok.extern.slf4j.Slf4j;
import org.dromara.workflow.api.domain.RemoteCompleteTask;
import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.dromara.workflow.api.domain.RemoteStartProcessReturn;
import java.util.List;
import java.util.Map;
/**
* 工作流服务熔断降级.
*
* @author Lion Li
*/
@Slf4j
public class RemoteWorkflowServiceFallback implements RemoteWorkflowService {
@Override
public boolean deleteInstance(List<String> businessIds) {
log.warn("服务调用异常 -> 降级处理");
return false;
}
@Override
public String getBusinessStatusByTaskId(Long taskId) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
@Override
public String getBusinessStatus(String businessId) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
@Override
public void setVariable(Long instanceId, Map<String, Object> variable) {
log.warn("服务调用异常 -> 降级处理");
}
@Override
public Map<String, Object> instanceVariable(Long instanceId) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
@Override
public Long getInstanceIdByBusinessId(String businessId) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
@Override
public RemoteStartProcessReturn startWorkFlow(RemoteStartProcess startProcess) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
@Override
public boolean completeTask(RemoteCompleteTask completeTask) {
log.warn("服务调用异常 -> 降级处理");
return false;
}
@Override
public boolean completeTask(Long taskId, String message) {
log.warn("服务调用异常 -> 降级处理");
return false;
}
@Override
public boolean startCompleteTask(RemoteStartProcess startProcess) {
log.warn("服务调用异常 -> 降级处理");
return false;
}
}
@@ -0,0 +1,83 @@
package org.dromara.workflow.api;
import lombok.extern.slf4j.Slf4j;
import org.dromara.workflow.api.domain.RemoteCompleteTask;
import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.dromara.workflow.api.domain.RemoteStartProcessReturn;
import org.springframework.cloud.openfeign.FallbackFactory;
import java.util.List;
import java.util.Map;
/**
* 工作流服务 fallback factory.
*
* @author Lion Li
*/
@Slf4j
public class RemoteWorkflowServiceFallbackFactory implements FallbackFactory<RemoteWorkflowService> {
@Override
public RemoteWorkflowService create(Throwable cause) {
return new RemoteWorkflowService() {
@Override
public boolean deleteInstance(List<String> businessIds) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return false;
}
@Override
public String getBusinessStatusByTaskId(Long taskId) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public String getBusinessStatus(String businessId) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public void setVariable(Long instanceId, Map<String, Object> variable) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
}
@Override
public Map<String, Object> instanceVariable(Long instanceId) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public Long getInstanceIdByBusinessId(String businessId) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public RemoteStartProcessReturn startWorkFlow(RemoteStartProcess startProcess) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return null;
}
@Override
public boolean completeTask(RemoteCompleteTask completeTask) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return false;
}
@Override
public boolean completeTask(Long taskId, String message) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return false;
}
@Override
public boolean startCompleteTask(RemoteStartProcess startProcess) {
log.warn("工作流服务调用失败, 已触发 fallback", cause);
return false;
}
};
}
}