Skip to content

Commit

Permalink
feat:根据登录用户展示团队列表
Browse files Browse the repository at this point in the history
  • Loading branch information
Shimmernight committed Jan 16, 2024
1 parent b8365cc commit da64150
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 33 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies {
exclude(group = "org.apache.velocity", module = "velocity-engine-core")
}
// implementation("com.wakedata.common:wd-common-chatgpt:1.2.3-DDD34")
implementation("com.wakedt.visual:wd-visual-ddd-client:1.0.2-RC02")
implementation("cn.hutool:hutool-all:5.8.12")
compileOnly("org.projectlombok:lombok:1.18.26")
annotationProcessor("org.projectlombok:lombok:1.18.26")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/wk/paas/service/QueryTeamService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
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.wk.paas.config.PlatformServiceConfig;
import com.wk.paas.service.dto.ResultDTO;
import com.wk.paas.service.dto.TeamDTO;

import java.util.ArrayList;
import java.util.List;
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/com/wk/paas/service/QueryUserTeamService.java
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));
}
}
27 changes: 0 additions & 27 deletions src/main/java/com/wk/paas/service/dto/TeamDTO.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/com/wk/paas/window/BindAppVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.wakedt.visual.client.organization.dto.TeamDTO;
import com.wk.paas.service.LoginService;
import com.wk.paas.service.QueryAppService;
import com.wk.paas.service.QueryAppVersionService;
import com.wk.paas.service.QueryTeamService;
import com.wk.paas.service.QueryUserTeamService;
import com.wk.paas.service.dto.ApplicationDTO;
import com.wk.paas.service.dto.ApplicationVersionDTO;
import com.wk.paas.service.dto.TeamDTO;
import com.wk.paas.window.cell.AppListCellRenderer;
import com.wk.paas.window.cell.AppVersionListCellRenderer;
import com.wk.paas.window.cell.TeamListCellRenderer;
Expand Down Expand Up @@ -58,7 +58,7 @@ private void updateTeamListData() {
List<TeamDTO> teamDTOList;
try {
new LoginService().login(mail, password);
teamDTOList = new QueryTeamService().query();
teamDTOList = new QueryUserTeamService().query();
} catch (Exception exception) {
Messages.showMessageDialog(this, exception.getMessage(), "系统错误", Messages.getErrorIcon());
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.wk.paas.window.cell;

import com.wk.paas.service.dto.TeamDTO;
import com.wakedt.visual.client.organization.dto.TeamDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.wakedt.visual.client.organization.dto.TeamDTO;
import com.wk.paas.service.dto.ApplicationDTO;
import com.wk.paas.service.dto.ApplicationVersionDTO;
import com.wk.paas.service.dto.TeamDTO;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

Expand Down

0 comments on commit da64150

Please sign in to comment.