package com.ruoyi.ibs.list.controller;

import java.util.List;

import com.ruoyi.ibs.list.domain.VisitCampaignComment;
import com.ruoyi.ibs.list.domain.VisitCampaignCount;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 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.ibs.list.domain.CampaignCount;
import com.ruoyi.ibs.list.service.ICampaignCountService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 走访任务统计Controller
 * 
 * @author ruoyi
 * @date 2025-04-02
 */
@RestController
@RequestMapping("/system/campaignStatistics")
public class SysCampaignStatisticsController extends BaseController
{
    @Autowired
    private ICampaignCountService campaignCountService;



    /**
     * 走访任务统计卡片
     */
//    @PreAuthorize("@ss.hasPermi('system:count:list')")
    @GetMapping("/card")
    @ApiOperation("走访任务统计卡片")
    @Log(title = "走访-走访任务统计卡片")
    public TableDataInfo card(CampaignCount campaignCount)
    {
//        startPage();
        List<CampaignCount> list = campaignCountService.selectCampaignCountList(campaignCount);
        return getDataTable(list);
    }

    /**
     * 走访任务统计列表
     */
//    @PreAuthorize("@ss.hasPermi('system:count:list')")
    @GetMapping("/list")
    @ApiOperation("走访任务统计列表")
    @Log(title = "走访-走访任务统计列表")
    public TableDataInfo list(VisitCampaignCount visitCampaignCount)
    {
        startPage();
        List<VisitCampaignCount> list = campaignCountService.selectVisitCampaignCountList(visitCampaignCount);
        return getDataTable(list);
    }

    @GetMapping("/checkBranchList")
    @ApiOperation("查看支行")
    @Log(title = "走访-查看支行")
    public TableDataInfo branchList(VisitCampaignCount visitCampaignCount)//传任务ID
    {
        startPage();
        List<VisitCampaignCount> list = campaignCountService.selectBranchList(visitCampaignCount);
        return getDataTable(list);
    }

    @GetMapping("/checkOutletList")
    @ApiOperation("查看网点")
    @Log(title = "走访-查看网点")
    public TableDataInfo outletList(VisitCampaignCount visitCampaignCount)//从查看支行页面过来的：传任务ID,支行ID   从总行页面过来的：传任务ID
    {
        startPage();
        List<VisitCampaignCount> list = campaignCountService.selectOutletList(visitCampaignCount);
        return getDataTable(list);
    }

    @GetMapping("/checkPersonList")
    @ApiOperation("查看个人")
    @Log(title = "走访-查看个人")
    public TableDataInfo personList(VisitCampaignCount visitCampaignCount)//从查看支行页面过来的：传任务ID,支行ID（本质上没有推送网点，查客户经理就是查客户经理所在网点）
    {
        startPage();
        List<VisitCampaignCount> list = campaignCountService.selectPersonList(visitCampaignCount);
        return getDataTable(list);
    }

    /**
     * 走访任务统计点评
     */
    @GetMapping("/commentList")
    @ApiOperation("走访任务统计点评")
    @Log(title = "走访-走访任务统计点评")
    public TableDataInfo commentList(VisitCampaignComment visitCampaignComment)//从查看支行页面过来的：传任务ID,支行ID
    {
//        startPage();
        List<VisitCampaignCount> list = campaignCountService.selectCommentList(visitCampaignComment);
        return getDataTable(list);
    }

    /**
     * 新增走访任务统计-点评
     */
//    @PreAuthorize("@ss.hasPermi('system:comment:add')")
    @Log(title = "走访-新增走访任务统计点评", businessType = BusinessType.INSERT)
    @PostMapping("/insertCommentList")
    @ApiOperation("新增走访任务统计-点评")
    public AjaxResult add(@RequestBody VisitCampaignComment visitCampaignComment)
    {
        return toAjax(campaignCountService.insertVisitCampaignComment(visitCampaignComment));
    }

}
