chore: 处理SessionUtils后台调用的问题
This commit is contained in:
parent
bf37790b12
commit
03a03e80ff
|
@ -9,7 +9,7 @@ import io.metersphere.project.service.EnvironmentService;
|
|||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.domain.Environment;
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.project.service.GlobalParamsLogService;
|
|||
import io.metersphere.project.service.GlobalParamsService;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.project.dto.MessageTaskDTO;
|
|||
import io.metersphere.project.service.NoticeMessageTaskService;
|
||||
import io.metersphere.system.controller.handler.ResultHolder;
|
||||
import io.metersphere.sdk.dto.request.MessageTaskRequest;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.sdk.constants.ProjectApplicationType;
|
||||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.dto.SessionUser;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
|
@ -43,7 +43,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_TEST_PLAN_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateTestPlanLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateTestPlan(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/test-plan")
|
||||
|
@ -64,7 +64,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_UI_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateUiLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateUI(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/ui")
|
||||
|
@ -92,7 +92,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_PERFORMANCE_TEST_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updatePerformanceLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updatePerformanceTest(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/performance-test")
|
||||
|
@ -120,7 +120,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_API_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateApiLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateApi(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/api")
|
||||
|
@ -156,7 +156,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_CASE_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateCaseLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateCase(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_WORKSTATION_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateWorkstationLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateWorkstation(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/workstation")
|
||||
|
@ -215,7 +215,7 @@ public class ProjectApplicationController {
|
|||
@RequiresPermissions(PermissionConstants.PROJECT_APPLICATION_ISSUE_UPDATE)
|
||||
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateWorkstationLog(#applications)", msClass = ProjectApplicationService.class)
|
||||
public void updateIssue(@Validated({Updated.class}) @RequestBody List<ProjectApplication> applications) {
|
||||
projectApplicationService.update(applications);
|
||||
projectApplicationService.update(applications, SessionUtils.getUserId());
|
||||
}
|
||||
|
||||
@PostMapping("/issue")
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.sdk.dto.ProjectExtendDTO;
|
||||
import io.metersphere.sdk.dto.UpdateProjectRequest;
|
||||
import io.metersphere.sdk.dto.UserDTO;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.validation.groups.Updated;
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.system.log.vo.OperationLogRequest;
|
|||
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
|
|
@ -12,7 +12,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.sdk.dto.UserExtend;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
|
|
|
@ -10,7 +10,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
import io.metersphere.validation.groups.Updated;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
|
|
@ -18,7 +18,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.domain.UserRole;
|
||||
import io.metersphere.system.service.UserRoleService;
|
||||
|
|
|
@ -13,14 +13,14 @@ import io.metersphere.sdk.dto.LogDTO;
|
|||
import io.metersphere.sdk.dto.OptionDTO;
|
||||
import io.metersphere.sdk.dto.SessionUser;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.*;
|
||||
import io.metersphere.system.log.constants.OperationLogModule;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.ExtPluginMapper;
|
||||
import io.metersphere.system.mapper.PluginMapper;
|
||||
import io.metersphere.system.mapper.ServiceIntegrationMapper;
|
||||
import io.metersphere.system.sechedule.BaseScheduleService;
|
||||
import io.metersphere.system.sechedule.ScheduleService;
|
||||
import io.metersphere.system.service.PluginLoadService;
|
||||
import io.metersphere.system.utils.ServiceUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
|
@ -43,7 +43,7 @@ public class ProjectApplicationService {
|
|||
private ProjectApplicationMapper projectApplicationMapper;
|
||||
|
||||
@Resource
|
||||
private BaseScheduleService baseScheduleService;
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
@Resource
|
||||
private ExtProjectUserRoleMapper extProjectUserRoleMapper;
|
||||
|
@ -68,10 +68,10 @@ public class ProjectApplicationService {
|
|||
* @param applications
|
||||
* @return
|
||||
*/
|
||||
public void update(List<ProjectApplication> applications) {
|
||||
public void update(List<ProjectApplication> applications, String currentUser) {
|
||||
applications.forEach(application -> {
|
||||
//定时任务配置,检查是否存在定时任务配置,存在则更新,不存在则新增
|
||||
this.doBeforeUpdate(application);
|
||||
this.doBeforeUpdate(application, currentUser);
|
||||
//配置信息入库
|
||||
this.createOrUpdateConfig(application);
|
||||
});
|
||||
|
@ -91,7 +91,7 @@ public class ProjectApplicationService {
|
|||
}
|
||||
}
|
||||
|
||||
private void doBeforeUpdate(ProjectApplication application) {
|
||||
private void doBeforeUpdate(ProjectApplication application, String currentUser) {
|
||||
String type = application.getType();
|
||||
//TODO 自定义id配置 &其他配置
|
||||
if (StringUtils.equals(type, ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name())
|
||||
|
@ -99,20 +99,21 @@ public class ProjectApplicationService {
|
|||
|| StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_TEST.PERFORMANCE_TEST_CLEAN_REPORT.name())
|
||||
|| StringUtils.equals(type, ProjectApplicationType.API.API_CLEAN_REPORT.name())) {
|
||||
//清除 测试计划/UI测试/性能测试/接口测试 报告 定时任务
|
||||
this.doHandleSchedule(application);
|
||||
this.doHandleSchedule(application, currentUser);
|
||||
}
|
||||
}
|
||||
|
||||
private void doHandleSchedule(ProjectApplication application) {
|
||||
private void doHandleSchedule(ProjectApplication application, String currentUser) {
|
||||
String typeValue = application.getTypeValue();
|
||||
String projectId = application.getProjectId();
|
||||
Boolean enable = BooleanUtils.isTrue(Boolean.valueOf(typeValue));
|
||||
Schedule schedule = baseScheduleService.getScheduleByResource(application.getProjectId(), CleanUpReportJob.class.getName());
|
||||
Schedule schedule = scheduleService.getScheduleByResource(application.getProjectId(), CleanUpReportJob.class.getName());
|
||||
Optional<Schedule> optional = Optional.ofNullable(schedule);
|
||||
optional.ifPresentOrElse(s -> {
|
||||
s.setEnable(enable);
|
||||
baseScheduleService.editSchedule(s);
|
||||
baseScheduleService.addOrUpdateCronJob(s,
|
||||
s.setCreateUser(currentUser);
|
||||
scheduleService.editSchedule(s);
|
||||
scheduleService.addOrUpdateCronJob(s,
|
||||
CleanUpReportJob.getJobKey(projectId),
|
||||
CleanUpReportJob.getTriggerKey(projectId),
|
||||
CleanUpReportJob.class);
|
||||
|
@ -123,13 +124,13 @@ 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("0 0 2 * * ?");
|
||||
request.setJob(CleanUpReportJob.class.getName());
|
||||
baseScheduleService.addSchedule(request);
|
||||
baseScheduleService.addOrUpdateCronJob(request,
|
||||
scheduleService.addSchedule(request);
|
||||
scheduleService.addOrUpdateCronJob(request,
|
||||
CleanUpReportJob.getJobKey(projectId),
|
||||
CleanUpReportJob.getTriggerKey(projectId),
|
||||
CleanUpReportJob.class);
|
||||
|
|
|
@ -15,7 +15,7 @@ import io.metersphere.system.domain.Organization;
|
|||
import io.metersphere.system.service.BaseUserService;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.domain.UserRoleRelation;
|
||||
|
@ -78,8 +78,9 @@ public class ProjectService {
|
|||
user.setLastProjectId(request.getProjectId());
|
||||
baseUserService.updateUser(user);
|
||||
UserDTO userDTO = baseUserService.getUserDTO(user.getId());
|
||||
SessionUtils.putUser(SessionUser.fromUser(userDTO, SessionUtils.getSessionId()));
|
||||
return SessionUtils.getUser();
|
||||
SessionUser sessionUser = SessionUser.fromUser(userDTO, SessionUtils.getSessionId());
|
||||
SessionUtils.putUser(sessionUser);
|
||||
return sessionUser;
|
||||
}
|
||||
|
||||
public ProjectExtendDTO getProjectById(String id) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.system.config;
|
||||
|
||||
import io.metersphere.system.sechedule.BaseScheduleService;
|
||||
import io.metersphere.system.sechedule.ScheduleService;
|
||||
import io.metersphere.system.sechedule.ScheduleManager;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -19,7 +19,7 @@ public class ScheduleConfig {
|
|||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "quartz", value = "enabled", havingValue = "true")
|
||||
public BaseScheduleService baseScheduleService() {
|
||||
return new BaseScheduleService();
|
||||
public ScheduleService scheduleService() {
|
||||
return new ScheduleService();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.dto.request.UserRoleUpdateRequest;
|
|||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.UserRole;
|
||||
import io.metersphere.system.service.GlobalUserRoleLogService;
|
||||
import io.metersphere.system.service.GlobalUserRoleService;
|
||||
|
|
|
@ -10,7 +10,7 @@ import io.metersphere.system.log.annotation.Log;
|
|||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.dto.request.GlobalUserRoleRelationQueryRequest;
|
||||
import io.metersphere.system.service.GlobalUserRoleRelationLogService;
|
||||
import io.metersphere.system.service.GlobalUserRoleRelationService;
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.sdk.dto.LicenseDTO;
|
||||
import io.metersphere.system.service.LicenseService;
|
||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
|
|
|
@ -13,7 +13,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
|||
import io.metersphere.system.service.BaseUserService;
|
||||
import io.metersphere.sdk.util.RsaKey;
|
||||
import io.metersphere.sdk.util.RsaUtil;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.sdk.dto.request.NotificationRequest;
|
|||
import io.metersphere.system.service.NotificationService;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.system.log.annotation.Log;
|
|||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.dto.OptionDisabledDTO;
|
||||
import io.metersphere.system.dto.OrgUserExtend;
|
||||
import io.metersphere.system.request.*;
|
||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.sdk.dto.request.CustomFieldUpdateRequest;
|
|||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.CustomField;
|
||||
import io.metersphere.system.service.OrganizationCustomFieldLogService;
|
||||
import io.metersphere.system.service.OrganizationCustomFieldService;
|
||||
|
|
|
@ -9,7 +9,7 @@ import io.metersphere.system.log.vo.OperationLogRequest;
|
|||
import io.metersphere.system.log.vo.OperationLogResponse;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.dto.OrganizationProjectOptionsDTO;
|
||||
import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
|
||||
|
|
|
@ -3,14 +3,13 @@ package io.metersphere.system.controller;
|
|||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.dto.*;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.request.OrganizationProjectRequest;
|
||||
import io.metersphere.system.request.ProjectAddMemberBatchRequest;
|
||||
import io.metersphere.system.request.ProjectAddMemberRequest;
|
||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.sdk.dto.request.TemplateUpdateRequest;
|
|||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.Template;
|
||||
import io.metersphere.system.service.OrganizationTemplateLogService;
|
||||
import io.metersphere.system.service.OrganizationTemplateService;
|
||||
|
|
|
@ -11,7 +11,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.domain.UserRole;
|
||||
import io.metersphere.system.request.OrganizationUserRoleEditRequest;
|
||||
|
|
|
@ -4,7 +4,7 @@ import io.metersphere.sdk.constants.PermissionConstants;
|
|||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.Plugin;
|
||||
import io.metersphere.system.dto.PluginDTO;
|
||||
import io.metersphere.system.request.PluginUpdateRequest;
|
||||
|
|
|
@ -8,7 +8,7 @@ import io.metersphere.sdk.dto.ProjectDTO;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.dto.OrganizationDTO;
|
||||
import io.metersphere.sdk.dto.UserExtend;
|
||||
import io.metersphere.system.request.OrganizationMemberRequest;
|
||||
|
|
|
@ -3,14 +3,13 @@ package io.metersphere.system.controller;
|
|||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.sdk.dto.*;
|
||||
import io.metersphere.system.log.annotation.Log;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.sdk.dto.UserExtend;
|
||||
import io.metersphere.system.request.ProjectAddMemberBatchRequest;
|
||||
|
|
|
@ -13,7 +13,7 @@ import io.metersphere.system.service.TestResourcePoolService;
|
|||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.consul.CacheNode;
|
||||
import io.metersphere.system.domain.TestResourcePool;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
|
|
|
@ -11,7 +11,7 @@ import io.metersphere.system.log.annotation.Log;
|
|||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.sdk.util.PageUtils;
|
||||
import io.metersphere.sdk.util.Pager;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.Organization;
|
||||
import io.metersphere.system.dto.UserBatchCreateDTO;
|
||||
import io.metersphere.system.dto.request.UserInviteRequest;
|
||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.system.log.constants.OperationLogType;
|
|||
import io.metersphere.system.log.service.OperationLogService;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.system.notice.annotation.SendNotice;
|
|||
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.metersphere.system.sechedule;
|
||||
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.domain.Schedule;
|
||||
import io.metersphere.system.domain.ScheduleExample;
|
||||
import io.metersphere.system.mapper.ScheduleMapper;
|
||||
|
@ -18,7 +17,7 @@ import java.util.Optional;
|
|||
import io.metersphere.system.uid.UUID;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BaseScheduleService {
|
||||
public class ScheduleService {
|
||||
|
||||
@Resource
|
||||
private ScheduleMapper scheduleMapper;
|
||||
|
@ -89,7 +88,7 @@ public class BaseScheduleService {
|
|||
if (Optional.ofNullable(enable).isPresent() && StringUtils.isNotBlank(cronExpression)) {
|
||||
try {
|
||||
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, clazz, cronExpression,
|
||||
scheduleManager.getDefaultJobDataMap(request, cronExpression, SessionUtils.getUser().getId()));
|
||||
scheduleManager.getDefaultJobDataMap(request, cronExpression, request.getCreateUser()));
|
||||
} catch (SchedulerException e) {
|
||||
throw new MSException("定时任务开启异常: " + e.getMessage());
|
||||
}
|
|
@ -5,7 +5,7 @@ import io.metersphere.sdk.constants.SessionConstants;
|
|||
import io.metersphere.sdk.dto.SessionUser;
|
||||
import io.metersphere.sdk.util.CodingUtil;
|
||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.system.security;
|
||||
|
||||
import io.metersphere.project.domain.Project;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.sdk.constants.SessionConstants;
|
|||
import io.metersphere.sdk.constants.UserSource;
|
||||
import io.metersphere.sdk.dto.SessionUser;
|
||||
import io.metersphere.sdk.dto.UserDTO;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.service.BaseUserService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
|
@ -13,7 +13,7 @@ import io.metersphere.system.log.service.OperationLogService;
|
|||
import io.metersphere.system.mapper.BaseProjectMapper;
|
||||
import io.metersphere.system.mapper.BaseUserMapper;
|
||||
import io.metersphere.sdk.util.CodingUtil;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.sdk.util.Translator;
|
||||
import io.metersphere.system.domain.*;
|
||||
import io.metersphere.system.mapper.UserMapper;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package io.metersphere.sdk.util;
|
||||
package io.metersphere.system.utils;
|
||||
|
||||
import io.metersphere.sdk.constants.InternalUserRole;
|
||||
import io.metersphere.sdk.constants.UserRoleScope;
|
||||
import io.metersphere.sdk.constants.UserRoleType;
|
||||
import io.metersphere.sdk.dto.SessionUser;
|
||||
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||
import io.metersphere.sdk.util.LogUtils;
|
||||
import io.metersphere.system.domain.UserRole;
|
||||
import io.metersphere.system.domain.UserRolePermission;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
|
@ -11,7 +11,7 @@ import io.metersphere.system.service.BaseUserRolePermissionService;
|
|||
import io.metersphere.system.service.BaseUserRoleRelationService;
|
||||
import io.metersphere.system.uid.UUID;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.controller.param.PermissionSettingUpdateRequestDefinition;
|
||||
import io.metersphere.system.controller.param.UserRoleUpdateRequestDefinition;
|
||||
import io.metersphere.system.domain.User;
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.plan.controller;
|
|||
import io.metersphere.plan.dto.TestPlanDTO;
|
||||
import io.metersphere.plan.service.TestPlanService;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
@ -20,6 +21,8 @@ public class TestPlanController {
|
|||
|
||||
@PostMapping("/add")
|
||||
public TestPlanDTO addUser(@Validated({Created.class}) @RequestBody TestPlanDTO testPlan) {
|
||||
testPlan.setCreateUser(SessionUtils.getUserId());
|
||||
testPlan.setUpdateUser(SessionUtils.getUserId());
|
||||
return testPlanService.add(testPlan);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import io.metersphere.plan.mapper.TestPlanConfigMapper;
|
|||
import io.metersphere.plan.mapper.TestPlanMapper;
|
||||
import io.metersphere.sdk.exception.MSException;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import io.metersphere.sdk.util.SessionUtils;
|
||||
import io.metersphere.system.utils.SessionUtils;
|
||||
import io.metersphere.system.domain.User;
|
||||
import io.metersphere.system.uid.UUID;
|
||||
import jakarta.annotation.Resource;
|
||||
|
@ -50,10 +50,6 @@ public class TestPlanService {
|
|||
private TestPlanFunctionCaseService testPlanFunctionCaseService;
|
||||
|
||||
public TestPlanDTO add(@NotNull TestPlanDTO testPlanCreateRequest) {
|
||||
User user = SessionUtils.getUser();
|
||||
if (user == null) {
|
||||
throw new MSException("Cannot find user!");
|
||||
}
|
||||
if (StringUtils.equals(testPlanCreateRequest.getParentId(), testPlanCreateRequest.getId())) {
|
||||
throw new MSException("The parent test plan cannot be the same as the current test plan!");
|
||||
}
|
||||
|
@ -61,8 +57,6 @@ public class TestPlanService {
|
|||
if (StringUtils.isBlank(testPlanCreateRequest.getId())) {
|
||||
testPlanCreateRequest.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
testPlanCreateRequest.setCreateUser(user.getId());
|
||||
testPlanCreateRequest.setUpdateUser(user.getId());
|
||||
testPlanCreateRequest.setCreateTime(System.currentTimeMillis());
|
||||
testPlanCreateRequest.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
|
|
Loading…
Reference in New Issue