package com.crm.ucard.controller;

import com.crm.rely.backend.core.constant.FeignClientAnnotation;
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.CardOperateDto;
import com.crm.rely.backend.core.entity.ucard.CardOperatePageEntity;
import com.crm.rely.backend.exception.ServiceException;
import com.crm.ucard.service.UcardCardService;
import com.crm.ucard.service.UcardExportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

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

    @Autowired
    private UcardCardService ucardCardService;
    @Autowired
    private UcardExportService ucardExportService;

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

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


}
