
package com.wzj.soopin.statistics.controller;


import com.wzj.soopin.statistics.entity.dto.StatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.MemberDistributionVO;
import com.wzj.soopin.statistics.entity.vo.OnlineMemberVO;
import com.wzj.soopin.statistics.entity.vo.PlatformViewVO;
import com.wzj.soopin.statistics.service.PlatformViewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 管理端,流量统计接口
 *
 * @author Chopper
 * @since 2021/2/9 11:19
 */
@Tag(name = "管理端,流量统计接口")
@RestController
@RequestMapping("/manager/statistics/view")
public class ViewStatisticsManagerController {
    @Autowired
    private PlatformViewService platformViewService;

    @Operation(summary = "流量数据 表单获取")
    @GetMapping("/list")
    public R<List<PlatformViewVO>> getByPage(StatisticsQueryParam queryParam) {
        return R.ok(platformViewService.list(queryParam));
    }

    @Operation(summary = "当前在线人数")
    @GetMapping("/online/current")
    public R<Long> currentNumberPeopleOnline() {
        return R.ok(platformViewService.online());
    }


    @Operation(summary = "会员分布")
    @GetMapping("/online/distribution")
    public R<List<MemberDistributionVO>> memberDistribution() {
        return R.ok(platformViewService.memberDistribution());
    }

    @Operation(summary = "在线人数历史（默认48小时）")
    @GetMapping("/online/history")
    public R<List<OnlineMemberVO>> history() {
        return R.ok(platformViewService.statisticsOnline());
    }

}
