修改了一些代码的注释,方便后期对代码进行维护,修改,以及新功能模块的开发
This commit is contained in:
parent
bd5a16ed19
commit
e03f2fb42c
|
|
@ -1,26 +1,24 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
|
||||
/**
|
||||
* druid 监控
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/data")
|
||||
public class DruidController extends BaseController
|
||||
{
|
||||
public class DruidController extends BaseController {
|
||||
private String prefix = "/monitor/druid";
|
||||
|
||||
@RequiresPermissions("monitor:data:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
public String index() {
|
||||
return redirect(prefix + "/index");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,26 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控,获取项目部署的服务器的cpu、内存等情况
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController extends BaseController
|
||||
{
|
||||
public class ServerController extends BaseController {
|
||||
private String prefix = "monitor/server";
|
||||
|
||||
@RequiresPermissions("monitor:server:view")
|
||||
@GetMapping()
|
||||
public String server(ModelMap mmap) throws Exception
|
||||
{
|
||||
public String server(ModelMap mmap) throws Exception {
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
mmap.put("server", server);
|
||||
|
|
|
|||
|
|
@ -1,34 +1,30 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.quartz.domain.SysJob;
|
||||
import com.ruoyi.quartz.service.ISysJobService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/job")
|
||||
public class SysJobController extends BaseController
|
||||
{
|
||||
public class SysJobController extends BaseController {
|
||||
private String prefix = "monitor/job";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -36,16 +32,14 @@ public class SysJobController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:job:view")
|
||||
@GetMapping()
|
||||
public String job()
|
||||
{
|
||||
public String job() {
|
||||
return prefix + "/job";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysJob job)
|
||||
{
|
||||
public TableDataInfo list(SysJob job) {
|
||||
startPage();
|
||||
List<SysJob> list = jobService.selectJobList(job);
|
||||
return getDataTable(list);
|
||||
|
|
@ -55,8 +49,7 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysJob job)
|
||||
{
|
||||
public AjaxResult export(SysJob job) {
|
||||
List<SysJob> list = jobService.selectJobList(job);
|
||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||
return util.exportExcel(list, "job");
|
||||
|
|
@ -66,15 +59,11 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
public AjaxResult remove(String ids) {
|
||||
try {
|
||||
jobService.deleteJobByIds(ids);
|
||||
return success();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return error(e.getMessage());
|
||||
}
|
||||
|
|
@ -82,8 +71,7 @@ public class SysJobController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:job:detail")
|
||||
@GetMapping("/detail/{jobId}")
|
||||
public String detail(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||
{
|
||||
public String detail(@PathVariable("jobId") Long jobId, ModelMap mmap) {
|
||||
mmap.put("name", "job");
|
||||
mmap.put("job", jobService.selectJobById(jobId));
|
||||
return prefix + "/detail";
|
||||
|
|
@ -96,8 +84,7 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysJob job)
|
||||
{
|
||||
public AjaxResult changeStatus(SysJob job) {
|
||||
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(jobService.changeStatus(job));
|
||||
}
|
||||
|
|
@ -109,8 +96,7 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PostMapping("/run")
|
||||
@ResponseBody
|
||||
public AjaxResult run(SysJob job)
|
||||
{
|
||||
public AjaxResult run(SysJob job) {
|
||||
return toAjax(jobService.run(job));
|
||||
}
|
||||
|
||||
|
|
@ -118,8 +104,7 @@ public class SysJobController extends BaseController
|
|||
* 新增调度
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
public String add() {
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +115,7 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysJob job)
|
||||
{
|
||||
public AjaxResult addSave(SysJob job) {
|
||||
job.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(jobService.insertJobCron(job));
|
||||
}
|
||||
|
|
@ -140,8 +124,7 @@ public class SysJobController extends BaseController
|
|||
* 修改调度
|
||||
*/
|
||||
@GetMapping("/edit/{jobId}")
|
||||
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
|
||||
{
|
||||
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap) {
|
||||
mmap.put("job", jobService.selectJobById(jobId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
|
@ -153,19 +136,17 @@ public class SysJobController extends BaseController
|
|||
@RequiresPermissions("monitor:job:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysJob job)
|
||||
{
|
||||
public AjaxResult editSave(SysJob job) {
|
||||
job.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(jobService.updateJobCron(job));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*/
|
||||
@PostMapping("/checkCronExpressionIsValid")
|
||||
@ResponseBody
|
||||
public boolean checkCronExpressionIsValid(SysJob job)
|
||||
{
|
||||
public boolean checkCronExpressionIsValid(SysJob job) {
|
||||
return jobService.checkCronExpressionIsValid(job.getCronExpression());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,5 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
|
|
@ -18,16 +8,22 @@ import com.ruoyi.common.utils.ExcelUtil;
|
|||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.quartz.domain.SysJobLog;
|
||||
import com.ruoyi.quartz.service.ISysJobLogService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度日志操作处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/jobLog")
|
||||
public class SysJobLogController extends BaseController
|
||||
{
|
||||
public class SysJobLogController extends BaseController {
|
||||
private String prefix = "monitor/job";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -35,16 +31,14 @@ public class SysJobLogController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:job:view")
|
||||
@GetMapping()
|
||||
public String jobLog()
|
||||
{
|
||||
public String jobLog() {
|
||||
return prefix + "/jobLog";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysJobLog jobLog)
|
||||
{
|
||||
public TableDataInfo list(SysJobLog jobLog) {
|
||||
startPage();
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||
return getDataTable(list);
|
||||
|
|
@ -54,8 +48,7 @@ public class SysJobLogController extends BaseController
|
|||
@RequiresPermissions("monitor:job:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysJobLog jobLog)
|
||||
{
|
||||
public AjaxResult export(SysJobLog jobLog) {
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(jobLog);
|
||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||
return util.exportExcel(list, "jobLog");
|
||||
|
|
@ -65,15 +58,13 @@ public class SysJobLogController extends BaseController
|
|||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(jobLogService.deleteJobLogByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:job:detail")
|
||||
@GetMapping("/detail/{jobLogId}")
|
||||
public String detail(@PathVariable("jobLogId") Long jobLogId, ModelMap mmap)
|
||||
{
|
||||
public String detail(@PathVariable("jobLogId") Long jobLogId, ModelMap mmap) {
|
||||
mmap.put("name", "jobLog");
|
||||
mmap.put("jobLog", jobLogService.selectJobLogById(jobLogId));
|
||||
return prefix + "/detail";
|
||||
|
|
@ -83,8 +74,7 @@ public class SysJobLogController extends BaseController
|
|||
@RequiresPermissions("monitor:job:remove")
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
public AjaxResult clean() {
|
||||
jobLogService.cleanJobLog();
|
||||
return success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -8,24 +15,17 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
public class SysLogininforController extends BaseController {
|
||||
private String prefix = "monitor/logininfor";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -33,16 +33,14 @@ public class SysLogininforController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:logininfor:view")
|
||||
@GetMapping()
|
||||
public String logininfor()
|
||||
{
|
||||
public String logininfor() {
|
||||
return prefix + "/logininfor";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
public TableDataInfo list(SysLogininfor logininfor) {
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
|
|
@ -52,8 +50,7 @@ public class SysLogininforController extends BaseController
|
|||
@RequiresPermissions("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysLogininfor logininfor)
|
||||
{
|
||||
public AjaxResult export(SysLogininfor logininfor) {
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "logininfor");
|
||||
|
|
@ -63,17 +60,15 @@ public class SysLogininforController extends BaseController
|
|||
@Log(title = "登陆日志", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登陆日志", businessType = BusinessType.CLEAN)
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
public AjaxResult clean() {
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,29 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.service.ISysOperLogService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
public class SysOperlogController extends BaseController {
|
||||
private String prefix = "monitor/operlog";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -35,54 +31,78 @@ public class SysOperlogController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:operlog:view")
|
||||
@GetMapping()
|
||||
public String operlog()
|
||||
{
|
||||
public String operlog() {
|
||||
return prefix + "/operlog";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志
|
||||
*
|
||||
* @param operLog
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:operlog:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
public TableDataInfo list(SysOperLog operLog) {
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出操作日志
|
||||
*
|
||||
* @param operLog
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:operlog:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysOperLog operLog)
|
||||
{
|
||||
public AjaxResult export(SysOperLog operLog) {
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
return util.exportExcel(list, "operLog");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除操作日志
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详细操作日志
|
||||
*
|
||||
* @param operId
|
||||
* @param mmap
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:operlog:detail")
|
||||
@GetMapping("/detail/{operId}")
|
||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||
{
|
||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap) {
|
||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
public AjaxResult clean() {
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,5 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
|
|
@ -17,19 +8,24 @@ import com.ruoyi.common.page.TableDataInfo;
|
|||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
public class SysUserOnlineController extends BaseController {
|
||||
private String prefix = "monitor/online";
|
||||
|
||||
@Autowired
|
||||
|
|
@ -40,41 +36,46 @@ public class SysUserOnlineController extends BaseController
|
|||
|
||||
@RequiresPermissions("monitor:online:view")
|
||||
@GetMapping()
|
||||
public String online()
|
||||
{
|
||||
public String online() {
|
||||
return prefix + "/online";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有的用户
|
||||
*
|
||||
* @param userOnline
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:online:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysUserOnline userOnline)
|
||||
{
|
||||
public TableDataInfo list(SysUserOnline userOnline) {
|
||||
startPage();
|
||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分批强制退出用户
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:online:batchForceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/batchForceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids)
|
||||
{
|
||||
for (String sessionId : ids)
|
||||
{
|
||||
public AjaxResult batchForceLogout(@RequestParam("ids[]") String[] ids) {
|
||||
for (String sessionId : ids) {
|
||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (online == null)
|
||||
{
|
||||
if (online == null) {
|
||||
return error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
if (onlineSession == null) {
|
||||
return error("用户已下线");
|
||||
}
|
||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||
{
|
||||
if (sessionId.equals(ShiroUtils.getSessionId())) {
|
||||
return error("当前登陆用户无法强退");
|
||||
}
|
||||
onlineSession.setStatus(OnlineStatus.off_line);
|
||||
|
|
@ -84,24 +85,26 @@ public class SysUserOnlineController extends BaseController
|
|||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制退出用户
|
||||
*
|
||||
* @param sessionId
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/forceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult forceLogout(String sessionId)
|
||||
{
|
||||
public AjaxResult forceLogout(String sessionId) {
|
||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||
{
|
||||
if (sessionId.equals(ShiroUtils.getSessionId())) {
|
||||
return error("当前登陆用户无法强退");
|
||||
}
|
||||
if (online == null)
|
||||
{
|
||||
if (online == null) {
|
||||
return error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
if (onlineSession == null) {
|
||||
return error("用户已下线");
|
||||
}
|
||||
onlineSession.setStatus(OnlineStatus.off_line);
|
||||
|
|
|
|||
|
|
@ -1,46 +1,46 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysOperLogMapper
|
||||
{
|
||||
public interface SysOperLogMapper {
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public void insertOperlog(SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<SysOperLog> selectOperLogList(SysOperLog operLog);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds(String[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
public SysOperLog selectOperLogById(Long operId);
|
||||
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue