Commit 7ccacefd authored by 赵啸非's avatar 赵啸非

添加设备日志类型筛选

parent e6f4fb61
...@@ -61,6 +61,17 @@ ...@@ -61,6 +61,17 @@
label: "消息标识", label: "消息标识",
fuzzy: true fuzzy: true
}, },
,
{
name: "createTimeStart",
type: "date",
label: "开始时间"
},
{
name: "createTimeEnd",
type: "date",
label: "结束时间"
},
], ],
columns: [ columns: [
...@@ -68,7 +79,7 @@ ...@@ -68,7 +79,7 @@
{label: "追踪Id", prop: "id"}, {label: "追踪Id", prop: "id"},
{label: "应用名称", prop: "appName",formatter:this.formatter}, {label: "日志来源", prop: "appName",formatter:this.formatter},
// {label: "主机名", prop: "hostName"}, // {label: "主机名", prop: "hostName"},
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
{label: "操作内容", prop: "content",tooltip:"true"}, {label: "操作内容", prop: "content",tooltip:"true"},
{label: "操作IP地址", prop: "ip"}, {label: "操作IP地址", prop: "ip"},
{label: "操作", prop: "operType",formatter: this.formatter},
{label: "操作时间", prop: "logDate", formatter: this.formatterDate}, {label: "操作时间", prop: "logDate", formatter: this.formatterDate},
{ {
......
package com.mortals.xhx.base.framework.aspect; package com.mortals.xhx.base.framework.aspect;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.model.OperateLogPdu; import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.ILogService; import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.IMessageProduceService; import com.mortals.framework.service.IMessageProduceService;
import com.mortals.framework.service.impl.FileLogServiceImpl; import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.oper.model.OperLogEntity; import com.mortals.xhx.base.system.oper.model.OperLogEntity;
import com.mortals.xhx.base.system.oper.service.OperLogService; import com.mortals.xhx.base.system.oper.service.OperLogService;
import com.mortals.xhx.common.code.OperTypeEnum;
import com.mortals.xhx.module.operate.model.OperateLogEntity; import com.mortals.xhx.module.operate.model.OperateLogEntity;
import com.mortals.xhx.module.operate.service.OperateLogService; import com.mortals.xhx.module.operate.service.OperateLogService;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
...@@ -45,20 +47,16 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -45,20 +47,16 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl, public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
String content, String ip, Date logDate) { String content, String ip, Date logDate) {
super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate); super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate);
int operType = OperTypeEnum.OTHER.getValue();
//判断内容包含
if (StrUtil.contains(content, "查询")||StrUtil.contains(content,"查看")) {
operType = OperTypeEnum.SEARCH.getValue();
} else if (StrUtil.contains(content, "保存") || StrUtil.contains(content, "新增") || StrUtil.contains(content, "修改")) {
operType = OperTypeEnum.SAVE.getValue();
} else if (StrUtil.contains(content, "删除")) {
operType = OperTypeEnum.DELETE.getValue();
}
operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content); operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content);
//直接调用本地保存一份
// OperateLogPdu operateLogPdu = new OperateLogPdu();
// operateLogPdu.initAttrValue();
// operateLogPdu.setIp(ip);
// operateLogPdu.setRequestUrl(requestUrl);
// operateLogPdu.setUserId(userId);
// operateLogPdu.setUserName(userName);
// operateLogPdu.setLoginName(loginName);
// operateLogPdu.setPlatformMark(platformMark);
// operateLogPdu.setLogDate(logDate);
// operateLogPdu.setContent(content);
// operateLogPdu.setOperType(1);
// messageProducer.syncOperSend(operateLogPdu);
OperateLogEntity operLogEntity = new OperateLogEntity(); OperateLogEntity operLogEntity = new OperateLogEntity();
operLogEntity.initAttrValue(); operLogEntity.initAttrValue();
...@@ -70,7 +68,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -70,7 +68,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
operLogEntity.setPlatformMark(platformMark); operLogEntity.setPlatformMark(platformMark);
operLogEntity.setLogDate(logDate); operLogEntity.setLogDate(logDate);
operLogEntity.setContent(content); operLogEntity.setContent(content);
operLogEntity.setOperType(1); operLogEntity.setOperType(operType);
operateLogService.save(operLogEntity, null); operateLogService.save(operLogEntity, null);
} }
......
...@@ -3,14 +3,13 @@ package com.mortals.xhx.common.code; ...@@ -3,14 +3,13 @@ package com.mortals.xhx.common.code;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* Created by chendilin on 2018/3/7.
*/
public enum OperTypeEnum { public enum OperTypeEnum {
SAVE(0,"添加"), SAVE(0,"添加"),
UPDATE(1,"更新"), UPDATE(1,"更新"),
DELETE(2,"删除"), DELETE(2,"删除"),
SEARCH(2,"查询"),
OTHER(-1,"其它"); OTHER(-1,"其它");
private int value; private int value;
......
...@@ -7,6 +7,7 @@ import com.mortals.framework.exception.AppException; ...@@ -7,6 +7,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.OperTypeEnum;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -52,7 +53,7 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -52,7 +53,7 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "operType", paramService.getParamBySecondOrganize("OperateLog", "operType")); this.addDict(model, "operType", OperTypeEnum.getEnumMap());
this.addDict(model, "platformMark", paramService.getParamBySecondOrganize("OperateLog", "platformMark")); this.addDict(model, "platformMark", paramService.getParamBySecondOrganize("OperateLog", "platformMark"));
super.init(model, context); super.init(model, context);
...@@ -69,15 +70,6 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -69,15 +70,6 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody OperateLogEntity entity) { public String save(@RequestBody OperateLogEntity entity) {
if("sst-manager".equals(entity.getPlatformMark())){
OperateLogEntity operateLogEntity = new OperateLogEntity();
operateLogEntity.initAttrValue();
BeanUtils.copyProperties(entity,operateLogEntity);
operateLogEntity.setPlatformMark("search-gov-manager");
this.service.save(operateLogEntity);
}
return super.save(entity); return super.save(entity);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment