package com.crm.ucard.controller;

import com.crm.rely.backend.core.constant.FeignClientAnnotation;
import com.crm.rely.backend.core.dto.base.BaseReportResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.ucard.*;
import com.crm.rely.backend.core.dto.ucard.vaultody.VaultodyDepositAddressDto;
import com.crm.rely.backend.core.dto.wasabi.*;
import com.crm.rely.backend.core.entity.base.BaseDeleteEntities;
import com.crm.rely.backend.core.entity.base.BaseEntity;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.custom.kyc.WebsdkLinkAliEntity;
import com.crm.rely.backend.core.entity.ucard.*;
import com.crm.rely.backend.core.entity.ucard.vaultody.VaultodyDepositAddressPageEntity;
import com.crm.rely.backend.core.entity.ucard.vaultody.VaultodyResetDepositAddressEntity;
import com.crm.rely.backend.core.entity.wasabi.*;
import com.crm.rely.backend.exception.ServiceException;
import com.crm.rely.backend.util.GetIpAndMac;
import com.crm.ucard.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 银行卡服务接口
 */
@Slf4j
@RestController
@RequestMapping("/wasabi/manager")
public class WasabiCardController {

    @Autowired
    private UcardCardService ucardCardService;
    @Autowired
    private WasabiDocumentApiService wasabiDocumentApiService;
    @Autowired
    private KycService kycService;
    @Autowired
    private UcardFileService ucardFileService;
    @Autowired
    private UcardTypeConfigService ucardTypeConfigService;
    @Autowired
    private UcardEmailService ucardEmailService;
    @Autowired
    private VaultodyService vaultodyService;
    @Autowired
    private UcardExportService ucardExportService;
    @Autowired
    private UcardTaskService ucardTaskService;

    /**
     * 获取卡片类型列表
     */
    @PostMapping("/card/types/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardTypeDto> getCardTypePageList(@RequestBody CardTypePageEntity entity) throws Exception {
        return ucardCardService.getCardTypePageList(entity);
    }

    /**
     * 更新卡类型配置
     */
    @PostMapping("/card/type/config/update")
    @FeignClientAnnotation
    public BaseResultDto updateCardTypeConfig(@RequestBody CardTypeConfigUpdateEntity entity) throws ServiceException {
        return ucardTypeConfigService.updateCardTypeConfig(entity);
    }

    /**
     * 更新卡片类型和基本信息
     */
    @PostMapping("/card/types")
    @FeignClientAnnotation
    public BaseResultDto getCardTypes() throws Exception {
        ucardCardService.saveCardTypeList();
        ucardCardService.cardUpdateCountry();
        ucardCardService.updateOccupationList();
        return BaseResultDto.success();
    }

    /**
     * 商户用户分页列表
     */
    @PostMapping("/merchant/user/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<MerchantUserDto> getMerchantUserPageList(@RequestBody MerchantUserPageEntity entity) throws ServiceException {
        return ucardCardService.getMerchantUserPageList(entity);
    }

    /**
     * 商户用户注册
     */
    @PostMapping("/merchant/user/register")
    @FeignClientAnnotation
    public BaseResultDto managerRegisterMerchantUser(@RequestBody @Validated CardMerchantUserEntity request, HttpServletRequest servletRequest) throws ServiceException {
        String ip = GetIpAndMac.getIp(servletRequest);
        request.setIpAddress(ip);
        return ucardCardService.registerMerchantUser(request);
    }

    /**
     * 更新商户用户信息
     */
    @PostMapping("/merchant/user/update")
    @FeignClientAnnotation
    public BaseResultDto updateMerchantUser(@RequestBody @Validated CardMerchantUserEntity request) throws ServiceException {
        return ucardCardService.updateMerchantUser(request);
    }

    /**
     * 配置用户汇率
     */
    @PostMapping("/merchant/user/rate/config")
    @FeignClientAnnotation
    public BaseResultDto cardUserRateConfig(@RequestBody CardUserRateConfigEntity request) throws ServiceException {
        return ucardCardService.cardUserRateConfig(request);
    }

    /**
     * 更新用户邮寄地址
     */
    @PostMapping("/merchant/user/address/update")
    @FeignClientAnnotation
    public BaseResultDto updateUserMailingAddress(@RequestBody WasabiSaveUserMailingAddressEntity request) throws ServiceException {
        return ucardCardService.updateUserMailingAddress(request);
    }

    /**
     * 获取kyc认证分页列表
     */
    @PostMapping("/merchant/kyc/page")
    @FeignClientAnnotation
    ResultWithPagerDto<CardKycStatusDto> getKycPageList(@RequestBody CardKycStatusPageEntity entity) throws ServiceException {
        return kycService.getKycPageList(entity);
    }

    /**
     * 手动审核KYC认证
     */
    @PostMapping("/merchant/kyc/manual/submit")
    @FeignClientAnnotation
    public BaseResultDto manualSubmitKyc(@RequestBody CardKycApproveEntity entity) throws ServiceException {
        return kycService.manualSubmitKyc(entity);
    }

    /**
     * 申请开卡
     */
    @PostMapping("/card/apply")
    @FeignClientAnnotation
    public BaseResultDto applyCard(@RequestBody CardApplyEntity request) throws Exception {
        return ucardCardService.applyCard(request);
    }

    /**
     * 开卡审批
     */
    @PostMapping("/card/apply/approve")
    @FeignClientAnnotation
    public BaseResultDto cardApplyApprove(@RequestBody CardApplyApproveEntity request) throws Exception {
        return ucardCardService.cardApplyApprove(request);
    }

    /**
     * 查询开卡进度
     */
    @PostMapping("/card/apply/progress")
    @FeignClientAnnotation
    public BaseResultDto queryApplyProgress(@RequestBody CardApplyProgressEntity request) throws Exception {
        return ucardCardService.queryApplyProgress(request);
    }

    /**
     * 获取卡片申请列表
     */
    @PostMapping("/card/apply/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardApplyDto> getCardApplyPageList(@RequestBody CardApplyPageEntity entity) throws ServiceException {
        return ucardCardService.getCardApplyPageList(entity);
    }

    /**
     * 获取卡片申请详情
     */
    @PostMapping("/card/apply/details")
    @FeignClientAnnotation
    public BaseResultDto cardApplyDetails(@RequestBody BaseEntity entity) throws ServiceException {
        return ucardCardService.cardApplyDetails(entity);
    }

    /**
     * 获取卡片列表
     */
    @PostMapping("/card/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<UcardCardDto> getCardPageList(@RequestBody CardPageEntity entity) throws ServiceException {
        return ucardCardService.getCardPageList(entity);
    }

    /**
     * 银行卡激活
     */
    @PostMapping("/card/activate")
    @FeignClientAnnotation
    public BaseResultDto<WasabiActiveCardDto> activateCard(@RequestBody @Validated WasabiActiveCardEntity request) throws Exception {
        return ucardCardService.activeCard(request);
    }

    /**
     * 银行卡充值
     */
    @PostMapping("/card/recharge")
    @FeignClientAnnotation
    public BaseResultDto rechargeCard(@RequestBody WasabiBalanceEntity request) throws Exception {
        return ucardCardService.cardDeposit(request);
    }

    /**
     * 银行卡充值审批
     */
    @PostMapping("/card/recharge/approve")
    @FeignClientAnnotation
    public BaseResultDto rechargeCardApprove(@RequestBody WasabiDepositApproveEntity request) throws Exception {
        return ucardCardService.cardDepositApprove(request);
    }

    /**
     * 卡扣款
     */
    @PostMapping("/card/withdraw")
    @FeignClientAnnotation
    public BaseResultDto cardWithdraw(@RequestBody WasabiWithdrawEntity request) throws Exception {
        return ucardCardService.cardWithdraw(request);
    }

    /**
     * 销卡
     */
    @PostMapping("/card/cancel")
    @FeignClientAnnotation
    public BaseResultDto cardCancel(@RequestBody WasabiCancelEntity request) throws Exception {
        return ucardCardService.cardCancel(request);
    }

    /**
     * 查询用户钱包余额
     */
    @PostMapping("/card/wallet/balance")
    @FeignClientAnnotation
    public BaseResultDto<WalletBalanceDto> walletBalance(@RequestBody WalletBalanceEntity request) throws ServiceException {
        return ucardCardService.walletBalance(request);
    }

    /**
     * 获取用户钱包记录列表
     */
    @PostMapping("/card/wallet/record/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardWalletRecordDto> getCardWalletRecordPageList(@RequestBody CardWalletRecordPageEntity entity) throws ServiceException {
        return ucardCardService.getCardWalletRecordPageList(entity);
    }

    /**
     * 查询充值订单
     */
    @PostMapping("/card/recharge/order")
    @FeignClientAnnotation
    public BaseResultDto queryRechargeOrder(@RequestBody CardRechargeOrderQueryEntity request) throws Exception {
        return ucardCardService.queryDepositOrder(request);
    }

