chore: 部分service中直接使用session utils get user 的移动到controller中

This commit is contained in:
CaptainB 2023-10-09 15:16:16 +08:00 committed by 刘瑞斌
parent 1ec2837b19
commit 6831220033
4 changed files with 11 additions and 11 deletions

View File

@ -54,7 +54,7 @@ public class FileModuleController {
@RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ_DELETE)
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#deleteId)", msClass = FileModuleLogService.class)
public void deleteNode(@PathVariable String deleteId) {
fileModuleService.deleteModule(deleteId);
fileModuleService.deleteModule(deleteId, SessionUtils.getUserId());
}
@PostMapping("/move")
@ -66,6 +66,6 @@ public class FileModuleController {
* 1.判断移动后的parentID判断是否是移动到其余的目录下
* 2.拖拽后的前后ID 用于排序
*/
fileModuleService.moveNode(request);
fileModuleService.moveNode(request, SessionUtils.getUserId());
}
}

View File

@ -267,7 +267,7 @@ public class ProjectApplicationController {
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_ISSUE_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateIssueSyncLog(#projectId, #configs)", msClass = ProjectApplicationService.class)
public void syncIssueConfig(@PathVariable("projectId") String projectId, @RequestBody Map<String, String> configs) {
projectApplicationService.syncIssueConfig(projectId, configs);
projectApplicationService.syncIssueConfig(projectId, configs, SessionUtils.getUserId());
}

View File

@ -147,12 +147,12 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
}
public void deleteModule(String deleteId) {
public void deleteModule(String deleteId, String currentUser) {
FileModule deleteModule = fileModuleMapper.selectByPrimaryKey(deleteId);
if (deleteModule != null) {
this.deleteModule(Collections.singletonList(deleteId));
//记录日志
fileModuleLogService.saveDeleteLog(deleteModule, SessionUtils.getUserId());
fileModuleLogService.saveDeleteLog(deleteModule, currentUser);
}
}
public void deleteModule(List<String> deleteIds) {
@ -168,7 +168,7 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
}
}
public void moveNode(NodeMoveRequest request) {
public void moveNode(NodeMoveRequest request, String currentUser) {
FileModuleExample example = new FileModuleExample();
example.createCriteria().andParentIdEqualTo(request.getParentId()).andIdEqualTo(request.getNodeId());
if (fileModuleMapper.countByExample(example) == 0) {
@ -181,7 +181,7 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
this.sort(request);
//记录日志
fileModuleLogService.saveMoveLog(request, SessionUtils.getUserId());
fileModuleLogService.saveMoveLog(request, currentUser);
}
@Override

View File

@ -210,10 +210,10 @@ public class ProjectApplicationService {
* @param projectId
* @param configs
*/
public void syncIssueConfig(String projectId, Map<String, String> configs) {
public void syncIssueConfig(String projectId, Map<String, String> configs, String currentUser) {
List<ProjectApplication> issueSyncConfigs = configs.entrySet().stream().map(config -> new ProjectApplication(projectId, ProjectApplicationType.ISSUE.ISSUE_SYNC.name() + "_" + config.getKey().toUpperCase(), config.getValue())).collect(Collectors.toList());
//处理同步缺陷定时任务配置
doSaveOrUpdateSchedule(issueSyncConfigs, projectId);
doSaveOrUpdateSchedule(issueSyncConfigs, projectId, currentUser);
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.ISSUE.ISSUE_SYNC.name() + "%");
if (projectApplicationMapper.countByExample(example) > 0) {
@ -226,7 +226,7 @@ public class ProjectApplicationService {
}
}
private void doSaveOrUpdateSchedule(List<ProjectApplication> issueSyncConfigs, String projectId) {
private void doSaveOrUpdateSchedule(List<ProjectApplication> issueSyncConfigs, String projectId, String currentUser) {
List<ProjectApplication> syncCron = issueSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.ISSUE.ISSUE_SYNC.name() + "_" + ProjectApplicationType.ISSUE_SYNC_CONFIG.CRON_EXPRESSION.name())).collect(Collectors.toList());
List<ProjectApplication> syncEnable = issueSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.ISSUE.ISSUE_SYNC.name() + "_" + ProjectApplicationType.ISSUE_SYNC_CONFIG.ENABLE.name())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(syncCron)) {
@ -249,7 +249,7 @@ public class ProjectApplicationService {
request.setKey(projectId);
request.setProjectId(projectId);
request.setEnable(enable);
request.setCreateUser(SessionUtils.getUserId());
request.setCreateUser(currentUser);
request.setType(ScheduleType.CRON.name());
// 每天凌晨2点执行清理任务
request.setValue(typeValue);