feat: 日志模块

This commit is contained in:
fit2cloud-chenyw 2023-12-22 15:39:01 +08:00
parent af6eaa196b
commit c19b17921e
8 changed files with 135 additions and 0 deletions

View File

@ -7,7 +7,10 @@ import io.dataease.api.dataset.dto.SqlVariableDetails;
import io.dataease.api.dataset.union.DatasetGroupInfoDTO;
import io.dataease.api.dataset.vo.DataSetBarVO;
import io.dataease.commons.constants.OptConstants;
import io.dataease.constant.LogOT;
import io.dataease.constant.LogST;
import io.dataease.dataset.manage.DatasetGroupManage;
import io.dataease.log.DeLog;
import io.dataease.model.BusiNodeRequest;
import io.dataease.model.BusiNodeVO;
import jakarta.annotation.Resource;
@ -23,16 +26,19 @@ public class DatasetTreeServer implements DatasetTreeApi {
private DatasetGroupManage datasetGroupManage;
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASET)
@Override
public DatasetGroupInfoDTO save(DatasetGroupInfoDTO datasetNodeDTO) throws Exception {
return datasetGroupManage.save(datasetNodeDTO, false);
}
@DeLog(id = "#p0.id", ot = LogOT.MODIFY, st = LogST.DATASET)
@Override
public DatasetNodeDTO rename(DatasetGroupInfoDTO dto) throws Exception {
return datasetGroupManage.save(dto, true);
}
@DeLog(id = "#p0.id", pid = "#p0.pid", ot = LogOT.CREATE, st = LogST.DATASET)
@Override
public DatasetNodeDTO create(DatasetGroupInfoDTO dto) throws Exception {
return datasetGroupManage.save(dto, false);

View File

@ -7,6 +7,7 @@ import io.dataease.api.permissions.auth.dto.BusiPerCheckDTO;
import io.dataease.api.permissions.auth.dto.BusiResourceCreator;
import io.dataease.api.permissions.auth.dto.BusiResourceEditor;
import io.dataease.api.permissions.auth.dto.BusiResourceMover;
import io.dataease.api.permissions.auth.vo.ResourceNodeVO;
import io.dataease.model.BusiNodeRequest;
import io.dataease.model.BusiNodeVO;
import io.swagger.v3.oas.annotations.Hidden;
@ -71,4 +72,7 @@ public interface InteractiveAuthApi {
@PostMapping("/checkAuth")
void checkAuth(@RequestBody BusiPerCheckDTO checkDTO);
@GetMapping("/query2Root/{id}/{flag}")
List<ResourceNodeVO> query2Root(@PathVariable("id") Long id, @PathVariable("flag") Integer flag);
}

View File

@ -0,0 +1,13 @@
package io.dataease.api.permissions.auth.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class ResourceNodeVO implements Serializable {
private Long id;
private String name;
}

View File

@ -0,0 +1,33 @@
package io.dataease.constant;
public enum LogOT {
CREATE(1, "OPERATE_TYPE_CREATE"),
MODIFY(2, "OPERATE_TYPE_MODIFY"),
DELETE(3, "OPERATE_TYPE_DELETE"),
READ(4, "OPERATE_TYPE_READ"),
EXPORT(5, "OPERATE_TYPE_EXPORT"),
AUTHORIZE(6, "OPERATE_TYPE_AUTHORIZE"),
UNAUTHORIZE(7, "OPERATE_TYPE_UNAUTHORIZE"),
CREATELINK(8, "OPERATE_TYPE_CREATELINK"),
DELETELINK(9, "OPERATE_TYPE_DELETELINK"),
MODIFYLINK(10, "OPERATE_TYPE_MODIFYLINK"),
UPLOADFILE(11, "OPERATE_TYPE_UPLOADFILE"),
BIND(12, "OPERATE_TYPE_BIND"),
UNBIND(13, "OPERATE_TYPE_UNBIND"),
LOGIN(14, "OPERATE_TYPE_LOGIN");
private Integer value;
private String name;
LogOT(Integer value, String name) {
this.value = value;
this.name = name;
}
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,36 @@
package io.dataease.constant;
public enum LogST {
PANEL(1, "SOURCE_TYPE_PANEL"),
SCREEN(2, "SOURCE_TYPE_SCREEN"),
DATASET(3, "SOURCE_TYPE_DATASET"),
DATASOURCE(4, "SOURCE_TYPE_DATASOURCE"),
USER(5, "SOURCE_TYPE_USER"),
ROLE(6, "SOURCE_TYPE_ROLE"),
ORG(7, "SOURCE_TYPE_DEPT"),
VIEW(8, "SOURCE_TYPE_VIEW"),
LINK(9, "SOURCE_TYPE_LINK"),
DRIVER(10, "SOURCE_TYPE_DRIVER"),
DRIVER_FILE(11, "SOURCE_TYPE_DRIVER_FILE"),
MENU(12, "SOURCE_TYPE_MENU"),
APIKEY(13, "SOURCE_TYPE_APIKEY");
private Integer value;
private String name;
public Integer getValue() {
return value;
}
public String getName() {
return name;
}
LogST(Integer value, String name) {
this.value = value;
this.name = name;
}
LogST() {
}
}

View File

@ -0,0 +1,19 @@
package io.dataease.log;
import io.dataease.constant.LogOT;
import io.dataease.constant.LogST;
import java.lang.annotation.*;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DeLog {
String id() default "";
String pid() default "";
LogST st();
LogOT ot();
}

View File

@ -0,0 +1,16 @@
package io.dataease.model;
import io.dataease.constant.LogST;
import lombok.Data;
import java.io.Serializable;
@Data
public class LogItemModel implements Serializable {
private Long id;
private String name;
private LogST st;
}

View File

@ -35,4 +35,12 @@ public class CommonBeanFactory implements ApplicationContextAware {
public static ApplicationContext getApplicationContext() {
return context;
}
public static <T> T proxy(Class<T> className) {
try {
return context != null && className != null ? context.getBean(className) : null;
} catch (BeansException e) {
return null;
}
}
}