MerchantWithdrawalPointsConfigController.java 5.04 KB
package cn.com.glsx.stoassistant.controller.withdrawal;

import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.stoassistant.model.response.withdrawal.MerchantWithdrawalPointsConfigResponse;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantWithdrawalPointsConfigCheckRopRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantWithdrawalPointsConfigDeleteRopRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantWithdrawalPointsConfigSaveRopRequest;
import cn.com.glsx.stoassistant.request.withdrawal.MerchantWithdrawalPointsConfigSearchRopRequest;
import cn.com.glsx.stoassistant.service.withdrawal.MerchantWithdrawalPointsConfigService;
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;

/**
 * @Author yelq
 * @Version 1.0
 * @Description: 提现白名单
 * @Date 2023/8/10 17:46
 */

@Slf4j
@Api("积分提现门店白名单")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class MerchantWithdrawalPointsConfigController {

    @Autowired
    private MerchantWithdrawalPointsConfigService merchantWithdrawalPointsConfigService;

    @ServiceMethod(method = "stoassistant.api.withdrawal.of.points.page", needInSession = NeedInSessionType.YES)
    @ApiOperation("积分提现门店白名单列表分页查询")
    public RopResponse<RpcPagination<MerchantWithdrawalPointsConfigResponse>> withdrawalOfPointsPage(MerchantWithdrawalPointsConfigSearchRopRequest request) {
        try {
            RpcPagination<MerchantWithdrawalPointsConfigResponse> pagination = merchantWithdrawalPointsConfigService.withdrawalOfPointsPage(request);
            return RopResponse.success(pagination);
        } catch (RpcServiceException e) {
            log.info("=======MerchantWithdrawalPointsConfigController__invoke__withdrawalOfPointsPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }catch (Exception e){
            log.error(e.getMessage(),e);
            return RopResponse.error(e.getMessage());
        }
    }

    @ServiceMethod(method = "stoassistant.api.withdrawal.of.points.merchant.check", needInSession = NeedInSessionType.YES)
    @ApiOperation("积分提现门店白名单配置校验")
    public RopResponse<MerchantWithdrawalPointsConfigResponse> withdrawalOfPointsMerchantCheck(MerchantWithdrawalPointsConfigCheckRopRequest request) {
        try {
            MerchantWithdrawalPointsConfigResponse response = merchantWithdrawalPointsConfigService.withdrawalOfPointsMerchantCheck(request);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantWithdrawalPointsConfigController__invoke__withdrawalOfPointsMerchantCheck__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }catch (Exception e){
            log.error(e.getMessage(),e);
            return RopResponse.error(e.getMessage());
        }
    }

    @ServiceMethod(method = "stoassistant.api.withdrawal.of.points.merchant.list.save", needInSession = NeedInSessionType.YES)
    @ApiOperation("积分提现门店白名单配置")
    public RopResponse<Boolean> withdrawalOfPointsMerchantListSave(MerchantWithdrawalPointsConfigSaveRopRequest request) {
        try {
            Boolean response = merchantWithdrawalPointsConfigService.withdrawalOfPointsMerchantListSave(request);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantWithdrawalPointsConfigController__invoke__withdrawalOfPointsMerchantListSave__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }catch (Exception e){
            log.error(e.getMessage(),e);
            return RopResponse.error(e.getMessage());
        }
    }

    @ServiceMethod(method = "stoassistant.api.withdrawal.of.points.merchant.list.delete", needInSession = NeedInSessionType.YES)
    @ApiOperation("积分提现门店白名单删除")
    public RopResponse<Boolean> withdrawalOfPointsMerchantListDelete(MerchantWithdrawalPointsConfigDeleteRopRequest request) {
        try {
            Boolean response = merchantWithdrawalPointsConfigService.withdrawalOfPointsMerchantListDelete(request);
            return RopResponse.success(response);
        } catch (RpcServiceException e) {
            log.info("=======MerchantWithdrawalPointsConfigController__invoke__withdrawalOfPointsMerchantListDelete__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }catch (Exception e){
            log.error(e.getMessage(),e);
            return RopResponse.error(e.getMessage());
        }
    }

}