package com.crm.custom.controller;

import com.crm.custom.service.FinanceWithdrawFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.model.dto.finance.withdraw.FinanceWithdrawDto;
import com.crm.rely.backend.model.entity.custom.info.CustomInfoEntity;
import com.crm.rely.backend.model.entity.finance.withdraw.FinanceWithdrawSearchListEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

@RestController
@RequestMapping("/finance/withdraw")
public class FinanceWithdrawController {

    @Autowired
    private FinanceWithdrawFeignService financeWithdrawFeignService;

    @PostMapping("/searcher/list")
    public BaseResultDto searcherList(@RequestBody @Validated FinanceWithdrawSearchListEntity entity, CustomInfoEntity infoEntity) throws Exception {
        entity.setCustomId(infoEntity.getId());
        entity.setCom(1);
        ResultWithPagerDto<FinanceWithdrawDto> resultWithPagerDto = financeWithdrawFeignService.searcherList(entity);
        return resultWithPagerDto;
    }

}
