MerchantStaffWithdrawalController.java 6.75 KB
package cn.com.glsx.merchants.controller;

import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.merchant.MerchantBaseInfoRequest;
import cn.com.glsx.merchants.request.merchant.MerchantNosRopRequest;
import cn.com.glsx.merchants.request.withdrawal.MerchantStaffFailBatchRopRequest;
import cn.com.glsx.merchants.request.withdrawal.MerchantStaffWithdrawalSearchRopRequest;
import cn.com.glsx.merchants.request.withdrawal.MerchantStaffWithdrawalUpdateRopRequest;
import cn.com.glsx.merchants.request.withdrawal.StaffWithdrawalImportRopRequest;
import cn.com.glsx.merchants.response.withdrawal.MerchantStaffWithdrawalListRopResponse;
import cn.com.glsx.merchants.response.withdrawal.StaffImportWithdrawalRopResponse;
import cn.com.glsx.merchants.response.withdrawal.StaffWithdrawalUrlRopResponse;
import cn.com.glsx.merchants.service.MerchantStaffWithdrawalService;
import cn.com.glsx.merchants.util.WithdrawalPagination;
import cn.com.glsx.stoassistant.model.request.withdrawal.MerchantStaffWithdrawalSearchRpcRequest;
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;

/**
 * @ClassName MerchantStaffWithdrawalController
 * @Description
 * @Author lichongyuan
 * @Date 2022/10/14
 */
@Slf4j
@Api("提现管理接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class MerchantStaffWithdrawalController {

    @Autowired
    private MerchantStaffWithdrawalService merchantStaffWithdrawalService;

    /**
     * 提现列表
     */

    /**
     * 提现列表
     *
     * @param request 入参
     * @return
     */
    @ServiceMethod(method = "merchants.api.staff.withdrawal.page", needInSession = NeedInSessionType.NO)
    @ApiOperation("提现列表")
    public RopResponse<WithdrawalPagination<MerchantStaffWithdrawalListRopResponse>> getWithdrawalPage(MerchantStaffWithdrawalSearchRopRequest request) {
        try {
            WithdrawalPagination<MerchantStaffWithdrawalListRopResponse> withdrawalPage = merchantStaffWithdrawalService.getWithdrawalPage(request);
            return RopResponse.success(withdrawalPage);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__getWithdrawalPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 提现列表导出
     *
     * @param request 入参
     * @return
     */
    @ServiceMethod(method = "merchants.api.staff.withdrawal.exportList", needInSession = NeedInSessionType.NO)
    @ApiOperation("提现列表导出")
    public RopResponse<String> exportList(MerchantStaffWithdrawalSearchRopRequest request) {
        try {
            String url = merchantStaffWithdrawalService.exportList(request);
            return RopResponse.success(url);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__exportList__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 批量提现审核
     */
    /**
     * 批量提现审核
     *
     * @param request 入参
     * @return
     */
    @ServiceMethod(method = "merchants.api.staff.withdrawal.batchWithdrawal", needInSession = NeedInSessionType.NO)
    @ApiOperation("批量提现审核")
    public RopResponse<Boolean> batchWithdrawal(MerchantStaffWithdrawalUpdateRopRequest request) {
        try {
            merchantStaffWithdrawalService.batchWithdrawal(request);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__batchWithdrawal__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "merchants.api.staff.withdrawal.batchFail", needInSession = NeedInSessionType.NO)
    @ApiOperation("批量失败")
    public RopResponse<Boolean> failBatch(MerchantStaffFailBatchRopRequest request){
        try {
            return RopResponse.success(merchantStaffWithdrawalService.failBatch(request));
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__batchFail__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "merchants.api.staff.withdrawal.importBankWithdrawal", needInSession = NeedInSessionType.NO)
    @ApiOperation("提现结果导入")
    public RopResponse<StaffImportWithdrawalRopResponse> importBankWithdrawal(StaffWithdrawalImportRopRequest request){
        try {
            return RopResponse.success(merchantStaffWithdrawalService.importBankWithdrawal(request));
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__importBankWithdrawal__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "merchants.api.staff.withdrawal.exportBankWithdrawal", needInSession = NeedInSessionType.NO)
    @ApiOperation("导出提现结果")
    public RopResponse<StaffWithdrawalUrlRopResponse> exportBankWithdrawal(MerchantStaffWithdrawalSearchRopRequest request){
        try {
            return RopResponse.success(merchantStaffWithdrawalService.exportBankWithdrawal(request));
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__exportBankWithdrawal__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "merchants.api.staff.withdrawal.getWithdrawalRate", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询积分提现费率")
    public RopResponse<String> getWithdrawalRate(MerchantBaseInfoRequest request){
        try {
            return RopResponse.success(merchantStaffWithdrawalService.getWithdrawalRate(request.getMerchantId()));
        } catch (RpcServiceException e) {
            log.info("=======MerchantStaffWithdrawalController__invoke__getWithdrawalRate__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}