    /**
     * 查询充值记录
     */
    @PostMapping("/card/recharge/records")
    @FeignClientAnnotation
    public BaseResultDto<List<WasabiTransactionDto>> queryRechargeRecords(@RequestBody WasabiTransactionEntity entity) throws Exception {
        entity.setType("deposit");
        return BaseResultDto.success(wasabiDocumentApiService.getCardTransactionList(entity));
    }

    /**
     * 充值记录分页查询
     */
    @PostMapping("/card/recharge/page")
    @FeignClientAnnotation
    public BaseReportResultDto<List<CardRechargeOrderDto>, CardRechargeOrderSumDto> queryRechargePageList(@RequestBody CardRechargePageEntity entity) throws ServiceException {
        return ucardCardService.queryRechargePageList(entity);
    }

    /**
     * 查询卡片余额
     */
    @PostMapping("/card/balance")
    @FeignClientAnnotation
    public BaseResultDto<WasabiBalanceInfoDto> queryCardBalance(@RequestBody WasabiBalanceInfoEntity request) throws ServiceException {
        return ucardCardService.getBalanceInfo(request);
    }

    /**
     * 调整余额
     */
    @PostMapping("/card/wallet/balance/update")
    @FeignClientAnnotation
    public BaseResultDto updateBalance(@RequestBody WasabiUpdateBalanceEntity request) throws ServiceException {
        return ucardCardService.updateBalance(request);
    }

    /**
     * 找回密码
     */
    @PostMapping("/card/password/reset")
    @FeignClientAnnotation
    public BaseResultDto<WasabiUpdatePinDto> resetPassword(@RequestBody WasabiUpdatePinEntity entity) throws Exception {
        return ucardCardService.updatePin(entity);
    }

    /**
     * 查询交易记录分页列表
     */
    @PostMapping("/card/transac/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardTransacOrderDto> getTransactionPageList(@RequestBody CardTransacOrderPageEntity request) throws ServiceException {
        return ucardCardService.getTransacOrderPageList(request);
    }

    /**
     * 冻结卡片
     */
    @PostMapping("/card/freeze")
    @FeignClientAnnotation
    public BaseResultDto freezeCard(@RequestBody WasabiFreezeAndUnfreezeEntity request) throws Exception {
        return ucardCardService.cardFreeze(request);
    }

    /**
     * 解冻卡片
     */
    @PostMapping("/card/unfreeze")
    @FeignClientAnnotation
    public BaseResultDto unfreezeCard(@RequestBody WasabiFreezeAndUnfreezeEntity request) throws Exception {
        return ucardCardService.cardUnfreeze(request);
    }

    /**
     * 校验文件
     */
    @PostMapping("/validated/file")
    @FeignClientAnnotation
    public void validatedFile(@RequestParam(value = "file") MultipartFile file) throws ServiceException {
        wasabiDocumentApiService.validatedFile(file);
    }

    /**
     * 查询国家和城市
     */
    @PostMapping("/card/country")
    @FeignClientAnnotation
    public BaseResultDto getCardCountry(@RequestBody CardCountryEntity request) throws ServiceException {
        request.setCardCategory(2);
        return BaseResultDto.success(ucardCardService.getCardCountryList(request));
    }

    /**
     * 查询职业信息
     */
    @PostMapping("/card/occupation/list")
    @FeignClientAnnotation
    public BaseResultDto<List<WasabiOccupationsDto>> getOccupationList() throws ServiceException {
        return ucardCardService.getOccupationList();
    }

    /**
     * 查询激活码
     */
    @PostMapping("/get/activation/code")
    @FeignClientAnnotation
    public BaseResultDto<WasabiThird3dsTransactionDto> getActivationCode(@RequestBody WasabiThird3dsTransactionEntity entity) throws Exception {
        return ucardCardService.getActivationCode(entity);
    }

    /**
     * 卡信息刷新
     */
    @PostMapping("/card/info/refresh")
    @FeignClientAnnotation
    public BaseResultDto refreshCardInfo(@RequestBody CardInfoRefreshEntity entity) throws Exception {
        return ucardCardService.refreshCardInfo(entity);
    }

    /**
     * 操作记录分页列表
     */
    @PostMapping("/card/operate/page")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardOperateDto> queryOperatePageList(@RequestBody CardOperatePageEntity entity) throws ServiceException {
        return ucardCardService.queryOperatePageList(entity);
    }

