feat(REQ-3114) - 动态控制 Stream 状态
This commit is contained in:
parent
1a249dbfae
commit
42b6618acf
@ -39,18 +39,17 @@ public class DingtalkController {
|
||||
@PostMapping("/enabled")
|
||||
public CommonResponse<String> changeStream(@RequestParam String appId, @RequestParam Boolean enable) {
|
||||
OpenDingTalkClient client = clientMap.getOrDefault(appId, null);
|
||||
if (Objects.isNull(client)) {
|
||||
return CommonResponse.error("动态调整 Stream 的连接");
|
||||
}
|
||||
try {
|
||||
if (enable) {
|
||||
if (enable && Objects.isNull(client)) {
|
||||
ThirdApplicationReq query = new ThirdApplicationReq();
|
||||
query.setAppId(appId);
|
||||
List<ThirdApplication> applications = thirdApplicationService.genericQuery(query);
|
||||
autoConnector.startStream(applications);
|
||||
} else {
|
||||
client.stop();
|
||||
clientMap.remove(appId);
|
||||
if(Objects.nonNull(client)) {
|
||||
client.stop();
|
||||
clientMap.remove(appId);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return CommonResponse.error(e.getMessage());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user