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.Exchangerateconfig;
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;
import java.math.BigDecimal;

@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.POST, 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.POST, 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);
    }

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

    @ApiOperation("系统运行管理-->系统汇率管理-->删除")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/deleteRate")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private AjaxResult deleteRate(Integer oricurrencyid, Integer descurrencyid, HttpServletRequest request) {
        return iSystemSetUpService.deleteRate(oricurrencyid, descurrencyid, request);
    }

    @ApiOperation("系统运行管理-->系统汇率管理-->新增/修改初始化")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/dealinit")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private AjaxResult<SystemRateResult> dealinit(Integer oricurrencyid, Integer descurrencyid, HttpServletRequest request) {
        return iSystemSetUpService.dealinit(oricurrencyid, descurrencyid, request);
    }

    @ApiOperation("系统运行管理-->系统汇率管理-->新增/修改 flag==0 新增 flag==1 修改")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/dealRate")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private AjaxResult dealRate(Integer oricurrencyid, Integer descurrencyid, BigDecimal exchangerate, Integer flag, HttpServletRequest request) {
        return iSystemSetUpService.dealRate(oricurrencyid, descurrencyid, exchangerate, flag, request);
    }
}
