package com.ruoyi.ibs.list.controller;

import com.github.pagehelper.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableDataPageInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ibs.list.domain.*;
import com.ruoyi.ibs.list.service.*;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.rmi.ServerException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 活动Controller
 *
 * @author ruoyi
 * @date 2024-09-11
 */
@RestController
@Api("标签管理-客群圈选-活动管理")
@RequestMapping("/system/campaign")
public class SysCampaignController extends BaseController {
    @Autowired
    private ISysCampaignService sysCampaignService;
    @Autowired
    private ISysGroupCustomerService sysGroupCustomerService;


    @Autowired
    private ISysCustAppointSupplementService iSysCustAppointSupplementService;


    /**
     * 查询走访名单列表
     */
//    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/visitInfoList")
    @ApiOperation("走访名单")
    @Log(title ="走访名单列表")
    public TableDataInfo list(VisitInfo visitInfo)
    {
//        startPage();
        List<VisitInfoVo> list = sysCampaignService.selectVisitInfoVoList(visitInfo);
        return getDataTable(list);
    }

    /**
     * 修改走访名单
     */
//    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "走访名单", businessType = BusinessType.UPDATE)
    @PostMapping("/editVisitInfo")
    @ApiOperation("修改走访备注")
    public AjaxResult edit(@RequestBody VisitInfo visitInfo)
    {
        return toAjax(sysCampaignService.updateVisitInfo(visitInfo));
    }
}
