From 33f43369f260df78743ae36775b959d17ea2d9ad Mon Sep 17 00:00:00 2001 From: taojinlong Date: Fri, 27 May 2022 22:02:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A9=B1=E5=8A=A8=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/auth/aop/DeLogAnnotationHandler.java | 1 - .../java/io/dataease/commons/utils/DeLogUtils.java | 10 ++++++++-- .../controller/datasource/DriverMgmController.java | 14 -------------- .../main/java/io/dataease/ext/ExtSysLogMapper.xml | 4 ++-- .../dataease/service/datasource/DriverService.java | 8 +++++++- 5 files changed, 17 insertions(+), 20 deletions(-) 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; }