访问日志完成提交

This commit is contained in:
thinkgem
2018-01-18 21:06:15 +08:00
parent 5bc6bc9e6b
commit 10fadeb317
10 changed files with 409 additions and 388 deletions

View File

@@ -1,262 +1,275 @@
/** /**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved. * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/ */
package com.jeesite.common.lang; package com.jeesite.common.lang;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output; import com.esotericsoftware.kryo.io.Output;
import com.jeesite.common.io.IOUtils; import com.jeesite.common.io.IOUtils;
/** /**
* 对象操作工具类, 继承org.apache.commons.lang3.ObjectUtils类 * 对象操作工具类, 继承org.apache.commons.lang3.ObjectUtils类
* @author ThinkGem * @author ThinkGem
* @version 2014-6-29 * @version 2014-6-29
*/ */
public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils { public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
/** /**
* 转换为Double类型 * 转换为Double类型
*/ */
public static Double toDouble(final Object val) { public static Double toDouble(final Object val) {
if (val == null) { if (val == null) {
return 0D; return 0D;
} }
try { try {
return NumberUtils.toDouble(StringUtils.trim(val.toString())); return NumberUtils.toDouble(StringUtils.trim(val.toString()));
} catch (Exception e) { } catch (Exception e) {
return 0D; return 0D;
} }
} }
/** /**
* 转换为Float类型 * 转换为Float类型
*/ */
public static Float toFloat(final Object val) { public static Float toFloat(final Object val) {
return toDouble(val).floatValue(); return toDouble(val).floatValue();
} }
/** /**
* 转换为Long类型 * 转换为Long类型
*/ */
public static Long toLong(final Object val) { public static Long toLong(final Object val) {
return toDouble(val).longValue(); return toDouble(val).longValue();
} }
/** /**
* 转换为Integer类型 * 转换为Integer类型
*/ */
public static Integer toInteger(final Object val) { public static Integer toInteger(final Object val) {
return toLong(val).intValue(); return toLong(val).intValue();
} }
/** /**
* 转换为Boolean类型 'true', 'on', 'y', 't', 'yes' or '1' (case insensitive) will return true. Otherwise, false is returned. * 转换为Boolean类型 'true', 'on', 'y', 't', 'yes' or '1' (case insensitive) will return true. Otherwise, false is returned.
*/ */
public static Boolean toBoolean(final Object val) { public static Boolean toBoolean(final Object val) {
if (val == null) { if (val == null) {
return false; return false;
} }
return BooleanUtils.toBoolean(val.toString()) || "1".equals(val.toString()); return BooleanUtils.toBoolean(val.toString()) || "1".equals(val.toString());
} }
/** /**
* 转换为字符串 * 转换为字符串
* @param obj * @param obj
* @return * @return
*/ */
public static String toString(final Object obj) { public static String toString(final Object obj) {
return toString(obj, StringUtils.EMPTY); return toString(obj, StringUtils.EMPTY);
} }
/** /**
* 如果对象为空则使用defaultVal值 * 如果对象为空则使用defaultVal值
* @param obj * @param obj
* @param defaultVal * @param defaultVal
* @return * @return
*/ */
public static String toString(final Object obj, final String defaultVal) { public static String toString(final Object obj, final String defaultVal) {
return obj == null ? defaultVal : obj.toString(); return obj == null ? defaultVal : obj.toString();
} }
/** /**
* 空转空字符串("" to "" ; null to "" ; "null" to "" ; "NULL" to "" ; "Null" to "" * 空转空字符串("" to "" ; null to "" ; "null" to "" ; "NULL" to "" ; "Null" to ""
* @param val 需转换的值 * @param val 需转换的值
* @return 返回转换后的值 * @return 返回转换后的值
*/ */
public static String toStringIgnoreNull(final Object val) { public static String toStringIgnoreNull(final Object val) {
return ObjectUtils.toStringIgnoreNull(val, StringUtils.EMPTY); return ObjectUtils.toStringIgnoreNull(val, StringUtils.EMPTY);
} }
/** /**
* 空对象转空字符串 "" to defaultVal ; null to defaultVal ; "null" to defaultVal ; "NULL" to defaultVal ; "Null" to defaultVal * 空对象转空字符串 "" to defaultVal ; null to defaultVal ; "null" to defaultVal ; "NULL" to defaultVal ; "Null" to defaultVal
* @param val 需转换的值 * @param val 需转换的值
* @param defaultVal 默认值 * @param defaultVal 默认值
* @return 返回转换后的值 * @return 返回转换后的值
*/ */
public static String toStringIgnoreNull(final Object val, String defaultVal) { public static String toStringIgnoreNull(final Object val, String defaultVal) {
String str = ObjectUtils.toString(val); String str = ObjectUtils.toString(val);
return !"".equals(str) && !"null".equals(str.trim().toLowerCase()) ? str : defaultVal; return !"".equals(str) && !"null".equals(str.trim().toLowerCase()) ? str : defaultVal;
} }
/** /**
* 注解到对象复制,只复制能匹配上的方法。 硕正组件用。 * 注解到对象复制,只复制能匹配上的方法。 硕正组件用。
* @param annotation * @param annotation
* @param object * @param object
*/ */
public static void annotationToObject(Object annotation, Object object) { public static void annotationToObject(Object annotation, Object object) {
if (annotation != null && object != null) { if (annotation != null && object != null) {
Class<?> annotationClass = annotation.getClass(); Class<?> annotationClass = annotation.getClass();
Class<?> objectClass = object.getClass(); Class<?> objectClass = object.getClass();
for (Method m : objectClass.getMethods()) { for (Method m : objectClass.getMethods()) {
if (StringUtils.startsWith(m.getName(), "set")) { if (StringUtils.startsWith(m.getName(), "set")) {
try { try {
String s = StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3)); String s = StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3));
Object obj = annotationClass.getMethod(s).invoke(annotation); Object obj = annotationClass.getMethod(s).invoke(annotation);
if (obj != null && !"".equals(obj.toString())) { if (obj != null && !"".equals(obj.toString())) {
// if (object == null){ // if (object == null){
// object = objectClass.newInstance(); // object = objectClass.newInstance();
// } // }
m.invoke(object, obj); m.invoke(object, obj);
} }
} catch (Exception e) { } catch (Exception e) {
// 忽略所有设置失败方法 // 忽略所有设置失败方法
} }
} }
} }
} }
} }
/** /**
* 序列化对象 * 序列化对象
* @param object * @param object
* @return * @return
*/ */
public static byte[] serialize(Object object) { public static byte[] serialize(Object object) {
ObjectOutputStream oos = null; ObjectOutputStream oos = null;
ByteArrayOutputStream baos = null; ByteArrayOutputStream baos = null;
try { try {
if (object != null) { if (object != null) {
baos = new ByteArrayOutputStream(); baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos); oos = new ObjectOutputStream(baos);
oos.writeObject(object); oos.writeObject(object);
return baos.toByteArray(); return baos.toByteArray();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.closeQuietly(oos); IOUtils.closeQuietly(oos);
IOUtils.closeQuietly(baos); IOUtils.closeQuietly(baos);
} }
return null; return null;
} }
/** /**
* 反序列化对象 * 反序列化对象
* @param bytes * @param bytes
* @return * @return
*/ */
public static Object unserialize(byte[] bytes) { public static Object unserialize(byte[] bytes) {
ByteArrayInputStream bais = null; ByteArrayInputStream bais = null;
ObjectInputStream ois = null; ObjectInputStream ois = null;
try { try {
if (bytes != null && bytes.length > 0) { if (bytes != null && bytes.length > 0) {
bais = new ByteArrayInputStream(bytes); bais = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
return ois.readObject(); return ois.readObject();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
IOUtils.closeQuietly(ois); IOUtils.closeQuietly(ois);
IOUtils.closeQuietly(bais); IOUtils.closeQuietly(bais);
} }
return null; return null;
} }
// Kryo不是线程安全的所以要建立一个线程变量每一个线程实例化一次 // Kryo不是线程安全的所以要建立一个线程变量每一个线程实例化一次
public static final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() { public static final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() {
@Override @Override
protected Kryo initialValue() { protected Kryo initialValue() {
Kryo kryo = new Kryo(); Kryo kryo = new Kryo();
return kryo; return kryo;
}; };
}; };
/** /**
* Kryo序列化对象 * Kryo序列化对象
* @param object * @param object
* @return * @return
*/ */
public static byte[] serializeKryo(Object object) { public static byte[] serializeKryo(Object object) {
// long beginTime = System.currentTimeMillis(); // long beginTime = System.currentTimeMillis();
byte[] bytes = null; byte[] bytes = null;
Output output = null; Output output = null;
try { try {
if (object != null) { if (object != null) {
output = new Output(1024, -1); output = new Output(1024, -1);
kryos.get().writeClassAndObject(output, object); kryos.get().writeClassAndObject(output, object);
bytes = output.toBytes(); bytes = output.toBytes();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (output != null) { if (output != null) {
output.close(); output.close();
} }
} }
// GlobalConfig.log(ObjectUtils.class, object + " 序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime)); // GlobalConfig.log(ObjectUtils.class, object + " 序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return bytes; return bytes;
} }
/** /**
* Kryo反序列化对象 * Kryo反序列化对象
* @param bytes * @param bytes
* @return * @return
*/ */
public static Object unserializeKryo(byte[] bytes) { public static Object unserializeKryo(byte[] bytes) {
// long beginTime = System.currentTimeMillis(); // long beginTime = System.currentTimeMillis();
Object object = null; Object object = null;
Input input = null; Input input = null;
try { try {
if (bytes != null && bytes.length > 0) { if (bytes != null && bytes.length > 0) {
input = new Input(bytes, 0, bytes.length); input = new Input(bytes, 0, bytes.length);
object = kryos.get().readClassAndObject(input); object = kryos.get().readClassAndObject(input);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (input != null) { if (input != null) {
input.close(); input.close();
} }
} }
// GlobalConfig.log(ObjectUtils.class, object + " 反序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime)); // GlobalConfig.log(ObjectUtils.class, object + " 反序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return object; return object;
} }
/** /**
* 克隆一个对象 * 克隆一个对象(完全拷贝)
* @param source * @param source
* @param ignoreProperties */
*/ public static Object cloneBean(Object source){
public static Object copyBean(Object source, String... ignoreProperties){ if (source == null){
if (source == null){ return null;
return null; }
} byte[] bytes = ObjectUtils.serializeKryo(source);
Object target = BeanUtils.instantiate(source.getClass()); Object target = ObjectUtils.unserializeKryo(bytes);
BeanUtils.copyProperties(source, target, ignoreProperties); return target;
return target; }
}
/**
} * 拷贝一个对象(但是子对象无法拷贝)
* @param source
* @param ignoreProperties
*/
public static Object copyBean(Object source, String... ignoreProperties){
if (source == null){
return null;
}
Object target = BeanUtils.instantiate(source.getClass());
BeanUtils.copyProperties(source, target, ignoreProperties);
return target;
}
}

View File

@@ -12,7 +12,7 @@
<category_index>0</category_index> <category_index>0</category_index>
<zoom>1.0</zoom> <zoom>1.0</zoom>
<x>109</x> <x>109</x>
<y>1843</y> <y>1903</y>
<default_color> <default_color>
<r>128</r> <r>128</r>
<g>128</g> <g>128</g>
@@ -2776,8 +2776,8 @@
<type>longtext</type> <type>longtext</type>
</word> </word>
<word> <word>
<id>f03c7f6fd8e06c46193fbbb4f0bd913293f055dc</id> <id>f638d63bc277ad1057f0b0bfad3358ca3ba54294</id>
<length>255</length> <length>500</length>
<decimal>null</decimal> <decimal>null</decimal>
<array>false</array> <array>false</array>
<array_dimension>null</array_dimension> <array_dimension>null</array_dimension>
@@ -13910,7 +13910,7 @@
</sequence> </sequence>
</normal_column> </normal_column>
<normal_column> <normal_column>
<word_id>f03c7f6fd8e06c46193fbbb4f0bd913293f055dc</word_id> <word_id>f638d63bc277ad1057f0b0bfad3358ca3ba54294</word_id>
<id>34aa444468170790d3bd52b0d8a5885776813978</id> <id>34aa444468170790d3bd52b0d8a5885776813978</id>
<description></description> <description></description>
<unique_key_name></unique_key_name> <unique_key_name></unique_key_name>

View File

@@ -450,7 +450,7 @@ CREATE TABLE js_sys_log
create_by varchar2(64) NOT NULL, create_by varchar2(64) NOT NULL,
create_by_name nvarchar2(100) NOT NULL, create_by_name nvarchar2(100) NOT NULL,
create_date timestamp NOT NULL, create_date timestamp NOT NULL,
request_uri nvarchar2(255), request_uri nvarchar2(500),
request_method varchar2(10), request_method varchar2(10),
request_params clob, request_params clob,
diff_modify_data clob, diff_modify_data clob,

View File

@@ -29,8 +29,8 @@ import com.jeesite.modules.sys.utils.UserUtils;
@Column(name="id", attrName="id", label="编码", isPK=true), @Column(name="id", attrName="id", label="编码", isPK=true),
@Column(name="log_type", attrName="logType", label="日志类型"), @Column(name="log_type", attrName="logType", label="日志类型"),
@Column(name="log_title", attrName="logTitle", label="日志标题", queryType=QueryType.LIKE), @Column(name="log_title", attrName="logTitle", label="日志标题", queryType=QueryType.LIKE),
@Column(name="create_by", attrName="createBy.userCode", label="创建者", isUpdate=false), @Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
@Column(name="create_by_name", attrName="createBy.userName", label="创建者名称", queryType=QueryType.LIKE), @Column(name="create_by_name", attrName="createByName", label="创建者名称", isUpdate=false, queryType=QueryType.LIKE),
@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false), @Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
@Column(name="request_uri", attrName="requestUri", label="请求URI", queryType=QueryType.LIKE), @Column(name="request_uri", attrName="requestUri", label="请求URI", queryType=QueryType.LIKE),
@Column(name="request_method", attrName="requestMethod", label="操作方式"), @Column(name="request_method", attrName="requestMethod", label="操作方式"),
@@ -101,7 +101,7 @@ public class Log extends DataEntity<Log> {
this.logTitle = logTitle; this.logTitle = logTitle;
} }
@Length(min=0, max=255, message="请求URI长度不能超过 255 个字符") @Length(min=0, max=500, message="请求URI长度不能超过 500 个字符")
public String getRequestUri() { public String getRequestUri() {
LoginInfo p = UserUtils.getLoginInfo(); LoginInfo p = UserUtils.getLoginInfo();
if (p != null && "1".equals(p.getParam("l"))){ if (p != null && "1".equals(p.getParam("l"))){

View File

@@ -14,7 +14,6 @@ import com.jeesite.common.lang.DateUtils;
import com.jeesite.common.service.CrudService; import com.jeesite.common.service.CrudService;
import com.jeesite.modules.sys.dao.LogDao; import com.jeesite.modules.sys.dao.LogDao;
import com.jeesite.modules.sys.entity.Log; import com.jeesite.modules.sys.entity.Log;
import com.jeesite.modules.sys.entity.User;
/** /**
* 日志Service * 日志Service
@@ -41,7 +40,7 @@ public class LogService extends CrudService<LogDao, Log> {
// 普通用户看自己的,管理员看全部的。 // 普通用户看自己的,管理员看全部的。
if (!log.getCurrentUser().isAdmin()){ if (!log.getCurrentUser().isAdmin()){
log.setCreateBy(new User(log.getCurrentUser().getUserCode())); log.setCreateBy(log.getCurrentUser().getUserCode());
} }
return super.findPage(page, log); return super.findPage(page, log);

View File

@@ -70,9 +70,9 @@ public class LogUtils {
log.setLogType(logType); log.setLogType(logType);
if (StringUtils.isBlank(log.getLogType())){ if (StringUtils.isBlank(log.getLogType())){
String sqlCommandTypes = ObjectUtils.toString(request.getAttribute(SqlCommandType.class.getName())); String sqlCommandTypes = ObjectUtils.toString(request.getAttribute(SqlCommandType.class.getName()));
if (StringUtils.inString(","+sqlCommandTypes+",", ",INSERT,", ",UPDATE,", ",DELETE,")){ if (StringUtils.containsAny(","+sqlCommandTypes+",", ",INSERT,", ",UPDATE,", ",DELETE,")){
log.setLogType(Log.TYPE_UPDATE); log.setLogType(Log.TYPE_UPDATE);
}else if (StringUtils.inString(","+sqlCommandTypes+",", ",SELECT,")){ }else if (StringUtils.contains(","+sqlCommandTypes+",", ",SELECT,")){
log.setLogType(Log.TYPE_SELECT); log.setLogType(Log.TYPE_SELECT);
}else{ }else{
log.setLogType(Log.TYPE_ACCESS); log.setLogType(Log.TYPE_ACCESS);
@@ -101,7 +101,7 @@ public class LogUtils {
} }
// 异步保存日志 // 异步保存日志
new SaveLogThread(log, handler, throwable).start(); new SaveLogThread(log, handler, request.getContextPath(), throwable).start();
} }
/** /**
* 保存日志线程 * 保存日志线程
@@ -110,12 +110,14 @@ public class LogUtils {
private Log log; private Log log;
private Object handler; private Object handler;
private String contextPath;
private Throwable throwable; private Throwable throwable;
public SaveLogThread(Log log, Object handler, Throwable throwable){ public SaveLogThread(Log log, Object handler, String contextPath, Throwable throwable){
super(SaveLogThread.class.getSimpleName()); super(SaveLogThread.class.getSimpleName());
this.log = log; this.log = log;
this.handler = handler; this.handler = handler;
this.contextPath = contextPath;
this.throwable = throwable; this.throwable = throwable;
} }
@@ -148,6 +150,7 @@ public class LogUtils {
String attrName = MapperHelper.getAttrName(c); String attrName = MapperHelper.getAttrName(c);
if (attrName != null){ if (attrName != null){
log.setBizKey(log.getRequestParam(attrName)); log.setBizKey(log.getRequestParam(attrName));
log.setBizType(type.getSimpleName());
} }
} catch (Exception e) { } catch (Exception e) {
break; break;
@@ -175,7 +178,17 @@ public class LogUtils {
} }
} }
} }
log.setLogTitle(Static.menuService.getMenuNamePath(log.getRequestUri(), permission)); String href = log.getRequestUri();
if (StringUtils.startsWith(href, contextPath)){
href = StringUtils.substringAfter(href, contextPath);
}
if (StringUtils.startsWith(href, Global.getAdminPath())){
href = StringUtils.substringAfter(href, Global.getAdminPath());
}
if (StringUtils.startsWith(href, Global.getFrontPath())){
href = StringUtils.substringAfter(href, Global.getFrontPath());
}
log.setLogTitle(Static.menuService.getMenuNamePath(href, permission));
} }
if (StringUtils.isBlank(log.getLogTitle())){ if (StringUtils.isBlank(log.getLogTitle())){
log.setLogTitle("未知操作"); log.setLogTitle("未知操作");

View File

@@ -367,7 +367,6 @@ web:
${adminPath}/login, ${adminPath}/login,
${adminPath}/desktop, ${adminPath}/desktop,
${adminPath}/sys/online/count, ${adminPath}/sys/online/count,
${adminPath}/**/listData,
${adminPath}/**/treeData, ${adminPath}/**/treeData,
${adminPath}/file/**, ${adminPath}/file/**,
${adminPath}/tags/* ${adminPath}/tags/*

View File

@@ -1,23 +1,22 @@
<% layout('/layouts/default.html', {title: '操作日志表管理', libs: ['validate']}){ %> <% layout('/layouts/default.html', {title: '日志详情', libs: ['validate']}){ %>
<div class="main-content"> <div class="main-content">
<div class="box box-main"> <div class="box box-main">
<div class="box-header with-border"> <div class="box-header with-border">
<div class="box-title"> <div class="box-title">
<i class="fa fa-list-alt"></i> ${log.isNewRecord ? '新增操作日志表' : '编辑操作日志表'} <i class="fa fa-bug"></i> 日志详情
</div> </div>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div> </div>
</div> </div>
<#form:form id="inputForm" model="${log}" action="${ctx}/sys/log/save" method="post" class="form-horizontal"> <#form:form id="inputForm" model="${log}" action="${ctx}/sys/log/save" method="post" class="form-horizontal">
<div class="box-body"> <div class="box-body"><br/>
<div class="form-unit">基本信息</div>
<#form:hidden path="id"/> <#form:hidden path="id"/>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 日志标题:<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 日志标题:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:input path="logTitle" maxlength="500" class="form-control required "/> <#form:input path="logTitle" maxlength="500" class="form-control required "/>
</div> </div>
@@ -26,18 +25,44 @@
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 日志类型:<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 日志类型:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:select path="logType" dictType="sys_log_type" class="form-control required " /> <#form:select path="logType" dictType="sys_log_type" class="form-control required " />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 请求地址:<i class="fa icon-question hide"></i></label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-addon control-label">&nbsp;${log.serverAddr} &nbsp;</span>
<#form:input value="${log.requestUri}" maxlength="255" class="form-control "/>
<span class="input-group-addon control-label">&nbsp;${log.requestMethod} &nbsp;</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 提交的数据:<i class="fa icon-question hide"></i></label>
<div class="col-sm-10">
<#form:input path="requestParams" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 用户名称<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 操作用户:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:input path="createByName" maxlength="100" class="form-control required "/> <#form:input path="createByName" maxlength="100" class="form-control required "/>
</div> </div>
@@ -46,33 +71,26 @@
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 请求URI<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 操作账号<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:input path="requestUri" maxlength="255" class="form-control "/> <#form:input path="createBy" maxlength="100" class="form-control required "/>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<% if(@Global.YES.equals(log.isException)){ %>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 操作方式<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 异常信息<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-10">
<#form:input path="requestMethod" maxlength="10" class="form-control "/> <#form:textarea path="exceptionInfo" rows="10" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 操作提交的数据:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="requestParams" class="form-control "/>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<% } %>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
@@ -97,63 +115,43 @@
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required ">*</span> 操作IP地址<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 操作时间<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="createDate" dataFormat="datetime" class="form-control required "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 客户端IP<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:input path="remoteAddr" maxlength="255" class="form-control required "/> <#form:input path="remoteAddr" maxlength="255" class="form-control required "/>
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required ">*</span> 请求服务器地址:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="serverAddr" maxlength="255" class="form-control required "/>
</div>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-12">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 是否异常:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:select path="isException" dictType="sys_yes_no" blankOption="true" class="form-control " />
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 异常信息:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="exceptionInfo" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 用户代理:<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 用户代理:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-10">
<#form:input path="userAgent" maxlength="500" class="form-control "/> <#form:input path="userAgent" maxlength="500" class="form-control "/>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 设备名称/操作系统<i class="fa icon-question hide"></i></label> <span class="required hide">*</span> 设备名称:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8"> <div class="col-sm-8">
<#form:input path="deviceName" maxlength="100" class="form-control "/> <#form:input path="deviceName" maxlength="100" class="form-control "/>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4" title=""> <label class="control-label col-sm-4" title="">
@@ -168,9 +166,6 @@
<div class="box-footer"> <div class="box-footer">
<div class="row"> <div class="row">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<% if (hasPermi('sys:log:edit')){ %>
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>&nbsp;
<% } %>
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button> <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
</div> </div>
</div> </div>

View File

@@ -30,28 +30,30 @@
<div class="form-group"> <div class="form-group">
<label class="control-label">日志类型:</label> <label class="control-label">日志类型:</label>
<div class="control-inline width-90"> <div class="control-inline width-90">
<#form:select path="logType" dictType="sys_log_type" class="form-control required " /> <#form:select path="logType" dictType="sys_log_type" blankOption="true" class="form-control required " />
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group"> -->
<label class="control-label">操作账号:</label> <!-- <label class="control-label">操作账号:</label> -->
<div class="control-inline"> <!-- <div class="control-inline"> -->
<#form:input path="createBy.userCode" maxlength="64" class="form-control width-90"/> <!-- <#form:input path="createBy" maxlength="64" class="form-control width-90"/> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
<div class="form-group"> <div class="form-group">
<label class="control-label">操作用户:</label> <label class="control-label">操作用户:</label>
<div class="control-inline"> <div class="control-inline width-120">
<#form:input path="createBy.userName" maxlength="100" class="form-control width-90"/> <#form:listselect id="userSelect" title="用户" path="createBy"
url="${ctx}/sys/user/userSelect?userType=" allowClear="false"
checkbox="false" itemCode="userCode" itemName="userName"/>
</div> </div>
</div> </div>
<div class="clearfix"></div>
<div class="form-group"> <div class="form-group">
<label class="control-label">是否异常:</label> <label class="control-label">是否异常:</label>
<div class="control-inline width-90"> <div class="control-inline width-60">
<#form:select path="isException" dictType="sys_yes_no" blankOption="true" class="form-control"/> <#form:select path="isException" dictType="sys_yes_no" blankOption="true" class="form-control"/>
</div> </div>
</div> </div>
<div class="clearfix"></div>
<div class="form-group"> <div class="form-group">
<label class="control-label">业务主键:</label> <label class="control-label">业务主键:</label>
<div class="control-inline"> <div class="control-inline">
@@ -74,31 +76,30 @@
dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
</div> </div>
</div> </div>
<div class="clearfix"></div>
<div class="form-group"> <div class="form-group">
<label class="control-label">客户端IP</label> <label class="control-label">客户端IP</label>
<div class="control-inline"> <div class="control-inline">
<#form:input path="remoteAddr" maxlength="255" class="form-control width-90"/> <#form:input path="remoteAddr" maxlength="255" class="form-control width-90"/>
</div> </div>
</div> </div>
<div class="form-group"> <!-- <div class="form-group"> -->
<label class="control-label">服务器IP</label> <!-- <label class="control-label">服务器IP</label> -->
<div class="control-inline"> <!-- <div class="control-inline"> -->
<#form:input path="serverAddr" maxlength="255" class="form-control width-90"/> <!-- <#form:input path="serverAddr" maxlength="255" class="form-control width-90"/> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
<div class="form-group"> <!-- <div class="form-group"> -->
<label class="control-label">设备名称:</label> <!-- <label class="control-label">设备名称:</label> -->
<div class="control-inline"> <!-- <div class="control-inline"> -->
<#form:input path="deviceName" maxlength="100" class="form-control width-90"/> <!-- <#form:input path="deviceName" maxlength="100" class="form-control width-90"/> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
<div class="form-group"> <!-- <div class="form-group"> -->
<label class="control-label">浏览器名:</label> <!-- <label class="control-label">浏览器名:</label> -->
<div class="control-inline"> <!-- <div class="control-inline"> -->
<#form:input path="browserName" maxlength="100" class="form-control width-90"/> <!-- <#form:input path="browserName" maxlength="100" class="form-control width-90"/> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-primary btn-sm">查询</button> <button type="submit" class="btn btn-primary btn-sm">查询</button>
<button type="reset" class="btn btn-default btn-sm">重置</button> <button type="reset" class="btn btn-default btn-sm">重置</button>
@@ -116,32 +117,33 @@ $('#dataGrid').dataGrid({
searchForm: $("#searchForm"), searchForm: $("#searchForm"),
columnModel: [ columnModel: [
{header:'日志标题', name:'logTitle', index:'a.log_title', width:200, align:"left", frozen:true, formatter: function(val, obj, row, act){ {header:'日志标题', name:'logTitle', index:'a.log_title', width:200, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/sys/log/form?id='+row.id+'" class="btnList" data-title="编辑操作日志表">'+(val ? val : row.id)+'</a>'; return '<a href="${ctx}/sys/log/form?id='+row.id+'" class="btnList" data-title="日志详情">'+(val ? val : row.id)+'</a>';
}}, }},
{header:'请求URI', name:'requestUri', index:'a.request_uri', width:200, align:"left"}, {header:'请求地址', name:'requestUri', index:'a.request_uri', width:260, align:"left", formatter: function(val, obj, row, act){
{header:'操作方式', name:'requestMethod', index:'a.request_method', width:200, align:"left"}, return '<span title="['+row.requestMethod+'] '+row.serverAddr+row.requestUri+'">'+ row.requestUri;
{header:'日志类型', name:'logType', index:'a.log_type', width:200, align:"left", formatter: function(val, obj, row, act){ }},
{header:'日志类型', name:'logType', index:'a.log_type', width:100, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_log_type')}, val, '未知', true); return js.getDictLabel(${@DictUtils.getDictListJson('sys_log_type')}, val, '未知', true);
}}, }},
{header:'操作账号', name:'createBy.userCode', index:'a.create_by', width:200, align:"left"}, {header:'操作用户', name:'createByName', index:'a.create_by_name', width:100, align:"center", formatter: function(val, obj, row, act){
{header:'操作用户', name:'createByName.userCode', index:'a.create_by_name', width:200, align:"left"}, return '<span title="账号:'+row.createBy+'">'+ row.createByName;
{header:'是否异常', name:'isException', index:'a.is_exception', width:200, align:"center", formatter: function(val, obj, row, act){ }},
{header:'异常', name:'isException', index:'a.is_exception', width:60, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_yes_no')}, val, '未知', true); return js.getDictLabel(${@DictUtils.getDictListJson('sys_yes_no')}, val, '未知', true);
}}, }},
{header:'业务主键', name:'bizKey', index:'a.biz_key', width:200, align:"left"}, {header:'业务主键', name:'bizKey', index:'a.biz_key', width:90, align:"center"},
{header:'业务类型', name:'bizType', index:'a.biz_type', width:200, align:"left"}, {header:'业务类型', name:'bizType', index:'a.biz_type', width:90, align:"center"},
{header:'操作时间', name:'createDate', index:'a.create_date', width:200, align:"left"}, {header:'操作时间', name:'createDate', index:'a.create_date', width:100, align:"center"},
{header:'客户端IP', name:'remoteAddr', index:'a.remote_addr', width:200, align:"left"}, {header:'客户端IP', name:'remoteAddr', index:'a.remote_addr', width:100, align:"center"},
{header:'服务器IP', name:'serverAddr', index:'a.server_addr', width:200, align:"left"}, {header:'设备名称', name:'deviceName', index:'a.device_name', width:100, align:"center"},
{header:'设备名称', name:'deviceName', index:'a.device_name', width:200, align:"left"}, {header:'浏览器名', name:'browserName', index:'a.browser_name', width:100, align:"center"}/* ,
{header:'浏览器名', name:'browserName', index:'a.browser_name', width:200, align:"left"},
{header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){ {header:'操作', name:'actions', width:130, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = []; var actions = [];
<% if(hasPermi('sys:log:edit')){ %> <% if(hasPermi('sys:log:edit')){ %>
actions.push('<a href="${ctx}/sys/log/form?id='+row.id+'" class="btnList" title="编辑操作日志表"><i class="fa fa-pencil"></i></a>&nbsp;'); actions.push('<a href="${ctx}/sys/log/form?id='+row.id+'" class="btnList" title="日志详情"><i class="fa fa-pencil"></i></a>&nbsp;');
<% } %> <% } %>
return actions.join(''); return actions.join('');
}} }} */
], ],
// 加载成功后执行事件 // 加载成功后执行事件
ajaxSuccess: function(data){ ajaxSuccess: function(data){

View File

@@ -3,7 +3,7 @@
<div class="box box-main"> <div class="box box-main">
<div class="box-header with-border"> <div class="box-header with-border">
<div class="box-title"> <div class="box-title">
<i class="fa fa-list-alt"></i> ${empUser.isNewRecord ? '新增用户' : op == 'auth' ? '用户授权角色' : '编辑用户'} <i class="fa icon-people"></i> ${empUser.isNewRecord ? '新增用户' : op == 'auth' ? '用户授权角色' : '编辑用户'}
</div> </div>
<div class="box-tools pull-right"> <div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>