    /**
     * kyc认证详情
     */
    @PostMapping("/kyc/status/single")
    @FeignClientAnnotation
    public BaseResultDto kycStatusSingle(@RequestBody SingleLongEntity entity) throws ServiceException {
        return kycService.kycStatusSingle(entity);
    }

    /**
     * 重新充值默认开卡金额
     */
    @PostMapping("/recharge/default/amount")
    @FeignClientAnnotation
    public BaseResultDto rechargeDefaultAmount(@RequestBody CardRechargeDefaultAmountEntity entity) throws Exception {
        return ucardCardService.rechargeDefaultAmount(entity);
    }

    /**
     * 身份认证获取web链接
     *
     * @param entity
     * @return
     */
    @PostMapping("/getWebsdkLink")
    public BaseResultDto getWebsdkLink(@RequestBody WebsdkLinkAliEntity entity, InfoEntity infoEntity) throws Exception {
        return kycService.getWebsdkLink(entity, infoEntity.getCustomInfo().getId());
    }

    /**
     * 手动上传证件照
     *
     * @param entity
     * @return
     */
    @PostMapping("/card/photo/manually")
    @FeignClientAnnotation
    public BaseResultDto uploadCardPhotoManually(@RequestBody CardPhotoUploadManuallyEntity entity) throws ServiceException {
        return ucardCardService.uploadCardPhotoManually(entity);
    }

    /**
     * 证件类型配置列表
     *
     * @param entity
     * @return
     */
    @PostMapping("/card/id/type/config/list")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardIdTypeConfigDto> getCardIdTypeConfigList(@RequestBody CardIdTypeConfigPageEntity entity) throws ServiceException {
        return ucardTypeConfigService.getCardIdTypeConfigList(entity);
    }

    /**
     * 批量新增证件类型配置
     *
     * @param entitys
     * @return
     */
    @PostMapping("/card/id/type/config/add")
    @FeignClientAnnotation
    public BaseResultDto batchAddCardIdTypeConfig(@RequestBody List<CardIdTypeConfigAddEntity> entitys) throws ServiceException {
        return ucardTypeConfigService.batchAddCardIdTypeConfig(entitys);
    }

    /**
     * 修改证件类型配置
     *
     * @param entity
     * @return
     */
    @PostMapping("/card/id/type/config/update")
    @FeignClientAnnotation
    public BaseResultDto updateCardIdTypeConfig(@RequestBody CardIdTypeConfigUpdateEntity entity) throws ServiceException {
        return ucardTypeConfigService.updateCardIdTypeConfig(entity);
    }

    /**
     * 删除证件类型配置
     *
     * @param entity
     * @return
     */
    @PostMapping("/card/id/type/config/delete")
    @FeignClientAnnotation
    public BaseResultDto deleteCardIdTypeConfig(@RequestBody BaseDeleteEntities entity) throws ServiceException {
        return ucardTypeConfigService.deleteCardIdTypeConfig(entity);
    }

    /**
     * 查询cvv码
     */
    @PostMapping("/card/query/cvv")
    @FeignClientAnnotation
    public BaseResultDto cardQueryCvv(@RequestBody CardVerifyGoogleCodeEntity entity) throws ServiceException {
        return ucardEmailService.cardQueryCvv(entity);
    }

    /**
     * 根据卡号查询卡信息
     */
    @PostMapping("/card/info/query")
    @FeignClientAnnotation
    public BaseResultDto queryCardInfoByCardNumber(@RequestBody CardInfoQueryEntity entity) throws ServiceException {
        return ucardCardService.queryCardInfoByCardNumber(entity);
    }

    /**
     * 用户信息导出
     */
    @PostMapping("/merchant/user/list/export")
    @FeignClientAnnotation
    public BaseResultDto<List<MerchantUserDto>> merchantUserListExport(@RequestBody MerchantUserPageEntity entity) throws ServiceException {
        return ucardExportService.merchantUserListExport(entity);
    }

    /**
     * kyc认证列表导出
     */
    @PostMapping("/merchant/kyc/list/export")
    @FeignClientAnnotation
    BaseResultDto<List<CardKycStatusDto>> merchantKycListExport(@RequestBody CardKycStatusPageEntity entity) throws ServiceException {
        return ucardExportService.merchantKycListExport(entity);
    }

