forked from github/dataease
fix: 驱动插件操作日志
This commit is contained in:
parent
0b04549d57
commit
33f43369f2
@ -44,7 +44,6 @@ public class DeLogAnnotationHandler {
|
|||||||
befores.add(SysLogConstants.OPERATE_TYPE.DELETE.getValue());
|
befores.add(SysLogConstants.OPERATE_TYPE.DELETE.getValue());
|
||||||
befores.add(SysLogConstants.OPERATE_TYPE.UNSHARE.getValue());
|
befores.add(SysLogConstants.OPERATE_TYPE.UNSHARE.getValue());
|
||||||
befores.add(SysLogConstants.OPERATE_TYPE.UNAUTHORIZE.getValue());
|
befores.add(SysLogConstants.OPERATE_TYPE.UNAUTHORIZE.getValue());
|
||||||
befores.add(SysLogConstants.OPERATE_TYPE.UPLOADFILE.getValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SysLogDTO exec(JoinPoint point, DeLog deLog) throws Exception{
|
private SysLogDTO exec(JoinPoint point, DeLog deLog) throws Exception{
|
||||||
|
@ -66,8 +66,14 @@ public class DeLogUtils {
|
|||||||
items.add(folderItem);
|
items.add(folderItem);
|
||||||
sysLogDTO.setPositions(items);
|
sysLogDTO.setPositions(items);
|
||||||
}else {
|
}else {
|
||||||
List<FolderItem> parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), sourcetype);
|
if(sourcetype == SOURCE_TYPE.DRIVER_FILE){
|
||||||
sysLogDTO.setPositions(parentsAndSelf);
|
List<FolderItem> parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), SOURCE_TYPE.DRIVER);
|
||||||
|
sysLogDTO.setPositions(parentsAndSelf);
|
||||||
|
}else {
|
||||||
|
List<FolderItem> parentsAndSelf = logManager.parentsAndSelf(positionId.toString(), sourcetype);
|
||||||
|
sysLogDTO.setPositions(parentsAndSelf);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,13 +92,6 @@ public class DriverMgmController {
|
|||||||
@RequiresPermissions("datasource:read")
|
@RequiresPermissions("datasource:read")
|
||||||
@ApiOperation("删除驱动文件")
|
@ApiOperation("删除驱动文件")
|
||||||
@PostMapping("/deleteDriverFile")
|
@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{
|
public void deleteDriverFile(@RequestBody DeDriverDetails deDriverDetails) throws Exception{
|
||||||
driverService.deleteDriverFile(deDriverDetails.getId());
|
driverService.deleteDriverFile(deDriverDetails.getId());
|
||||||
}
|
}
|
||||||
@ -106,13 +99,6 @@ public class DriverMgmController {
|
|||||||
@RequiresPermissions("datasource:read")
|
@RequiresPermissions("datasource:read")
|
||||||
@ApiOperation("驱动文件上传")
|
@ApiOperation("驱动文件上传")
|
||||||
@PostMapping("file/upload")
|
@PostMapping("file/upload")
|
||||||
@DeLog(
|
|
||||||
operatetype = SysLogConstants.OPERATE_TYPE.UPLOADFILE,
|
|
||||||
sourcetype = SysLogConstants.SOURCE_TYPE.DRIVER_FILE,
|
|
||||||
positionIndex = 0,
|
|
||||||
positionKey = "deDriverId",
|
|
||||||
value = "id"
|
|
||||||
)
|
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "MultipartFile"),
|
@ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "MultipartFile"),
|
||||||
@ApiImplicitParam(name = "id", value = "驱动D", required = true, dataType = "String")
|
@ApiImplicitParam(name = "id", value = "驱动D", required = true, dataType = "String")
|
||||||
|
@ -143,8 +143,8 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="type == 10">
|
<if test="type == 10">
|
||||||
id, name
|
id, file_name as name
|
||||||
from de_driver
|
from de_driver_details
|
||||||
<where>
|
<where>
|
||||||
id in
|
id in
|
||||||
<foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
|
<foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package io.dataease.service.datasource;
|
package io.dataease.service.datasource;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import io.dataease.commons.constants.SysLogConstants;
|
||||||
import io.dataease.commons.utils.BeanUtils;
|
import io.dataease.commons.utils.BeanUtils;
|
||||||
import io.dataease.commons.utils.DeFileUtils;
|
import io.dataease.commons.utils.DeFileUtils;
|
||||||
|
import io.dataease.commons.utils.DeLogUtils;
|
||||||
import io.dataease.dto.DriverDTO;
|
import io.dataease.dto.DriverDTO;
|
||||||
import io.dataease.dto.datasource.SqlServerConfiguration;
|
import io.dataease.dto.SysLogDTO;
|
||||||
import io.dataease.i18n.Translator;
|
import io.dataease.i18n.Translator;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
import io.dataease.plugins.common.base.domain.DeDriver;
|
import io.dataease.plugins.common.base.domain.DeDriver;
|
||||||
@ -97,6 +99,8 @@ public class DriverService {
|
|||||||
public void deleteDriverFile(String driverFileId) {
|
public void deleteDriverFile(String driverFileId) {
|
||||||
DeDriverDetails deDriverDetails = deDriverDetailsMapper.selectByPrimaryKey(driverFileId);
|
DeDriverDetails deDriverDetails = deDriverDetailsMapper.selectByPrimaryKey(driverFileId);
|
||||||
DeFileUtils.deleteFile(DRIVER_PATH + deDriverDetails.getDeDriverId() + "/" + deDriverDetails.getFileName());
|
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);
|
deDriverDetailsMapper.deleteByPrimaryKey(driverFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +127,8 @@ public class DriverService {
|
|||||||
deDriverDetails.setFileName(filename);
|
deDriverDetails.setFileName(filename);
|
||||||
deDriverDetails.setDriverClass(String.join(",", jdbcList));
|
deDriverDetails.setDriverClass(String.join(",", jdbcList));
|
||||||
deDriverDetailsMapper.insert(deDriverDetails);
|
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;
|
return deDriverDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user