Commit 2e049632 by guojuxing

联合商户账号分组组件

parent 17020f01
......@@ -16,7 +16,9 @@ import com.gic.auth.web.vo.UnionEnterpriseAccountGroupListVO;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.OperationResultUtils;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.enterprise.service.UnionEnterpriseAuthApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
......@@ -54,6 +56,8 @@ public class AccountGroupController {
private UserApiService userApiService;
@Autowired
private UnionEnterpriseAuthApiService unionEnterpriseAuthApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
/**
* 新增账号分组
......@@ -92,17 +96,30 @@ public class AccountGroupController {
@RequestMapping("/list-union-enterprise")
public RestResponse listUnionEnterprise(Integer ownEnterpriseId) {
UnionEnterpriseAccountGroupListVO vo = new UnionEnterpriseAccountGroupListVO();
List<UnionEnterpriseAccountGroupListVO> voList = new ArrayList<>();
UnionEnterpriseAccountGroupListVO ownVO = new UnionEnterpriseAccountGroupListVO();
ownVO.setValue(ownEnterpriseId != null ? ownEnterpriseId.toString() : null);
ServiceResponse<EnterpriseDTO> ownEnterpriseResponse = enterpriseApiService.getEnterpriseById(ownEnterpriseId);
if (ownEnterpriseResponse.isSuccess()) {
ownVO.setLabel(ownEnterpriseResponse.getResult().getEnterpriseName());
}
ServiceResponse<List<AccountGroupDTO>> ownResponse = accountGroupApiService.listNoMemberByEnterpriseId(ownEnterpriseId);
if (ownResponse.isSuccess()) {
vo.setOwnEnterpriseAccountGroup(EntityUtil.changeEntityListNew(AccountGroupListVO.class, ownResponse.getResult()));
ownVO.setChildren(EntityUtil.changeEntityListNew(AccountGroupListVO.class, ownResponse.getResult()));
}
ServiceResponse<List<AccountGroupDTO>> currentResponse = accountGroupApiService
.listNoMemberByEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
UnionEnterpriseAccountGroupListVO currentVO = new UnionEnterpriseAccountGroupListVO();
currentVO.setLabel(UserDetailUtils.getUserDetail().getEnterpriseInfo().getEnterpriseName());
currentVO.setValue(UserDetailUtils.getUserDetail().getEnterpriseId().toString());
if (currentResponse.isSuccess()) {
vo.setCurrentEnterpriseAccountGroup(EntityUtil.changeEntityListNew(AccountGroupListVO.class, currentResponse.getResult()));
currentVO.setChildren(EntityUtil.changeEntityListNew(AccountGroupListVO.class, currentResponse.getResult()));
}
return RestResponse.success(vo);
voList.add(ownVO);
voList.add(currentVO);
return RestResponse.success(voList);
}
@RequestMapping("/delete")
......
......@@ -14,37 +14,50 @@ public class UnionEnterpriseAccountGroupListVO implements Serializable{
private static final long serialVersionUID = 6530622928732661742L;
/**
* 自有商户
* 商户ID
*/
private List<AccountGroupListVO> ownEnterpriseAccountGroup;
private String value;
/**
* 当前本商户
* 商户名称
*/
private List<AccountGroupListVO> currentEnterpriseAccountGroup;
private String label;
private List<AccountGroupListVO> children;
public String getValue() {
return value;
}
public UnionEnterpriseAccountGroupListVO setValue(String value) {
this.value = value;
return this;
}
public List<AccountGroupListVO> getOwnEnterpriseAccountGroup() {
return ownEnterpriseAccountGroup;
public String getLabel() {
return label;
}
public UnionEnterpriseAccountGroupListVO setOwnEnterpriseAccountGroup(List<AccountGroupListVO> ownEnterpriseAccountGroup) {
this.ownEnterpriseAccountGroup = ownEnterpriseAccountGroup;
public UnionEnterpriseAccountGroupListVO setLabel(String label) {
this.label = label;
return this;
}
public List<AccountGroupListVO> getCurrentEnterpriseAccountGroup() {
return currentEnterpriseAccountGroup;
public List<AccountGroupListVO> getChildren() {
return children;
}
public UnionEnterpriseAccountGroupListVO setCurrentEnterpriseAccountGroup(List<AccountGroupListVO> currentEnterpriseAccountGroup) {
this.currentEnterpriseAccountGroup = currentEnterpriseAccountGroup;
public UnionEnterpriseAccountGroupListVO setChildren(List<AccountGroupListVO> children) {
this.children = children;
return this;
}
@Override
public String toString() {
return "UnionEnterpriseAccountGroupListVO{" +
"ownEnterpriseAccountGroup=" + ownEnterpriseAccountGroup +
", currentEnterpriseAccountGroup=" + currentEnterpriseAccountGroup +
"value='" + value + '\'' +
", label='" + label + '\'' +
", 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