package com.ruoyi.credit.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.credit.service.impl.FinancingServiceImpl;

/**
 * 融资管理控制器
 * 
 * @author ruoyi
 * @date 2025-01-07
 */
@RestController
@RequestMapping("/credit/financing")
public class FinancingController extends BaseController
{
    @Autowired
    private FinancingServiceImpl financingService;

    /**
     * 批量同步所有贷款数据到融资申请
     */
    @PostMapping("/batchSync")
    @Log(title = "融资管理", businessType = BusinessType.UPDATE)
    public AjaxResult batchSyncAllLoansToFinancing()
    {
        Map<String, Object> result = financingService.batchSyncAllLoansToFinancing();
        
        if ((Boolean) result.get("success")) {
            return success(result.get("message").toString());
        } else {
            return error(result.get("message").toString());
        }
    }
}