Commit 3447cb20 by wangnb

账户体系账户类型菜单是否全选功能添加--think.wang

1 parent 6faa436c
...@@ -27,4 +27,13 @@ public class Contants { ...@@ -27,4 +27,13 @@ public class Contants {
*/ */
public final static String MDC_LOG_DB_ID = "LOG_DB_ID"; public final static String MDC_LOG_DB_ID = "LOG_DB_ID";
/**
* 前端菜单下全部选择
*/
public final static byte IS_ALL_YES = 1;
/**
* 前端菜单下部分选择
*/
public final static byte IS_ALL_NO = 0;
} }
...@@ -28,6 +28,12 @@ public class ProductRequest implements Serializable { ...@@ -28,6 +28,12 @@ public class ProductRequest implements Serializable {
private List<Integer> menuIdList; private List<Integer> menuIdList;
/** /**
* 部分选择菜单id列表
*/
@ApiModelProperty(name = "partSelectList", notes = "部分选择菜单id列表", dataType = "List")
private List<Integer> partSelectList;
/**
* 选中的功能id列表 * 选中的功能id列表
*/ */
@ApiModelProperty(name = "functionIdList", notes = "选中的功能id列表", dataType = "List") @ApiModelProperty(name = "functionIdList", notes = "选中的功能id列表", dataType = "List")
......
package cn.com.glsx.merchants.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: 产品菜单关系响应数据
* @date 2021/7/16 16:50
*/
@Data
public class AccountProductRelationResponse {
/**
* 产品id
*/
@ApiModelProperty(name = "productId", notes = "产品id", dataType = "Integer")
private Integer productId;
/**
* 产品名
*/
@ApiModelProperty(name = "productName", notes = "产品名", dataType = "String")
private String productName;
/**
* 回选全部菜单id列表
*/
@ApiModelProperty(name = "menuIdList", notes = "回选全部菜单id列表", dataType = "List")
private List<Integer> menuIdList;
/**
* 回选部分菜单id列表
*/
@ApiModelProperty(name = "partSelectList", notes = "回选部分菜单id列表", dataType = "List")
private List<Integer> partSelectList;
/**
* 回选功能id列表
*/
@ApiModelProperty(name = "functionIdList", notes = "回选功能id列表", dataType = "List")
private List<Integer> functionIdList;
}
...@@ -86,7 +86,7 @@ public class AccountTypeResponse implements Serializable { ...@@ -86,7 +86,7 @@ public class AccountTypeResponse implements Serializable {
* 账户类型功能列表 * 账户类型功能列表
*/ */
@ApiModelProperty(notes = "账户类型功能列表", name = "responseList", dataType = "List") @ApiModelProperty(notes = "账户类型功能列表", name = "responseList", dataType = "List")
private List<ProductRelationResponse> responseList; private List<AccountProductRelationResponse> responseList;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -3,6 +3,7 @@ package cn.com.glsx.merchants.service; ...@@ -3,6 +3,7 @@ package cn.com.glsx.merchants.service;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination; import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.contants.Contants;
import cn.com.glsx.merchants.convert.ConvertRequest; import cn.com.glsx.merchants.convert.ConvertRequest;
import cn.com.glsx.merchants.convert.ConvertResponse; import cn.com.glsx.merchants.convert.ConvertResponse;
import cn.com.glsx.merchants.enums.CommonStatusEnum; import cn.com.glsx.merchants.enums.CommonStatusEnum;
...@@ -15,8 +16,8 @@ import cn.com.glsx.merchants.remote.MerchantAccountTypeRemote; ...@@ -15,8 +16,8 @@ import cn.com.glsx.merchants.remote.MerchantAccountTypeRemote;
import cn.com.glsx.merchants.request.FunctionRequest; import cn.com.glsx.merchants.request.FunctionRequest;
import cn.com.glsx.merchants.request.ProductRequest; import cn.com.glsx.merchants.request.ProductRequest;
import cn.com.glsx.merchants.request.accounttype.*; import cn.com.glsx.merchants.request.accounttype.*;
import cn.com.glsx.merchants.response.AccountProductRelationResponse;
import cn.com.glsx.merchants.response.AccountTypeResponse; import cn.com.glsx.merchants.response.AccountTypeResponse;
import cn.com.glsx.merchants.response.ProductRelationResponse;
import cn.com.glsx.merchants.util.Pagination; import cn.com.glsx.merchants.util.Pagination;
import com.github.dozermapper.core.Mapper; import com.github.dozermapper.core.Mapper;
import com.glsx.plat.common.annotation.SysLog; import com.glsx.plat.common.annotation.SysLog;
...@@ -29,7 +30,6 @@ import org.springframework.stereotype.Service; ...@@ -29,7 +30,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -194,29 +194,37 @@ public class MerchantAccountTypeService { ...@@ -194,29 +194,37 @@ public class MerchantAccountTypeService {
//根据产品id分组 //根据产品id分组
Map<Integer, List<AccountFunctionRelationResponse>> map = Map<Integer, List<AccountFunctionRelationResponse>> map =
functionList.stream().collect(Collectors.groupingBy(AccountFunctionRelationResponse::getProductId)); functionList.stream().collect(Collectors.groupingBy(AccountFunctionRelationResponse::getProductId));
List<ProductRelationResponse> responseList = new ArrayList<>(); List<AccountProductRelationResponse> responseList = new ArrayList<>();
for(Integer key : map.keySet()){ for(Integer key : map.keySet()){
ProductRelationResponse relationResponse = new ProductRelationResponse(); AccountProductRelationResponse relationResponse = new AccountProductRelationResponse();
relationResponse.setProductId(key); relationResponse.setProductId(key);
List<AccountFunctionRelationResponse> list = map.get(key); List<AccountFunctionRelationResponse> list = map.get(key);
relationResponse.setProductName(list.get(0).getProductName()); relationResponse.setProductName(list.get(0).getProductName());
List<Integer> idList = new ArrayList<>(); List<Integer> menuIdList = new ArrayList<>();
List<Integer> partSelectList = new ArrayList<>();
List<Integer> functionIdList = new ArrayList<>();
list.stream().forEach(index ->{ list.stream().forEach(index ->{
if(index.getFunctionId() != null && index.getFunctionId() > 0){ if(index.getFunctionId() != null && index.getFunctionId() > 0){
idList.add(index.getFunctionId()); functionIdList.add(index.getFunctionId());
String value = index.getFunctionValue(); String value = index.getFunctionValue();
if(StringUtils.isNotEmpty(value)){ if(StringUtils.isNotEmpty(value)){
String[] arr = value.split(";"); String[] arr = value.split(";");
int size = arr.length; int size = arr.length;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
idList.add(Integer.valueOf(arr[i].split(":")[0])); functionIdList.add(Integer.valueOf(arr[i].split(":")[0]));
} }
} }
} else{ } else{
idList.add(index.getMenuId()); if(Contants.IS_ALL_YES == index.getIsAll()){
menuIdList.add(index.getMenuId());
} else if(Contants.IS_ALL_NO == index.getIsAll()){
partSelectList.add(index.getMenuId());
}
} }
}); });
relationResponse.setIdList(idList); relationResponse.setFunctionIdList(functionIdList);
relationResponse.setMenuIdList(menuIdList);
relationResponse.setPartSelectList(partSelectList);
responseList.add(relationResponse); responseList.add(relationResponse);
} }
response.setResponseList(responseList); response.setResponseList(responseList);
...@@ -235,12 +243,23 @@ public class MerchantAccountTypeService { ...@@ -235,12 +243,23 @@ public class MerchantAccountTypeService {
List<AccountFunctionRelationRequest> functionList = new ArrayList<>(); List<AccountFunctionRelationRequest> functionList = new ArrayList<>();
requestList.stream().forEach(index ->{ requestList.stream().forEach(index ->{
List<Integer> menuIdList = index.getMenuIdList(); List<Integer> menuIdList = index.getMenuIdList();
List<Integer> partSelectList = index.getPartSelectList();
List<FunctionRequest> functionIdList = index.getFunctionIdList(); List<FunctionRequest> functionIdList = index.getFunctionIdList();
if(CollectionUtils.isNotEmpty(menuIdList)){ if(CollectionUtils.isNotEmpty(menuIdList)){
menuIdList.stream().forEach(menuId ->{ menuIdList.stream().forEach(menuId ->{
AccountFunctionRelationRequest relation = new AccountFunctionRelationRequest(); AccountFunctionRelationRequest relation = new AccountFunctionRelationRequest();
relation.setProductId(index.getProductId()); relation.setProductId(index.getProductId());
relation.setMenuId(menuId); relation.setMenuId(menuId);
relation.setIsAll(Contants.IS_ALL_YES);
functionList.add(relation);
});
}
if(CollectionUtils.isNotEmpty(partSelectList)){
partSelectList.stream().forEach(menuId ->{
AccountFunctionRelationRequest relation = new AccountFunctionRelationRequest();
relation.setProductId(index.getProductId());
relation.setMenuId(menuId);
relation.setIsAll(Contants.IS_ALL_NO);
functionList.add(relation); functionList.add(relation);
}); });
} }
...@@ -251,6 +270,7 @@ public class MerchantAccountTypeService { ...@@ -251,6 +270,7 @@ public class MerchantAccountTypeService {
relation.setMenuId(function.getMenuId()); relation.setMenuId(function.getMenuId());
relation.setFunctionId(function.getId()); relation.setFunctionId(function.getId());
relation.setFunctionValue(function.getFunctionValue()); relation.setFunctionValue(function.getFunctionValue());
relation.setIsAll(Contants.IS_ALL_YES);
functionList.add(relation); functionList.add(relation);
}); });
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!