package com.cool.store.controller.webb;

import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
import com.cool.store.enums.FileTypeEnum;
import com.cool.store.request.*;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

import javax.annotation.Resource;

/**
 * @Author: WangShuo
 * @Date: 2024/10/25/上午10:20
 * @Version 1.0
 * @注释:
 */
@RestController
@RequestMapping("/pc/export")
@Api("导出")
public class ExportController {

    @Resource
    private ExportService exportService;


//    @PostMapping("/preparationList")
//    @ApiOperation("进度管理")
//    public ResponseResult preparationList(@RequestBody BranchShopRequest request) {
//        return ResponseResult.success(exportService.branchShopList(request, CurrentUserHolder.getUser()));
//    }


    @PostMapping("/preparationList")
    @ApiOperation("进度管理")
    public ResponseResult preparationList(@RequestBody BranchShopRequest request) {
        return ResponseResult.success(exportService.branchShopList(request, CurrentUserHolder.getUser()));
    }
    @PostMapping("/exportFinance")
    @ApiOperation("财务导出")
    public ResponseResult exportFinance(@RequestBody BranchShopRequest request) {
        return ResponseResult.success(exportService.exportProgressBase(request, CurrentUserHolder.getUser(), FileTypeEnum.EXPORT_FINANCE));
    }
    @PostMapping("/exportJoinShop")
    @ApiOperation("加盟开店申请导出")
    public ResponseResult exportJoinShop(@RequestBody BranchShopRequest request) {
        return ResponseResult.success(exportService.exportProgressBase(request, CurrentUserHolder.getUser(), FileTypeEnum.EXPORT_JOIN_SHOP));
    }
    @PostMapping("/exportProgress")
    @ApiOperation("进度确认导出")
    public ResponseResult exportProgress(@RequestBody BranchShopRequest request) {
        return ResponseResult.success(exportService.exportProgressBase(request, CurrentUserHolder.getUser(), FileTypeEnum.EXPORT_PROGRESS));
    }

    @PostMapping("/zxjpOpenShopReport")
    @ApiOperation("正新鸡排开店导出")
    public ResponseResult zxjpOpenShopReport(@RequestBody FranchiseReportRequest request) {
        return ResponseResult.success(exportService.exportZxjpOpenShopReport(request, CurrentUserHolder.getUser()));
    }

    @PostMapping("/zxjpOpenShopReportPage")
    @ApiOperation("正新鸡排开店明细报表导出")
    public ResponseResult zxjpOpenShopReportPage(@RequestBody FranchiseReportRequest request) {
        return ResponseResult.success(exportService.exportZxjpOpenShopReportPage(request, CurrentUserHolder.getUser()));
    }

    @PostMapping("/preFryQualificationApply")
    @ApiOperation("预炸品资质申请导出")
    public ResponseResult preFryQualificationApply(@RequestBody ApplyManagementQueryDTO request) {
        return ResponseResult.success(exportService.exportPreFryQualificationApply(request, CurrentUserHolder.getUser()));
    }
}
