【修改】 用户操作日志
This commit is contained in:
-26
@@ -1,7 +1,6 @@
|
||||
package com.jero.common.aspect;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.PropertyFilter;
|
||||
import com.jero.common.api.dto.LogDTO;
|
||||
import com.jero.common.api.vo.Results;
|
||||
@@ -82,31 +81,6 @@ public class AutoLogAspect {
|
||||
}
|
||||
//注解上的描述,操作日志内容
|
||||
dto.setLogType(syslog.logType());
|
||||
//用户日志 ,根据不同的操作类型 生成不同的日志内容
|
||||
if ("user".equals(content)){
|
||||
if (syslog.operateType() == 2){
|
||||
Object result = ((Results) obj).getResult();
|
||||
String s = JSONObject.toJSONString(result);
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
String id =(String)jsonObject.get("id");
|
||||
content = "新增用户,id:"+id;
|
||||
}else if (syslog.operateType() == 3){
|
||||
Object result = ((Results) obj).getResult();
|
||||
String s = JSONObject.toJSONString(result);
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
String id =(String)jsonObject.get("id");
|
||||
content = "修改,id:"+id;
|
||||
}else if (syslog.operateType() == 4){
|
||||
String message = ((Results) obj).getMessage();
|
||||
String result = (String)((Results) obj).getResult();
|
||||
if ("删除用户成功".equals(message)){
|
||||
content = "删除用户,id:"+result;
|
||||
}else {
|
||||
content = "批量删除用户,ids:"+result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
dto.setLogContent(content);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public @interface AutoLog {
|
||||
/**
|
||||
* 操作日志类型
|
||||
*
|
||||
* @return (1查询,2添加,3修改,4删除)
|
||||
* @return (1查询,2添加,3修改,4删除,5导入,6导出)
|
||||
*/
|
||||
int operateType() default 0;
|
||||
|
||||
|
||||
+4
-4
@@ -166,7 +166,7 @@ public class SysUserController {
|
||||
|
||||
@RequiresPermissions("user:add")
|
||||
@PostMapping("/add")
|
||||
@AutoLog(operateType = 2,value = "user")
|
||||
@AutoLog(operateType = 2,value = "用户新增")
|
||||
public Results<Object> add(@RequestBody JSONObject jsonObject) {
|
||||
try {
|
||||
String selectedRoles = jsonObject.getString(SELECTED_ROLES);
|
||||
@@ -221,7 +221,7 @@ public class SysUserController {
|
||||
|
||||
@RequiresPermissions("user:edit")
|
||||
@PostMapping("/edit")
|
||||
@AutoLog(operateType = 3,value = "user")
|
||||
@AutoLog(operateType = 3,value = "用户编辑")
|
||||
public Results<SysUser> edit(@RequestBody JSONObject jsonObject) {
|
||||
String rsaPublicKey = jsonObject.getString(RSA_PUBLIC_KEY);
|
||||
String roles = jsonObject.getString(SELECTED_ROLES);
|
||||
@@ -271,7 +271,7 @@ public class SysUserController {
|
||||
|
||||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys:user:sel")
|
||||
@AutoLog(operateType = 4,value = "user")
|
||||
@AutoLog(operateType = 4,value = "用户删除")
|
||||
public Results<String> delete(@RequestBody Map<String,String> map) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
String id = map.get("id");
|
||||
@@ -285,7 +285,7 @@ public class SysUserController {
|
||||
|
||||
@PostMapping("/deleteBatch")
|
||||
@RequiresPermissions("sys:user:sel")
|
||||
@AutoLog(operateType = 4,value = "user")
|
||||
@AutoLog(operateType = 4,value = "用户批量删除")
|
||||
public Results<String> deleteBatch(@RequestBody Map<String, String> map) {
|
||||
String ids = map.get("ids");
|
||||
if(StringUtils.isBlank(ids)){
|
||||
|
||||
Reference in New Issue
Block a user