Commit 7c7068e6 by licy

添加根据产品id查询菜单功能树接口

1 parent aab66068
...@@ -2,10 +2,8 @@ package cn.com.glsx.merchants.controller; ...@@ -2,10 +2,8 @@ package cn.com.glsx.merchants.controller;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse; import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.product.ProductDeleteRequest; import cn.com.glsx.merchants.request.product.*;
import cn.com.glsx.merchants.request.product.ProductSaveRequest; import cn.com.glsx.merchants.response.MerchantProTreeRopResponse;
import cn.com.glsx.merchants.request.product.ProductSearchRequest;
import cn.com.glsx.merchants.request.product.ProductUpdateRequest;
import cn.com.glsx.merchants.response.ProductResponse; import cn.com.glsx.merchants.response.ProductResponse;
import cn.com.glsx.merchants.service.MerchantProductService; import cn.com.glsx.merchants.service.MerchantProductService;
import cn.com.glsx.merchants.util.Pagination; import cn.com.glsx.merchants.util.Pagination;
...@@ -87,4 +85,22 @@ public class MerchantProductController { ...@@ -87,4 +85,22 @@ public class MerchantProductController {
return RopResponse.error(e.getErrId(),e.getMessage()); return RopResponse.error(e.getErrId(),e.getMessage());
} }
} }
/**
* 根据产品id查询菜单功能树
*
* @param productSearchByIdRequest
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.product.findProductById", needInSession = NeedInSessionType.NO)
@ApiOperation("根据产品id查询菜单功能树")
public RopResponse<List<MerchantProTreeRopResponse>> findMenuFunByProductId(ProductSearchByIdRequest productSearchByIdRequest){
try {
List<MerchantProTreeRopResponse> merchantProductResponseList = merchantProductService.findMenuFunByProductId(productSearchByIdRequest);
return RopResponse.success(merchantProductResponseList);
} catch (RpcServiceException e) {
log.info("=======MerchantProductController__invoke__findProductById__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(),e.getMessage());
}
}
} }
package cn.com.glsx.merchants.request.product;
import com.rop.AbstractRopRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author Lichongyuan
* @Description: 根据产品id查询菜单功能树
* @date 2021/7/28 14:20
*/
@Data
public class ProductSearchByIdRequest extends AbstractRopRequest implements Serializable {
/**
* 产品id
*/
@ApiModelProperty(notes = "产品id", required = true)
@NotNull
private List<Integer> productId;
}
package cn.com.glsx.merchants.response;
import cn.com.glsx.merchants.model.response.MerchantProTreeResponse;
import io.swagger.annotations.Api;
import lombok.Data;
import java.util.List;
/**
* @author Lichongyuan
* @Description:
* @date 2021/7/28 14:50
*/
@Data
@Api("菜单功能树")
public class MerchantProTreeRopResponse {
private Integer id;
private String labal;
private String value;
private String logo;
private List<MerchantProTreeResponse> children;
}
...@@ -6,11 +6,14 @@ import cn.com.glsx.framework.core.exception.RpcServiceException; ...@@ -6,11 +6,14 @@ import cn.com.glsx.framework.core.exception.RpcServiceException;
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.model.request.MerchantProductRequest; import cn.com.glsx.merchants.model.request.MerchantProductRequest;
import cn.com.glsx.merchants.model.response.MerchantProTreeResponse;
import cn.com.glsx.merchants.model.response.MerchantProductResponse; import cn.com.glsx.merchants.model.response.MerchantProductResponse;
import cn.com.glsx.merchants.remote.MerchantProductRemote; import cn.com.glsx.merchants.remote.MerchantProductRemote;
import cn.com.glsx.merchants.request.product.ProductSaveRequest; import cn.com.glsx.merchants.request.product.ProductSaveRequest;
import cn.com.glsx.merchants.request.product.ProductSearchByIdRequest;
import cn.com.glsx.merchants.request.product.ProductSearchRequest; import cn.com.glsx.merchants.request.product.ProductSearchRequest;
import cn.com.glsx.merchants.request.product.ProductUpdateRequest; import cn.com.glsx.merchants.request.product.ProductUpdateRequest;
import cn.com.glsx.merchants.response.MerchantProTreeRopResponse;
import cn.com.glsx.merchants.response.ProductResponse; import cn.com.glsx.merchants.response.ProductResponse;
import cn.com.glsx.merchants.util.Pagination; import cn.com.glsx.merchants.util.Pagination;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -62,4 +65,13 @@ public class MerchantProductService { ...@@ -62,4 +65,13 @@ public class MerchantProductService {
throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage()); throw new RpcServiceException(booleanRpcResponse.getException().getErrId(),booleanRpcResponse.getMessage());
} }
} }
public List<MerchantProTreeRopResponse> findMenuFunByProductId(ProductSearchByIdRequest productSearchByIdRequest) {
RpcResponse<List<MerchantProTreeResponse>> mListRpcResponseRemote =
merchantProductRemote.findMenuFunByProductIdRemote(productSearchByIdRequest.getProductId());
if (mListRpcResponseRemote.isSuccess()){
return ConvertResponse.convertList(mListRpcResponseRemote.getResult(), MerchantProTreeRopResponse.class);
}
throw new RpcServiceException(mListRpcResponseRemote.getException().getErrId(),mListRpcResponseRemote.getMessage());
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!