Commit d01629f4 by zhiwj

资源组添加应用授权

parent 676e111d
......@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
......@@ -62,17 +63,23 @@ public class ResourceController {
@RequestMapping("/list-resource-app")
public RestResponse listResourceApp() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
Integer enterpriseId = 100;
ServiceResponse<List<ApplicationDTO>> appServiceResponse = appTokenApiService.listApplicationByEnterpriseId(Long.valueOf(enterpriseId), 0);
if (!appServiceResponse.isSuccess()) {
return ResultControllerUtils.commonResult(appServiceResponse);
}
List<ApplicationDTO> appDTOList = appServiceResponse.getResult();
List<ApplicationVO> appVOList = EntityUtil.changeEntityListByJSON(ApplicationVO.class, appDTOList);
for (ApplicationVO applicationVO : appVOList) {
ServiceResponse<List<ApplicationSubDTO>> subServiceResponse = applicationSubApiService.listSubApp(enterpriseId, applicationVO.getApplicationId());
List<ApplicationVO> appVOList = new ArrayList<>(appDTOList.size());
for (ApplicationDTO applicationDTO : appDTOList) {
ServiceResponse<List<ApplicationSubDTO>> subServiceResponse = applicationSubApiService.listSubApp(enterpriseId, applicationDTO.getApplicationId());
if (subServiceResponse.isSuccess()) {
applicationVO.setChildList(subServiceResponse.getResult());
if (CollectionUtils.isNotEmpty(subServiceResponse.getResult())) {
ApplicationVO applicationVO = new ApplicationVO();
applicationVO.setApplicationId(applicationDTO.getApplicationId());
applicationVO.setName(applicationDTO.getName());
applicationVO.setChildren(EntityUtil.changeEntityListByJSON(ApplicationSubVO.class, subServiceResponse.getResult()));
appVOList.add(applicationVO);
}
}
}
return RestResponse.success(appVOList);
......
package com.gic.auth.web.vo;
import java.io.Serializable;
/**
*
* @Description:
* @author zhiwj
* @date 2019-11-06 14:32
*/
public class ApplicationSubVO implements Serializable {
private static final long serialVersionUID = -4918329047567649472L;
private Long subAppId;
private String subAppName;
public Long getSubAppId() {
return subAppId;
}
public void setSubAppId(Long subAppId) {
this.subAppId = subAppId;
}
public String getSubAppName() {
return subAppName;
}
public void setSubAppName(String subAppName) {
this.subAppName = subAppName;
}
}
package com.gic.auth.web.vo;
import com.gic.open.api.dto.ApplicationDTO;
import com.gic.open.api.dto.ApplicationSubDTO;
import java.io.Serializable;
import java.util.List;
/**
......@@ -11,17 +9,35 @@ import java.util.List;
* @author zhiwj
* @date 2019-11-06 11:36
*/
public class ApplicationVO extends ApplicationDTO {
public class ApplicationVO implements Serializable {
private static final long serialVersionUID = 4558390896804884123L;
private List<ApplicationSubDTO> childList;
private Long applicationId;
private String name;
private List<ApplicationSubVO> children;
public Long getApplicationId() {
return applicationId;
}
public void setApplicationId(Long applicationId) {
this.applicationId = applicationId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<ApplicationSubDTO> getChildList() {
return childList;
public List<ApplicationSubVO> getChildren() {
return children;
}
public void setChildList(List<ApplicationSubDTO> childList) {
this.childList = childList;
public void setChildren(List<ApplicationSubVO> children) {
this.children = children;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment