generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8365cc
commit da64150
Showing
7 changed files
with
55 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/com/wk/paas/service/QueryUserTeamService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.wk.paas.service; | ||
|
||
import cn.hutool.core.lang.TypeReference; | ||
import cn.hutool.http.HttpRequest; | ||
import cn.hutool.http.HttpResponse; | ||
import cn.hutool.json.JSONUtil; | ||
import com.intellij.openapi.ui.Messages; | ||
import com.wakedt.visual.client.organization.dto.TeamDTO; | ||
import com.wakedt.visual.client.user.dto.AccountRoleDTO; | ||
import com.wakedt.visual.client.user.dto.AccountTeamInfo; | ||
import com.wk.paas.config.PlatformServiceConfig; | ||
import com.wk.paas.service.dto.ResultDTO; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* 查询用户所在团队 | ||
*/ | ||
public class QueryUserTeamService { | ||
|
||
public List<TeamDTO> query() { | ||
HttpRequest httpRequest = HttpRequest.post(PlatformServiceConfig.getUrlPrefix() + "/web/account/login/get-account-role"); | ||
HttpResponse response; | ||
try { | ||
response = httpRequest.execute(); | ||
} catch (Exception exception) { | ||
Messages.showMessageDialog(exception.getMessage(), "系统错误", Messages.getErrorIcon()); | ||
return new ArrayList<>(); | ||
} | ||
String result = response.body(); | ||
ResultDTO<AccountRoleDTO> resultDTO = JSONUtil.toBean(result, new TypeReference<ResultDTO<AccountRoleDTO>>() {}.getType(), true); | ||
if (resultDTO == null || !resultDTO.isSuccess()) { | ||
throw new IllegalStateException(Optional.ofNullable(resultDTO).map(ResultDTO::getMsg).orElse("系统错误")); | ||
} | ||
AccountRoleDTO accountRoleDTO = resultDTO.getData(); | ||
if (accountRoleDTO == null) { | ||
return new ArrayList<>(); | ||
} | ||
|
||
List<AccountTeamInfo> accountTeamInfoList = Optional.ofNullable(accountRoleDTO.getAccountTeamInfoList()).orElse(new ArrayList<>()); | ||
return accountTeamInfoList.stream() | ||
.map(AccountTeamInfo::getTeamDTO) | ||
.collect(Collectors.toCollection(ArrayList::new)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/wk/paas/window/cell/TeamListCellRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters