MerchantCommonController.java 2.6 KB
package cn.com.glsx.merchants.controller;

import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.DefaultRequest;
import cn.com.glsx.merchants.request.accounttype.AccountTypeSearchRequest;
import cn.com.glsx.merchants.response.AccountTypeResponse;
import cn.com.glsx.merchants.response.CarbrandResponse;
import cn.com.glsx.merchants.response.ChannelResponse;
import cn.com.glsx.merchants.service.MerchantCommonService;
import com.rop.AbstractRopRequest;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author zhouhaibao
 * @version 1.0
 * @description: 商户公共服务
 * @date 2021/8/1 10:16
 */
@Slf4j
@Api("商户公共服务")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class MerchantCommonController {


    @Autowired
    private MerchantCommonService merchantCommonService;

    /**
     * 获取车辆品牌树
     *
     * @param defaultRequest
     * @return
     */
    @ServiceMethod(method = "merchants.api.merchantCommon.getCarbrandTree", needInSession = NeedInSessionType.NO)
    @ApiOperation("获取车辆品牌树")
    public RopResponse<List<CarbrandResponse>> getCarbrandTree(DefaultRequest defaultRequest) {
        try {
            return RopResponse.success(merchantCommonService.getCarbrandTreeNew());
        } catch (RpcServiceException e) {
            log.info("=======MerchantCommonController__invoke__getCarbrandTree__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(),e.getMessage());
        }
    }

    /**
     * 获取车辆品牌树
     *
     * @param abstractRopRequest
     * @return
     */
    @ServiceMethod(method = "merchants.api.merchantCommon.findAllChannel", needInSession = NeedInSessionType.NO)
    @ApiOperation("获取渠道列表")
    public RopResponse<List<ChannelResponse>> findAllChannel(AbstractRopRequest abstractRopRequest) {
        try {
            return RopResponse.success(merchantCommonService.findAllChannel());
        } catch (RpcServiceException e) {
            log.info("=======MerchantCommonController__invoke__findAllChannel__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(),e.getMessage());
        }
    }
}