访问日志完成提交

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.
*/
package com.jeesite.common.lang;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.jeesite.common.io.IOUtils;
/**
* 对象操作工具类, 继承org.apache.commons.lang3.ObjectUtils类
* @author ThinkGem
* @version 2014-6-29
*/
public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
/**
* 转换为Double类型
*/
public static Double toDouble(final Object val) {
if (val == null) {
return 0D;
}
try {
return NumberUtils.toDouble(StringUtils.trim(val.toString()));
} catch (Exception e) {
return 0D;
}
}
/**
* 转换为Float类型
*/
public static Float toFloat(final Object val) {
return toDouble(val).floatValue();
}
/**
* 转换为Long类型
*/
public static Long toLong(final Object val) {
return toDouble(val).longValue();
}
/**
* 转换为Integer类型
*/
public static Integer toInteger(final Object val) {
return toLong(val).intValue();
}
/**
* 转换为Boolean类型 'true', 'on', 'y', 't', 'yes' or '1' (case insensitive) will return true. Otherwise, false is returned.
*/
public static Boolean toBoolean(final Object val) {
if (val == null) {
return false;
}
return BooleanUtils.toBoolean(val.toString()) || "1".equals(val.toString());
}
/**
* 转换为字符串
* @param obj
* @return
*/
public static String toString(final Object obj) {
return toString(obj, StringUtils.EMPTY);
}
/**
* 如果对象为空则使用defaultVal值
* @param obj
* @param defaultVal
* @return
*/
public static String toString(final Object obj, final String defaultVal) {
return obj == null ? defaultVal : obj.toString();
}
/**
* 空转空字符串("" to "" ; null to "" ; "null" to "" ; "NULL" to "" ; "Null" to ""
* @param val 需转换的值
* @return 返回转换后的值
*/
public static String toStringIgnoreNull(final Object val) {
return ObjectUtils.toStringIgnoreNull(val, StringUtils.EMPTY);
}
/**
* 空对象转空字符串 "" to defaultVal ; null to defaultVal ; "null" to defaultVal ; "NULL" to defaultVal ; "Null" to defaultVal
* @param val 需转换的值
* @param defaultVal 默认值
* @return 返回转换后的值
*/
public static String toStringIgnoreNull(final Object val, String defaultVal) {
String str = ObjectUtils.toString(val);
return !"".equals(str) && !"null".equals(str.trim().toLowerCase()) ? str : defaultVal;
}
/**
* 注解到对象复制,只复制能匹配上的方法。 硕正组件用。
* @param annotation
* @param object
*/
public static void annotationToObject(Object annotation, Object object) {
if (annotation != null && object != null) {
Class<?> annotationClass = annotation.getClass();
Class<?> objectClass = object.getClass();
for (Method m : objectClass.getMethods()) {
if (StringUtils.startsWith(m.getName(), "set")) {
try {
String s = StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3));
Object obj = annotationClass.getMethod(s).invoke(annotation);
if (obj != null && !"".equals(obj.toString())) {
// if (object == null){
// object = objectClass.newInstance();
// }
m.invoke(object, obj);
}
} catch (Exception e) {
// 忽略所有设置失败方法
}
}
}
}
}
/**
* 序列化对象
* @param object
* @return
*/
public static byte[] serialize(Object object) {
ObjectOutputStream oos = null;
ByteArrayOutputStream baos = null;
try {
if (object != null) {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(object);
return baos.toByteArray();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(oos);
IOUtils.closeQuietly(baos);
}
return null;
}
/**
* 反序列化对象
* @param bytes
* @return
*/
public static Object unserialize(byte[] bytes) {
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
if (bytes != null && bytes.length > 0) {
bais = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bais);
return ois.readObject();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(ois);
IOUtils.closeQuietly(bais);
}
return null;
}
// Kryo不是线程安全的所以要建立一个线程变量每一个线程实例化一次
public static final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() {
@Override
protected Kryo initialValue() {
Kryo kryo = new Kryo();
return kryo;
};
};
/**
* Kryo序列化对象
* @param object
* @return
*/
public static byte[] serializeKryo(Object object) {
// long beginTime = System.currentTimeMillis();
byte[] bytes = null;
Output output = null;
try {
if (object != null) {
output = new Output(1024, -1);
kryos.get().writeClassAndObject(output, object);
bytes = output.toBytes();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (output != null) {
output.close();
}
}
// GlobalConfig.log(ObjectUtils.class, object + " 序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return bytes;
}
/**
* Kryo反序列化对象
* @param bytes
* @return
*/
public static Object unserializeKryo(byte[] bytes) {
// long beginTime = System.currentTimeMillis();
Object object = null;
Input input = null;
try {
if (bytes != null && bytes.length > 0) {
input = new Input(bytes, 0, bytes.length);
object = kryos.get().readClassAndObject(input);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (input != null) {
input.close();
}
}
// GlobalConfig.log(ObjectUtils.class, object + " 反序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return object;
}
/**
* 克隆一个对象
* @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;
}
}
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package com.jeesite.common.lang;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.jeesite.common.io.IOUtils;
/**
* 对象操作工具类, 继承org.apache.commons.lang3.ObjectUtils类
* @author ThinkGem
* @version 2014-6-29
*/
public class ObjectUtils extends org.apache.commons.lang3.ObjectUtils {
/**
* 转换为Double类型
*/
public static Double toDouble(final Object val) {
if (val == null) {
return 0D;
}
try {
return NumberUtils.toDouble(StringUtils.trim(val.toString()));
} catch (Exception e) {
return 0D;
}
}
/**
* 转换为Float类型
*/
public static Float toFloat(final Object val) {
return toDouble(val).floatValue();
}
/**
* 转换为Long类型
*/
public static Long toLong(final Object val) {
return toDouble(val).longValue();
}
/**
* 转换为Integer类型
*/
public static Integer toInteger(final Object val) {
return toLong(val).intValue();
}
/**
* 转换为Boolean类型 'true', 'on', 'y', 't', 'yes' or '1' (case insensitive) will return true. Otherwise, false is returned.
*/
public static Boolean toBoolean(final Object val) {
if (val == null) {
return false;
}
return BooleanUtils.toBoolean(val.toString()) || "1".equals(val.toString());
}
/**
* 转换为字符串
* @param obj
* @return
*/
public static String toString(final Object obj) {
return toString(obj, StringUtils.EMPTY);
}
/**
* 如果对象为空则使用defaultVal值
* @param obj
* @param defaultVal
* @return
*/
public static String toString(final Object obj, final String defaultVal) {
return obj == null ? defaultVal : obj.toString();
}
/**
* 空转空字符串("" to "" ; null to "" ; "null" to "" ; "NULL" to "" ; "Null" to ""
* @param val 需转换的值
* @return 返回转换后的值
*/
public static String toStringIgnoreNull(final Object val) {
return ObjectUtils.toStringIgnoreNull(val, StringUtils.EMPTY);
}
/**
* 空对象转空字符串 "" to defaultVal ; null to defaultVal ; "null" to defaultVal ; "NULL" to defaultVal ; "Null" to defaultVal
* @param val 需转换的值
* @param defaultVal 默认值
* @return 返回转换后的值
*/
public static String toStringIgnoreNull(final Object val, String defaultVal) {
String str = ObjectUtils.toString(val);
return !"".equals(str) && !"null".equals(str.trim().toLowerCase()) ? str : defaultVal;
}
/**
* 注解到对象复制,只复制能匹配上的方法。 硕正组件用。
* @param annotation
* @param object
*/
public static void annotationToObject(Object annotation, Object object) {
if (annotation != null && object != null) {
Class<?> annotationClass = annotation.getClass();
Class<?> objectClass = object.getClass();
for (Method m : objectClass.getMethods()) {
if (StringUtils.startsWith(m.getName(), "set")) {
try {
String s = StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3));
Object obj = annotationClass.getMethod(s).invoke(annotation);
if (obj != null && !"".equals(obj.toString())) {
// if (object == null){
// object = objectClass.newInstance();
// }
m.invoke(object, obj);
}
} catch (Exception e) {
// 忽略所有设置失败方法
}
}
}
}
}
/**
* 序列化对象
* @param object
* @return
*/
public static byte[] serialize(Object object) {
ObjectOutputStream oos = null;
ByteArrayOutputStream baos = null;
try {
if (object != null) {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(object);
return baos.toByteArray();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(oos);
IOUtils.closeQuietly(baos);
}
return null;
}
/**
* 反序列化对象
* @param bytes
* @return
*/
public static Object unserialize(byte[] bytes) {
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
if (bytes != null && bytes.length > 0) {
bais = new ByteArrayInputStream(bytes);
ois = new ObjectInputStream(bais);
return ois.readObject();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(ois);
IOUtils.closeQuietly(bais);
}
return null;
}
// Kryo不是线程安全的所以要建立一个线程变量每一个线程实例化一次
public static final ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() {
@Override
protected Kryo initialValue() {
Kryo kryo = new Kryo();
return kryo;
};
};
/**
* Kryo序列化对象
* @param object
* @return
*/
public static byte[] serializeKryo(Object object) {
// long beginTime = System.currentTimeMillis();
byte[] bytes = null;
Output output = null;
try {
if (object != null) {
output = new Output(1024, -1);
kryos.get().writeClassAndObject(output, object);
bytes = output.toBytes();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (output != null) {
output.close();
}
}
// GlobalConfig.log(ObjectUtils.class, object + " 序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return bytes;
}
/**
* Kryo反序列化对象
* @param bytes
* @return
*/
public static Object unserializeKryo(byte[] bytes) {
// long beginTime = System.currentTimeMillis();
Object object = null;
Input input = null;
try {
if (bytes != null && bytes.length > 0) {
input = new Input(bytes, 0, bytes.length);
object = kryos.get().readClassAndObject(input);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (input != null) {
input.close();
}
}
// GlobalConfig.log(ObjectUtils.class, object + " 反序列化用时:" + DateUtils.formatDateTime(System.currentTimeMillis() - beginTime));
return object;
}
/**
* 克隆一个对象(完全拷贝)
* @param source
*/
public static Object cloneBean(Object source){
if (source == null){
return null;
}
byte[] bytes = ObjectUtils.serializeKryo(source);
Object target = ObjectUtils.unserializeKryo(bytes);
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>
<zoom>1.0</zoom>
<x>109</x>
<y>1843</y>
<y>1903</y>
<default_color>
<r>128</r>
<g>128</g>
@@ -2776,8 +2776,8 @@
<type>longtext</type>
</word>
<word>
<id>f03c7f6fd8e06c46193fbbb4f0bd913293f055dc</id>
<length>255</length>
<id>f638d63bc277ad1057f0b0bfad3358ca3ba54294</id>
<length>500</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
@@ -13910,7 +13910,7 @@
</sequence>
</normal_column>
<normal_column>
<word_id>f03c7f6fd8e06c46193fbbb4f0bd913293f055dc</word_id>
<word_id>f638d63bc277ad1057f0b0bfad3358ca3ba54294</word_id>
<id>34aa444468170790d3bd52b0d8a5885776813978</id>
<description></description>
<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_name nvarchar2(100) NOT NULL,
create_date timestamp NOT NULL,
request_uri nvarchar2(255),
request_uri nvarchar2(500),
request_method varchar2(10),
request_params 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="log_type", attrName="logType", label="日志类型"),
@Column(name="log_title", attrName="logTitle", label="日志标题", queryType=QueryType.LIKE),
@Column(name="create_by", attrName="createBy.userCode", label="创建者", isUpdate=false),
@Column(name="create_by_name", attrName="createBy.userName", label="创建者名称", queryType=QueryType.LIKE),
@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
@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="request_uri", attrName="requestUri", label="请求URI", queryType=QueryType.LIKE),
@Column(name="request_method", attrName="requestMethod", label="操作方式"),
@@ -101,7 +101,7 @@ public class Log extends DataEntity<Log> {
this.logTitle = logTitle;
}
@Length(min=0, max=255, message="请求URI长度不能超过 255 个字符")
@Length(min=0, max=500, message="请求URI长度不能超过 500 个字符")
public String getRequestUri() {
LoginInfo p = UserUtils.getLoginInfo();
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.modules.sys.dao.LogDao;
import com.jeesite.modules.sys.entity.Log;
import com.jeesite.modules.sys.entity.User;
/**
* 日志Service
@@ -41,7 +40,7 @@ public class LogService extends CrudService<LogDao, Log> {
// 普通用户看自己的,管理员看全部的。
if (!log.getCurrentUser().isAdmin()){
log.setCreateBy(new User(log.getCurrentUser().getUserCode()));
log.setCreateBy(log.getCurrentUser().getUserCode());
}
return super.findPage(page, log);

View File

@@ -70,9 +70,9 @@ public class LogUtils {
log.setLogType(logType);
if (StringUtils.isBlank(log.getLogType())){
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);
}else if (StringUtils.inString(","+sqlCommandTypes+",", ",SELECT,")){
}else if (StringUtils.contains(","+sqlCommandTypes+",", ",SELECT,")){
log.setLogType(Log.TYPE_SELECT);
}else{
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 Object handler;
private String contextPath;
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());
this.log = log;
this.handler = handler;
this.contextPath = contextPath;
this.throwable = throwable;
}
@@ -148,6 +150,7 @@ public class LogUtils {
String attrName = MapperHelper.getAttrName(c);
if (attrName != null){
log.setBizKey(log.getRequestParam(attrName));
log.setBizType(type.getSimpleName());
}
} catch (Exception e) {
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())){
log.setLogTitle("未知操作");

View File

@@ -367,7 +367,6 @@ web:
${adminPath}/login,
${adminPath}/desktop,
${adminPath}/sys/online/count,
${adminPath}/**/listData,
${adminPath}/**/treeData,
${adminPath}/file/**,
${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="box box-main">
<div class="box-header with-border">
<div class="box-title">
<i class="fa fa-list-alt"></i> ${log.isNewRecord ? '新增操作日志表' : '编辑操作日志表'}
<i class="fa fa-bug"></i> 日志详情
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<#form:form id="inputForm" model="${log}" action="${ctx}/sys/log/save" method="post" class="form-horizontal">
<div class="box-body">
<div class="form-unit">基本信息</div>
<div class="box-body"><br/>
<#form:hidden path="id"/>
<div class="row">
<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>
<span class="required hide">*</span> 日志标题:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="logTitle" maxlength="500" class="form-control required "/>
</div>
@@ -26,18 +25,44 @@
<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>
<span class="required hide">*</span> 日志类型:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:select path="logType" dictType="sys_log_type" class="form-control required " />
</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="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>
<span class="required hide">*</span> 操作用户:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="createByName" maxlength="100" class="form-control required "/>
</div>
@@ -46,33 +71,26 @@
<div class="col-xs-6">
<div class="form-group">
<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">
<#form:input path="requestUri" maxlength="255" class="form-control "/>
<#form:input path="createBy" maxlength="100" class="form-control required "/>
</div>
</div>
</div>
</div>
<% if(@Global.YES.equals(log.isException)){ %>
<div class="row">
<div class="col-xs-6">
<div class="col-xs-12">
<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="requestMethod" maxlength="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 "/>
<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:textarea path="exceptionInfo" rows="10" class="form-control "/>
</div>
</div>
</div>
</div>
<% } %>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
@@ -97,63 +115,43 @@
<div class="col-xs-6">
<div class="form-group">
<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">
<#form:input path="remoteAddr" maxlength="255" 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 ">*</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 class="row">
<div class="col-xs-6">
<div class="col-xs-12">
<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: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="">
<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">
<div class="col-sm-10">
<#form:input path="userAgent" maxlength="500" 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">
<#form:input path="deviceName" maxlength="100" 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="">
@@ -168,9 +166,6 @@
<div class="box-footer">
<div class="row">
<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>
</div>
</div>

View File

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

View File

@@ -3,7 +3,7 @@
<div class="box box-main">
<div class="box-header with-border">
<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 class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>