package com.muchinfo.mtp3century.controller;


import com.muchinfo.mtp3century.service.ISystemRunService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.entity.Ipbacklist;
import com.muchinfo.mtp3pojos.entity.Systemmanagerlog;
import com.muchinfo.mtp3pojos.entity.WskhBlacklist;
import com.muchinfo.mtp3pojos.vo.systemrun.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

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

@Controller
@RequestMapping("/operation")
@Api(value = "系统运行API", description = "系统运行管理")
public class SystemRunController {

    @Resource
    private ISystemRunService iSystemSetUpService;

    @ApiOperation("系统运行管理-->管理员操作日志-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryLog")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<SystemUserLogResult> query(SystemUserLogParam param, HttpServletRequest request) {
        return iSystemSetUpService.queryByPage(param, request);
    }

    @ApiOperation("系统运行管理-->管理员操作日志-->详情")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/view")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<Systemmanagerlog> view(Long id, HttpServletRequest request) {
        return iSystemSetUpService.view(id, request);
    }

    @ApiOperation("系统运行管理-->登录异常流水查询-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryError")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<SystemLoginErrorResult> queryError(SystemLoginErrorParam param, HttpServletRequest request) {
        return iSystemSetUpService.queryError(param, request);
    }

    @ApiOperation("系统运行管理-->登录异常流水查询-->导出")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/export")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private AjaxResult export(SystemLoginErrorParam param, HttpServletRequest request) {
        return iSystemSetUpService.export(param, request);
    }

    @ApiOperation("系统运行管理-->系统服务运行日志-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/querymrsl")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<YmrslQueryResult> querymrsl(YmrslQueryParam param, HttpServletRequest request) {
        return iSystemSetUpService.querymrsl(param, request);
    }

    @ApiOperation("系统运行管理-->开户黑名单管理-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryBlackList")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<WskhBlacklist> queryBlackList(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iSystemSetUpService.queryBlackList(pageNum, pageSize, request);
    }

    @ApiOperation("系统运行管理-->开户黑名单管理-->新增/修改")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/dealBlackList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult dealBlackList(@RequestBody BlackListAddParam param, HttpServletRequest request) {
        return iSystemSetUpService.dealBlackList(param, request);
    }

    @ApiOperation("系统运行管理-->开户黑名单管理-->删除")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/delBlackList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult delBlackList(Long id, HttpServletRequest request) {
        return iSystemSetUpService.delBlackList(id, request);
    }

    @ApiOperation("系统运行管理-->IP黑名单管理-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryIPList")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<Ipbacklist> queryIPList(String adress, Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iSystemSetUpService.queryIPList(adress, pageNum, pageSize, request);
    }

    @ApiOperation("系统运行管理-->IP黑名单管理-->新增")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/addIPList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult addIPList(@RequestBody IpListDelParam param, HttpServletRequest request) {
        return iSystemSetUpService.addIPList(param, request);
    }

    @ApiOperation("系统运行管理-->IP黑名单管理-->删除")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/delIPList")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult delIPList(IpListDelParam param, HttpServletRequest request) {
        return iSystemSetUpService.delIPList(param, request);
    }

    @ApiOperation("系统运行管理-->终端登录日志-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryloginlog")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<LoginLogQueryResult> queryloginlog(LoginLogQueryParam param, HttpServletRequest request) {
        return iSystemSetUpService.queryloginlog(param, request);
    }

    @ApiOperation("系统运行管理-->终端登录日志-->详情")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/loginlogview")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<LoginLogQueryResult> loginlogview(LoginLogQueryParam param, HttpServletRequest request) {
        return iSystemSetUpService.loginlogview(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/loginlogExport")
    @ResponseBody
    @ApiOperation("系统运行管理-->终端登录日志-->导出")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult loginlogExport(LoginLogQueryParam param, HttpServletRequest request) {
        return iSystemSetUpService.loginlogExport(param, request);
    }
}
