package com.fs.qw.controller;

import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.domain.R;
import com.fs.common.core.page.TableDataInfo;
//import com.fs.framework.service.TokenService;
import com.fs.qw.domain.QwGroupChatUser;
import com.fs.qw.param.QwGroupChatUserDataType;
import com.fs.qw.param.QwInsertGroupChatUserParam;
import com.fs.qw.service.IQwGroupChatUserService;
import com.fs.qw.vo.QwGroupChatUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 客户群成员列Controller
 *
 * @author fs
 * @date 2024-06-20
 */
@RestController
@RequestMapping("/qw/group_chat_user")
public class QwGroupChatUserController extends BaseController
{
    @Autowired
    private IQwGroupChatUserService qwGroupChatUserService;

//    @Autowired
//    private TokenService tokenService;

    /**
     * 查询客户群成员列列表
     */
    @GetMapping("/list")
    public TableDataInfo list(QwGroupChatUser qwGroupChatUser)
    {
        startPage();
        List<QwGroupChatUserVO> list = qwGroupChatUserService.selectQwGroupChatUserList(qwGroupChatUser);
        return getDataTable(list);
    }


    /**
     * 获取客户群成员列详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwGroupChatUserService.selectQwGroupChatUserById(id));
    }


    /** 获取日星月的入群退群统计 */
    @GetMapping("/getDataWeekMonthCount")
    public R getDataWeekMonthCount(QwGroupChatUserDataType qwGroupChatUserDataType){

        return qwGroupChatUserService.getDataWeekMonthCount(qwGroupChatUserDataType);
    }

    /**
     *  同步 插入某个客户群信息
     */
    @PutMapping("/cogradientGroupChatUser")
    public R cogradientGroupChatUser(@RequestBody QwInsertGroupChatUserParam param) {

        return qwGroupChatUserService.cogradientGroupChatUser(param.getCorpId(), param.getChatId());
    }
}
