use of com.github.qinyou.system.model.SysVisitLog in project my_curd by qinyou.
the class SysVisitLogController method view.
/**
* 查看按钮
*/
public void view() {
String id = getPara("id");
if (StringUtils.notEmpty(id)) {
SysVisitLog sysVisitLog = SysVisitLog.dao.findById(id);
setAttr("sysVisitLog", sysVisitLog);
}
render("system/sysVisitLog_view.ftl");
}
use of com.github.qinyou.system.model.SysVisitLog in project my_curd by qinyou.
the class SysVisitLogController method exportExcel.
/**
* 导出excel
*/
@RequirePermission("sysVisitLog:export")
@Before(SearchSql.class)
public void exportExcel() {
String where = getAttr(Constant.SEARCH_SQL);
if (SysVisitLog.dao.findCountByWhere(where) > 50000) {
setAttr("msg", "一次导出数据不可大于 5W 条,请修改查询条件。");
render("common/card.ftl");
return;
}
// 测试大数据量导出
List<SysVisitLog> list = SysVisitLog.dao.findByWhere(where);
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("访问日志", "访问日志"), SysVisitLog.class, list);
render(ExcelRender.me(workbook).fileName("访问日志.xls"));
}
use of com.github.qinyou.system.model.SysVisitLog in project my_curd by qinyou.
the class VisitLogInterceptor method intercept.
@Override
public void intercept(Invocation inv) {
Controller controller = inv.getController();
SysVisitLog sysVisitLog = new SysVisitLog();
sysVisitLog.setId(IdUtils.id());
sysVisitLog.setSysUserIp(WebUtils.getRemoteAddress(controller.getRequest()));
sysVisitLog.setSysUser(WebUtils.getSessionUsername(controller));
sysVisitLog.setUrl(inv.getActionKey());
sysVisitLog.setRequestType(controller.getRequest().getMethod());
sysVisitLog.setCreateTime(new Date());
Map<String, String[]> params = controller.getRequest().getParameterMap();
if (params.keySet().size() > 0) {
sysVisitLog.setParam(JSON.toJSONString(params));
if (sysVisitLog.getParam().length() > 500) {
sysVisitLog.setParam("超长文本参数");
}
}
sysVisitLog.save();
inv.invoke();
}
Aggregations