package com.tzld.piaoquan.api.controller.contentplatform;

import com.tzld.piaoquan.api.annotation.JwtIgnore;
import com.tzld.piaoquan.api.job.contentplatform.ContentPlatformDatastatJob;
import com.tzld.piaoquan.api.model.param.contentplatform.GzhDatastatListParam;
import com.tzld.piaoquan.api.model.param.contentplatform.QwDatastatListParam;
import com.tzld.piaoquan.api.model.vo.contentplatform.GzhDatastatItemVO;
import com.tzld.piaoquan.api.model.vo.contentplatform.QwDatastatItemVO;
import com.tzld.piaoquan.api.service.contentplatform.ContentPlatformDatastatService;
import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
import com.tzld.piaoquan.growth.common.utils.page.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contentPlatform/datastat")
@CrossOrigin(origins = "*")
public class ContentPlatformDatastatController {

    @Autowired
    ContentPlatformDatastatService datastatService;

    @Autowired
    ContentPlatformDatastatJob job;

    @ApiOperation(value = "公众号数据统计")
    @PostMapping("/gzh")
    public CommonResponse<Page<GzhDatastatItemVO>> gzhDatastatList(@RequestBody GzhDatastatListParam param) {
        return CommonResponse.success(datastatService.gzhDatastatList(param));
    }

    @ApiOperation(value = "企微数据统计")
    @PostMapping("/qw")
    public CommonResponse<Page<QwDatastatItemVO>> qwDatastatList(@RequestBody QwDatastatListParam param) {
        return CommonResponse.success(datastatService.qwDatastatList(param));
    }

    @ApiOperation(value = "公众号数据统计导出")
    @PostMapping("/gzh/export")
    public CommonResponse<String> gzhDatastatExport(@RequestBody GzhDatastatListParam param) {
        return CommonResponse.success(datastatService.gzhDatastatExport(param));
    }

    @ApiOperation(value = "企微数据统计导出")
    @PostMapping("/qw/export")
    public CommonResponse<String> qwDatastatExport(@RequestBody QwDatastatListParam param) {
        return CommonResponse.success(datastatService.qwDatastatExport(param));
    }

    @ApiOperation(value = "公众号自动回复分账号数据统计同步任务", hidden = true)
    @GetMapping("/job/syncGzhDatastat")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformGzhDatastatJob(String dateStr) {
        job.syncContentPlatformGzhDatastatJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "公众号自动回复分账号分视频数据统计同步任务", hidden = true)
    @GetMapping("/job/syncGzhVideoDatastat")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformGzhVideoDatastatJob(String dateStr) {
        job.syncContentPlatformGzhVideoDatastatJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "公众号自动回复总计数据统计同步任务", hidden = true)
    @GetMapping("/job/syncGzhDatastatTotal")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformGzhDatastatTotalJob(String dateStr) {
        job.syncContentPlatformGzhDatastatTotalJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "服务号总计数据统计同步任务", hidden = true)
    @GetMapping("/job/syncFwhDatastatTotal")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformFwhDatastatTotalJob(String dateStr) {
        job.syncContentPlatformFwhDatastatTotalJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "服务号分账号数据统计同步任务", hidden = true)
    @GetMapping("/job/syncFwhDatastat")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformFwhDatastatJob(String dateStr) {
        job.syncContentPlatformFwhDatastatJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "公众号推送总计数据统计同步任务", hidden = true)
    @GetMapping("/job/syncGzhPushDatastatTotal")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformGzhPushDatastatTotalJob(String dateStr) {
        job.syncContentPlatformGzhPushDatastatTotalJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "公众号推送分账号数据统计同步任务", hidden = true)
    @GetMapping("/job/syncGzhPushDatastat")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformGzhPushDatastatJob(String dateStr) {
        job.syncContentPlatformGzhPushDatastatJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "企微数据统计同步任务", hidden = true)
    @GetMapping("/job/syncQwDatastat")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformQwDatastatJob(String dateStr) {
        job.syncContentPlatformQwDatastatJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "企微数据统计总计同步任务", hidden = true)
    @GetMapping("/job/syncQwDatastatTotal")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformQwDatastatTotalJob(String dateStr) {
        job.syncContentPlatformQwDatastatTotalJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "企微数据统计自动回复总计同步任务", hidden = true)
    @GetMapping("/job/syncQwDatastatReplyTotal")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformQwDatastatReplyTotalJob(String dateStr) {
        job.syncContentPlatformQwDatastatReplyTotalJob(dateStr);
        return CommonResponse.success();
    }

    @ApiOperation(value = "企微数据统计分子渠道同步任务", hidden = true)
    @GetMapping("/job/syncQwDatastatSubChannel")
    @JwtIgnore
    public CommonResponse<String> syncContentPlatformQwDatastatSubChannelJob(String dateStr) {
        job.syncContentPlatformQwDatastatSubChannelJob(dateStr);
        return CommonResponse.success();
    }

}
