package com.crm.manager.controller;

import com.crm.manager.service.FinanceDepositFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.model.dto.finance.deposit.FinanceDepositDto;
import com.crm.rely.backend.model.entity.finance.deposit.FinanceDepositApproveEntity;
import com.crm.rely.backend.model.entity.finance.deposit.FinanceDepositDeleteEntity;
import com.crm.rely.backend.model.entity.finance.deposit.FinanceDepositSearchListEntity;
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;

/**
 * @description: 入金
 * @author: houn
 * @create: 2020-07-07 18:01
 **/
@RestController
@RequestMapping("/finance/deposit")
public class FinanceDepositController {

    @Autowired
    private FinanceDepositFeignService financeDepositFeignService;

    @PostMapping("/approve")
    public BaseResultDto approve(@RequestBody @Validated FinanceDepositApproveEntity entity) throws Exception {

        return financeDepositFeignService.approve(entity);
    }

    @PostMapping("/delete")
    public BaseResultDto delete(@RequestBody @Validated FinanceDepositDeleteEntity entity) throws Exception {

        return financeDepositFeignService.delete(entity);
    }

    @PostMapping("/search/list")
    public BaseResultDto searchList(@RequestBody @Validated FinanceDepositSearchListEntity entity) throws Exception {

        ResultWithPagerDto<FinanceDepositDto> resultWithPagerDto = financeDepositFeignService.searchList(entity);
        return resultWithPagerDto;
    }

    @PostMapping("/search/single")
    public BaseResultDto searchSingle(@RequestBody @Validated SingleLongEntity entity) throws Exception {
        BaseResultDto<FinanceDepositDto> resultDto = financeDepositFeignService.searchSingle(entity);
        return resultDto;
    }

}
