package com.starry.admin.modules.weichat.controller;

import com.starry.admin.common.aspect.ClerkUserLogin;
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
import com.starry.admin.modules.clerk.service.IPlayClerkRankingInfoService;
import com.starry.admin.modules.weichat.entity.order.PlayOrderHistoryRankingReturnVo;
import com.starry.admin.modules.weichat.entity.order.PlayOrderRankingReturnVo;
import com.starry.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author admin
 * @since 2024/5/25 下午10:25
 **/
@Api(tags = "微信订单排行接口", description = "微信端订单排行相关接口")
@Slf4j
@RestController
@RequestMapping("/wx/orderRanking")
public class WxPlayOrderRankingController {

    @Resource
    private IPlayClerkRankingInfoService playClerkRankingInfoService;

    /**
     * 查询当前排行
     */
    @ApiOperation(value = "查询当前排行", notes = "查询店员当前排行榜信息")
    @ApiResponses({@ApiResponse(code = 200, message = "操作成功", response = PlayOrderRankingReturnVo.class)})
    @ClerkUserLogin
    @GetMapping("/clerk/selectCurrentRanking")
    public R selectCurrentRanking() {
        PlayOrderRankingReturnVo result = playClerkRankingInfoService
                .selectCurrentRanking(ThreadLocalRequestDetail.getClerkUserInfo().getId());
        return R.ok(result);

    }

    /**
     * 查询历史排行
     */
    @ApiOperation(value = "查询历史排行", notes = "查询店员历史排行榜信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功", response = PlayOrderHistoryRankingReturnVo.class, responseContainer = "List")})
    @ClerkUserLogin
    @GetMapping("/clerk/selectHistoryRanking")
    public R selectHistoryRanking() {
        List<PlayOrderHistoryRankingReturnVo> result = playClerkRankingInfoService
                .selectHistoryRanking(ThreadLocalRequestDetail.getClerkUserInfo().getId());
        return R.ok(result);

    }
}