    /**
     * 卡片申请列表导出
     */
    @PostMapping("/card/apply/list/export")
    @FeignClientAnnotation
    public BaseResultDto<List<CardApplyDto>> cardApplyListExport(@RequestBody CardApplyPageEntity entity) throws ServiceException {
        return ucardExportService.cardApplyListExport(entity);
    }

    /**
     * 卡片列表导出
     */
    @PostMapping("/card/list/export")
    @FeignClientAnnotation
    public BaseResultDto<List<UcardCardDto>> cardListExport(@RequestBody CardPageEntity entity) throws ServiceException {
        return ucardExportService.cardListExport(entity);
    }

    /**
     * 交易记录列表导出
     */
    @PostMapping("/card/transac/record/export")
    @FeignClientAnnotation
    public BaseResultDto<List<CardTransacOrderDto>> cardTransacRecordExport(@RequestBody CardTransacOrderPageEntity request) throws ServiceException {
        return ucardExportService.cardTransacRecordExport(request);
    }

    /**
     * 钱包余额记录列表导出
     */
    @PostMapping("/card/wallet/record/export")
    @FeignClientAnnotation
    public BaseResultDto<List<CardWalletRecordDto>> cardWalletRecordExport(@RequestBody CardWalletRecordPageEntity request) throws ServiceException {
        return ucardExportService.cardWalletRecordExport(request);
    }

    /**
     * 操作记录列表导出
     */
    @PostMapping("/card/operate/record/export")
    @FeignClientAnnotation
    public BaseResultDto<List<CardOperateDto>> cardOperateRecordExport(@RequestBody CardOperatePageEntity entity) throws ServiceException {
        return ucardExportService.cardOperateRecordExport(entity);
    }

    /**
     * 充值记录导出
     */
    @PostMapping("/card/recharge/list/export")
    @FeignClientAnnotation
    public BaseResultDto<List<CardRechargeOrderDto>> cardRechargeListExport(@RequestBody CardRechargePageEntity entity) throws ServiceException {
        return ucardExportService.cardRechargeListExport(entity);
    }

    /**
     * 速汇订单导出
     */
    @PostMapping("/global/order/list/export")
    @FeignClientAnnotation
    public BaseResultDto<List<GlobalOrderDto>> globalOrderListExport(@RequestBody GlobalOrderPageEntity entity) throws ServiceException {
        return ucardExportService.globalOrderListExport(entity);
    }

    /**
     * 添加文件记录
     */
    @PostMapping("/card/file/add")
    @FeignClientAnnotation
    public BaseResultDto cardVideoAdd(@RequestBody @Validated CardFileAddEntity entity) throws ServiceException {
        return ucardFileService.cardFileAdd(entity);
    }

    /**
     * 修改文件
     */
    @PostMapping("/card/file/update")
    @FeignClientAnnotation
    public BaseResultDto cardVideoUpdate(@RequestBody @Validated CardFileUpdateEntity entity) throws ServiceException {
        return ucardFileService.cardFileUpdate(entity);
    }

    /**
     * 删除文件
     */
    @PostMapping("/card/file/delete")
    @FeignClientAnnotation
    public BaseResultDto cardVideoDelete(@RequestBody BaseDeleteEntities entity) throws ServiceException {
        return ucardFileService.cardFileDelete(entity);
    }

    /**
     * 文件分页列表
     */
    @PostMapping("/card/file/search/list")
    @FeignClientAnnotation
    public ResultWithPagerDto<CardFileDto> cardFileSearchList(@RequestBody CardFilePageEntity entity) throws ServiceException {
        return ucardFileService.cardFileSearchList(entity);
    }

    /**
     * 查询已认证用户列表
     */
    @PostMapping("/card/query/user/list")
    @FeignClientAnnotation
    public BaseResultDto queryUcardUserList() throws ServiceException {
        return ucardCardService.queryUcardUserList();
    }

    /**
     * 查询账户信息
     */
    @PostMapping("/card/account/dropdown")
    @FeignClientAnnotation
    public BaseResultDto cardAccountDropdown(@RequestBody CardAccountDropdownEntity entity) throws Exception {
        return ucardCardService.cardAccountDropdown(entity);
    }

    /**
     * 钱包地址分页列表
     */
    @PostMapping("/card/deposit/address/page")
    @FeignClientAnnotation
    ResultWithPagerDto<VaultodyDepositAddressDto> getDepositAddressPage(@RequestBody VaultodyDepositAddressPageEntity entity) throws ServiceException{
        return vaultodyService.getDepositAddressPage(entity);
    }

