package com.kxs.user.biz.controller.kxsapp;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kxs.common.core.util.R;
import com.kxs.user.api.model.KxsUserPresetLog;
import com.kxs.user.biz.service.KxsUserEquityService;
import com.kxs.user.biz.service.KxsUserPresetLogService;
import com.kxs.user.biz.service.KxsUserService;
import com.kxs.user.biz.service.TradeDaySummaryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 用户相关(UserLevel)控制层
 *
 * @author 系统
 * @since 2024-02-26 17:19:48
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("userLevel")
public class UserLevelController {

    /**
     * 服务对象
     */
    private final KxsUserService kxsUserService;
    private final KxsUserPresetLogService kxsUserPresetLogService;
    private final KxsUserEquityService kxsUserEquityService;
    private final TradeDaySummaryService tradeDaySummaryService;

    @PostMapping("preUserLevel")
    public R preUserLevel(@RequestBody KxsUserPresetLog param){

        return kxsUserPresetLogService.preUserLevel(param);
    }

    @GetMapping("preUserLevelDetail")
    public R preUserLevelDetail(@RequestParam("userId") Long userId){

        return R.ok(kxsUserPresetLogService.getOne(Wrappers.<KxsUserPresetLog>lambdaQuery().eq(KxsUserPresetLog::getUserId, userId)));
    }


    /**
     * 我的职级-职级详情
     *
     * @return 我的职级-职级详情
     */
    @GetMapping("/levelDetail")
    public R levelDetail() {
        return R.ok(kxsUserService.levelDetail());
    }


    /**
     * 我的职级-当月实时业绩详情
     *
     * @return 我的职级-当月实时业绩详情
     */
    @GetMapping("/amountDetail")
    public R amountDetail() {

        return R.ok(tradeDaySummaryService.amountDetail());
    }


    /**
     * 我的职级-我的特权
     *
     * @return 我的职级-我的特权
     */
    @GetMapping("/equityList")
    public R equityList() {

        return R.ok(kxsUserEquityService.equityList());
    }


}

