package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.IMarketRunManageService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.vo.marketrun.*;
import com.muchinfo.mtp3pojos.vo.query.position.PositionSheetResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/marketRun")
@Api(value = "市场运行API", description = "市场运行管理")
public class MarketRunManagerController {

    @Resource
    private IMarketRunManageService iMarketRunManageService;

    @ApiOperation("市场运行管理-->监控管理-->在线用户查询-->获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/queryUserLogin")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<MarketRunLoginUserResult> queryUserLogin(String loginid, Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iMarketRunManageService.queryUserLogin(loginid, pageNum, pageSize, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->在线用户查询-->强制下线/强制所有用户下线loginid==null")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    @RequestMapping(method = RequestMethod.GET, value = "/downonline")
    private AjaxResult downonline(Long loginid, HttpServletRequest request) {
        return iMarketRunManageService.downonline(loginid, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->斩仓监控-->获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/cutposition")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<MarketRunCutPositionResult> queryCutposition(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iMarketRunManageService.queryCutposition(pageNum, pageSize, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->账户风险监控-->初始化参数信息")
    @RequestMapping(method = RequestMethod.GET, value = "/initInvestor")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<MarketRunInitInvestor> initInvestor(HttpServletRequest request) {
        return iMarketRunManageService.initInvestor(request);
    }

    @ApiOperation("市场运行管理-->监控管理-->账户风险监控-->获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/investor")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<MarketRunInvestorResult> investor(MarketRunInvestorParam param, HttpServletRequest request) {
        return iMarketRunManageService.investor(param, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->做市会员风险监控-->获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/memberRisk")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<MarketRunMemberResult> memberRisk(MarketRunInvestorParam param, HttpServletRequest request) {
        return iMarketRunManageService.memberRisk(param, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->做市会员风险监控-->账户持仓汇总监控-->获取列表")
    @RequestMapping(method = RequestMethod.GET, value = "/accpage")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<AccPosInfoVo> accpage(Long accountid, HttpServletRequest request) {
        return iMarketRunManageService.accpage(accountid, request);
    }

    @ApiOperation("市场运行管理-->监控管理-->做市会员风险监控-->账户持仓汇总监控-->持仓明细")
    @RequestMapping(method = RequestMethod.GET, value = "/queryHolderDetailMonitor")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<PositionSheetResult> queryHolderDetailMonitor(Long accountid, Long goodsid, HttpServletRequest request) {
        return iMarketRunManageService.queryHolderDetailMonitor(accountid, goodsid, request);
    }
}