    /**
     * 重置钱包地址
     */
    @PostMapping("/card/deposit/address/reset")
    @FeignClientAnnotation
    BaseResultDto resetDepositAddress(@RequestBody VaultodyResetDepositAddressEntity entity) throws ServiceException{
        return vaultodyService.resetDepositAddress(entity);
    }

    /**
     * 加密货币交易分页列表
     */
    @PostMapping("/encrypted/wallet/transaction/page")
    @FeignClientAnnotation
    ResultWithPagerDto<UcardWalletDepositTransactionDto> getWalletDepositTransactionPage(@RequestBody UcardWalletDepositTransactionPageEntity entity) throws ServiceException{
        return vaultodyService.getWalletDepositTransactionPage(entity);
    }

    /**
     * 加密货币交易记录导出
     */
    @PostMapping("/encrypted/wallet/transaction/list/export")
    @FeignClientAnnotation
    BaseResultDto<List<UcardWalletDepositTransactionDto>> encryptedWalletTransactionListExport(@RequestBody UcardWalletDepositTransactionPageEntity entity) throws ServiceException{
        return ucardExportService.encryptedWalletTransactionListExport(entity);
    }

    /**
     * 卡扣款分页列表
     */
    @PostMapping("/card/withdraw/page")
    @FeignClientAnnotation
    ResultWithPagerDto<CardWithdrawDto> queryCardWithdrawPage(@RequestBody CardWithdrawPageEntity entity) throws ServiceException{
        return ucardCardService.queryCardWithdrawPage(entity);
    }

    /**
     * 卡扣款列表导出
     */
    @PostMapping("/card/withdraw/list/export")
    @FeignClientAnnotation
    BaseResultDto<List<CardWithdrawDto>> cardWithdrawListExport(@RequestBody CardWithdrawPageEntity entity) throws ServiceException{
        return ucardExportService.cardWithdrawListExport(entity);
    }

    /**
     * 卡3ds分页列表
     */
    @PostMapping("/card/3ds/transaction/page")
    @FeignClientAnnotation
    ResultWithPagerDto<Card3dsTransactionDto> queryCard3dsTransactionPage(@RequestBody Card3dsTransactionPageEntity entity) throws ServiceException{
        return ucardCardService.queryCard3dsTransactionPage(entity);
    }

    /**
     * 3ds列表导出
     */
    @PostMapping("/card/3ds/transaction/list/export")
    @FeignClientAnnotation
    BaseResultDto<List<Card3dsTransactionDto>> card3dsTransactionListExport(@RequestBody Card3dsTransactionPageEntity entity) throws ServiceException{
        return ucardExportService.card3dsTransactionListExport(entity);
    }

    /**
     * 银行卡授权交易信息数据定时同步查询
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void queryOrderInfo() throws Exception {

        log.info("银行卡授权交易信息数据定时同步查询开始: .............................");
        try {
            ucardTaskService.queryOrderInfo();
        } catch (Exception e) {
            log.error("银行卡授权交易信息数据定时同步任务执行失败", e);
        }
        log.info("银行卡授权交易信息数据定时同步查询结束: .............................");
    }

    /**
     * 激活处理中数据查询卡信息并更新数据库
     */
    @Scheduled(cron = "0 0 * * * ?")
    public void queryCardInfo() throws Exception {

        log.info("激活中数据同步定时任务开始: .............................");
        try {
            ucardTaskService.queryCardInfo();
        } catch (Exception e) {
            log.error("激活中数据同步定时任务执行失败", e);
        }
        log.info("激活中数据同步定时任务结束: .............................");
    }

    /**
     * 待激活卡片更新邮寄状态任务
     */
    @Scheduled(cron = "0 0 * * * ?")
    public void queryCardLogisticsStatus() throws Exception {

        log.info("待激活卡片更新邮寄状态任务开始: .............................");
        try {
            ucardTaskService.queryCardLogisticsStatus();
        } catch (Exception e) {
            log.error("待激活卡片更新邮寄状态任务执行失败", e);
        }
        log.info("待激活卡片更新邮寄状态任务结束: .............................");
    }

    /**
     * 速汇币种同步任务开始
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void queryCurrencyInfo() throws Exception {

        log.info("速汇币种同步任务开始: .............................");
        try {
            ucardTaskService.queryCurrencyInfo();
        } catch (Exception e) {
            log.error("速汇币种同步任务开始执行失败", e);
        }
        log.info("速汇币种同步任务开始结束: .............................");
    }

}
