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