diff --git a/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java b/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java index 37c4840082..d8d613153b 100644 --- a/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java +++ b/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java @@ -44,7 +44,6 @@ public class DeLogAnnotationHandler { befores.add(SysLogConstants.OPERATE_TYPE.DELETE.getValue()); befores.add(SysLogConstants.OPERATE_TYPE.UNSHARE.getValue()); befores.add(SysLogConstants.OPERATE_TYPE.UNAUTHORIZE.getValue()); - befores.add(SysLogConstants.OPERATE_TYPE.UPLOADFILE.getValue()); } private SysLogDTO exec(JoinPoint point, DeLog deLog) throws Exception{ diff --git a/backend/src/main/java/io/dataease/commons/utils/DeLogUtils.java b/backend/src/main/java/io/dataease/commons/utils/DeLogUtils.java index 7aa24b6f5f..21f055f81c 100644 --- a/backend/src/main/java/io/dataease/commons/utils/DeLogUtils.java +++ b/backend/src/main/java/io/dataease/commons/utils/DeLogUtils.java @@ -66,8 +66,14 @@ public class DeLogUtils { items.add(folderItem); sysLogDTO.setPositions(items); }else { - List parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), sourcetype); - sysLogDTO.setPositions(parentsAndSelf); + if(sourcetype == SOURCE_TYPE.DRIVER_FILE){ + List parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), SOURCE_TYPE.DRIVER); + sysLogDTO.setPositions(parentsAndSelf); + }else { + List parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), sourcetype); + sysLogDTO.setPositions(parentsAndSelf); + } + } } diff --git a/backend/src/main/java/io/dataease/controller/datasource/DriverMgmController.java b/backend/src/main/java/io/dataease/controller/datasource/DriverMgmController.java index 811dad6223..784091daf9 100644 --- a/backend/src/main/java/io/dataease/controller/datasource/DriverMgmController.java +++ b/backend/src/main/java/io/dataease/controller/datasource/DriverMgmController.java @@ -92,13 +92,6 @@ public class DriverMgmController { @RequiresPermissions("datasource:read") @ApiOperation("删除驱动文件") @PostMapping("/deleteDriverFile") - @DeLog( - operatetype = SysLogConstants.OPERATE_TYPE.DELETE, - sourcetype = SysLogConstants.SOURCE_TYPE.DRIVER_FILE, - positionIndex = 0, - positionKey = "deDriverId", - value = "id" - ) public void deleteDriverFile(@RequestBody DeDriverDetails deDriverDetails) throws Exception{ driverService.deleteDriverFile(deDriverDetails.getId()); } @@ -106,13 +99,6 @@ public class DriverMgmController { @RequiresPermissions("datasource:read") @ApiOperation("驱动文件上传") @PostMapping("file/upload") - @DeLog( - operatetype = SysLogConstants.OPERATE_TYPE.UPLOADFILE, - sourcetype = SysLogConstants.SOURCE_TYPE.DRIVER_FILE, - positionIndex = 0, - positionKey = "deDriverId", - value = "id" - ) @ApiImplicitParams({ @ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "MultipartFile"), @ApiImplicitParam(name = "id", value = "驱动D", required = true, dataType = "String") diff --git a/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml index e4ea15c486..e5daf3ed46 100644 --- a/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml +++ b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml @@ -143,8 +143,8 @@ - id, name - from de_driver + id, file_name as name + from de_driver_details id in diff --git a/backend/src/main/java/io/dataease/service/datasource/DriverService.java b/backend/src/main/java/io/dataease/service/datasource/DriverService.java index 2dc42bfd5b..663d49c997 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DriverService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DriverService.java @@ -1,10 +1,12 @@ package io.dataease.service.datasource; import com.google.gson.Gson; +import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.BeanUtils; import io.dataease.commons.utils.DeFileUtils; +import io.dataease.commons.utils.DeLogUtils; import io.dataease.dto.DriverDTO; -import io.dataease.dto.datasource.SqlServerConfiguration; +import io.dataease.dto.SysLogDTO; import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.Datasource; import io.dataease.plugins.common.base.domain.DeDriver; @@ -97,6 +99,8 @@ public class DriverService { public void deleteDriverFile(String driverFileId) { DeDriverDetails deDriverDetails = deDriverDetailsMapper.selectByPrimaryKey(driverFileId); DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getFileName()); + SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), deDriverDetails.getDeDriverId(), null, null); + DeLogUtils.save(sysLogDTO); deDriverDetailsMapper.deleteByPrimaryKey(driverFileId); } @@ -123,6 +127,8 @@ public class DriverService { deDriverDetails.setFileName(filename); deDriverDetails.setDriverClass(String.join(",", jdbcList)); deDriverDetailsMapper.insert(deDriverDetails); + SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.UPLOADFILE, SysLogConstants.SOURCE_TYPE.DRIVER_FILE, deDriverDetails.getId(), driverId, null, null); + DeLogUtils.save(sysLogDTO); return deDriverDetails; }