package com.ym.mec.web.controller.education;

import com.ym.mec.biz.dal.dto.OAFinancialDto;
import com.ym.mec.biz.dal.dto.ReturnFeeDto;
import com.ym.mec.biz.dal.entity.FinancialExpenditure;
import com.ym.mec.biz.dal.entity.MusicGroupQuit;
import com.ym.mec.biz.service.ContractService;
import com.ym.mec.biz.service.FinancialExpenditureService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RequestMapping()
@Api(tags = "OA签章服务")
@RestController
public class OaContractsController extends BaseController {

    @Autowired
    private ContractService contractService;
    @Autowired
    private FinancialExpenditureService financialExpenditureService;

    @PostMapping("oaContracts/finance")
    public HttpResponseResult<String> transferProduceContract(@RequestBody OAFinancialDto financialDto) {
        String fileUrl = contractService.transferOaFinancial(financialDto);
        return succeed(fileUrl);
    }

    @PostMapping("oa/syncPayLog")
    @ApiOperation("同步oa审批到支出记录")
    public HttpResponseResult syncOaPayLog(Integer workOrderId,String fileUrl) throws Exception {
        financialExpenditureService.syncOaPayLog(workOrderId,fileUrl);
        return succeed();
    }

    @PostMapping("oa/checkCourseReturnFee")
    @ApiOperation("校验课程退费、乐团退费参数")
    public HttpResponseResult checkCourseReturnFee(@RequestBody Map<String,String> paramMap) {
        financialExpenditureService.checkCourseReturnFee(paramMap);
        return succeed();
    }
}
