package com.dayou.controller;

import com.dayou.annotation.IgnoreAuth;
import com.dayou.common.RestResponse;
import com.dayou.dyoa.IDyoaHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * DYOA 手动同步dyoa数据
 *
 * @author wucl
 * @since 2023-01-10
 */
@RestController
@RequestMapping("dyoa")
@Slf4j
public class DyoaController {



    @Autowired
    private IDyoaHistoryService dyoaHistoryService;

    @IgnoreAuth
    @GetMapping("/personData")
    public void syncDyoaPersonalData(){
        dyoaHistoryService.fetchDyoaPersonalOrder();
        log.info("同步个贷数据完成");
    }

    @IgnoreAuth
    @GetMapping("/majorData")
    public void syncDyoaMajorData(){
        dyoaHistoryService.fetchDyoaMajorOrderProduction();
        log.info("同步大中型数据完成");
    }

    @IgnoreAuth
    @GetMapping("/assetsData")
    public void syncAssetsData(){
        dyoaHistoryService.fetchAssetsOrderProduction();
        log.info("同步资产数据完成");
    }

    @IgnoreAuth
    @GetMapping("/realAmountData")
    public void syncRealAmountData(){
        dyoaHistoryService.fetchRealAmount();
        log.info("同步实收款数据完成");
    }

    @IgnoreAuth
    @GetMapping("/realClaimData")
    public void syncRealClaimData(){
        dyoaHistoryService.fetchRealAmountClaimData();
        log.info("同步实收款认领数据完成");
    }

    @IgnoreAuth
    @GetMapping("/invoiceData")
    public void syncFinanceInvoiceData(){
        dyoaHistoryService.fetchFinanceInvoiceRecord();
        log.info("同步财务开票数据完成");
    }


    @IgnoreAuth
    @GetMapping("/update/productionFundId")
    public RestResponse<Boolean> updateProductionFund(){
        Boolean ret = dyoaHistoryService.updateProductionFund();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/claimProductionId")
    public RestResponse<Boolean> updateClaimProductionId(){
        Boolean ret = dyoaHistoryService.updateClaimProductionId();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/majorProduction")
    public RestResponse<Boolean> updateMajorProduction(){
        Boolean ret = dyoaHistoryService.updateMajorProduction();
        return RestResponse.data(ret);
    }


    @IgnoreAuth
    @GetMapping("/update/majorCommission")
    public RestResponse<Boolean> updateMajorCommission(){
        Boolean ret = dyoaHistoryService.updateCommissionDeclare();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/personalProduction")
    public RestResponse<Boolean> updatePersonalProduction(){
        Boolean ret = dyoaHistoryService.updatePersonalProduction();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/assetsProduction")
    public RestResponse<Boolean> updateAssetsProduction(){
        Boolean ret = dyoaHistoryService.updateAssetsProduction();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/personalProductionTime")
    public RestResponse<Boolean> updatePersonalProductionTime(){
        Boolean ret = dyoaHistoryService.updatePersonalProductionTime();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/majorSubClientId")
    public RestResponse<Boolean> updateMajorSubClientId(){
        Boolean ret = dyoaHistoryService.updateMajorSubClientId();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/assetsMembers")
    public RestResponse<Boolean> updateAssetsMembers(){
        Boolean ret = dyoaHistoryService.updateAssetsMembers();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/majorMarketDepartmentId")
    public RestResponse<Boolean> majorMarketDepartmentId(){
        Boolean ret = dyoaHistoryService.majorMarketDepartmentId();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/majorProductionTime")
    public RestResponse<Boolean> majorProductionTime(){
        Boolean ret = dyoaHistoryService.majorProductionTime();
        return RestResponse.data(ret);
    }

    @IgnoreAuth
    @GetMapping("/update/assetsMarketDepartment")
    public RestResponse<Boolean> assetsMarketDepartment(){
        Boolean ret = dyoaHistoryService.assetsMarketDepartment();
        return RestResponse.data(ret);
    }
}
