feat(系统设置): 建某人的一揽子优化

This commit is contained in:
Jianguo-Genius 2024-05-31 10:45:57 +08:00 committed by 刘瑞斌
parent 45106889de
commit aff87164ad
11 changed files with 45 additions and 45 deletions

View File

@ -9,7 +9,7 @@ import io.metersphere.api.service.definition.ApiDefinitionScheduleService;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.CommonBeanFactory;
import io.metersphere.system.schedule.BaseScheduleJob;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobKey;
@ -18,12 +18,12 @@ import org.quartz.TriggerKey;
public class SwaggerUrlImportJob extends BaseScheduleJob {
private ApiDefinitionImportUtilService apiDefinitionImportUtilService;
private ApiDefinitionScheduleService apiDefinitionScheduleService;
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
public SwaggerUrlImportJob() {
apiDefinitionImportUtilService = CommonBeanFactory.getBean(ApiDefinitionImportUtilService.class);
apiDefinitionScheduleService = CommonBeanFactory.getBean(ApiDefinitionScheduleService.class);
normalUserService = CommonBeanFactory.getBean(NormalUserService.class);
simpleUserService = CommonBeanFactory.getBean(SimpleUserService.class);
}
@Override

View File

@ -10,7 +10,7 @@ import io.metersphere.system.log.service.OperationLogService;
import io.metersphere.system.log.vo.OperationLogResponse;
import io.metersphere.system.log.vo.ProOperationLogRequest;
import io.metersphere.system.log.vo.SystemOperationLogRequest;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.utils.PageUtils;
import io.metersphere.system.utils.Pager;
import io.metersphere.system.utils.SessionUtils;
@ -37,7 +37,7 @@ import java.util.List;
public class ProjectLogController {
@Autowired
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Autowired
private OperationLogService operationLogService;
@ -48,7 +48,7 @@ public class ProjectLogController {
public List<User> getUserList(@PathVariable(value = "projectId") String projectId,
@Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
return normalUserService.getUserListByOrgId(StringUtils.defaultIfBlank(projectId, SessionUtils.getCurrentProjectId()), keyword);
return simpleUserService.getUserListByOrgId(StringUtils.defaultIfBlank(projectId, SessionUtils.getCurrentProjectId()), keyword);
}

View File

@ -10,8 +10,8 @@ import io.metersphere.system.dto.response.OrganizationProjectOptionsResponse;
import io.metersphere.system.log.service.OperationLogService;
import io.metersphere.system.log.vo.OperationLogResponse;
import io.metersphere.system.log.vo.SystemOperationLogRequest;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.OrganizationService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.service.SystemProjectService;
import io.metersphere.system.utils.PageUtils;
import io.metersphere.system.utils.Pager;
@ -41,7 +41,7 @@ public class OperationLogController {
private OperationLogService operationLogService;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@GetMapping("/get/options")
@ -77,7 +77,7 @@ public class OperationLogController {
@RequiresPermissions(PermissionConstants.SYSTEM_LOG_READ)
public List<User> getUserList(@Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
List<User> userList = normalUserService.getUserList(keyword);
List<User> userList = simpleUserService.getUserList(keyword);
return userList;
}
}

View File

@ -12,7 +12,7 @@ import io.metersphere.system.log.service.OperationLogService;
import io.metersphere.system.log.vo.OperationLogResponse;
import io.metersphere.system.log.vo.OrgOperationLogRequest;
import io.metersphere.system.log.vo.SystemOperationLogRequest;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.service.SystemProjectService;
import io.metersphere.system.utils.PageUtils;
import io.metersphere.system.utils.Pager;
@ -45,7 +45,7 @@ public class OrganizationLogController {
private OperationLogService operationLogService;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@GetMapping("/get/options/{organizationId}")
@ -67,7 +67,7 @@ public class OrganizationLogController {
public List<User> getLogUserList(@PathVariable(value = "organizationId") String organizationId,
@Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
return normalUserService.getUserListByOrgId(organizationId, keyword);
return simpleUserService.getUserListByOrgId(organizationId, keyword);
}

View File

@ -6,7 +6,7 @@ import io.metersphere.system.dto.request.user.PersonalUpdateRequest;
import io.metersphere.system.dto.user.PersonalDTO;
import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.service.UserLogService;
import io.metersphere.system.utils.SessionUtils;
import io.swagger.v3.oas.annotations.Operation;
@ -23,13 +23,13 @@ public class
PersonalCenterController {
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@GetMapping("/get/{id}")
@Operation(summary = "个人中心-获取信息")
public PersonalDTO getInformation(@PathVariable String id) {
this.checkPermission(id);
return normalUserService.getPersonalById(id);
return simpleUserService.getPersonalById(id);
}
@PostMapping("/update-info")
@ -37,7 +37,7 @@ PersonalCenterController {
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateAccountLog(#request)", msClass = UserLogService.class)
public boolean updateUser(@Validated @RequestBody PersonalUpdateRequest request) {
this.checkPermission(request.getId());
return normalUserService.updateAccount(request, SessionUtils.getUserId());
return simpleUserService.updateAccount(request, SessionUtils.getUserId());
}
@PostMapping("/update-password")
@ -45,7 +45,7 @@ PersonalCenterController {
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updatePasswordLog(#request)", msClass = UserLogService.class)
public String updateUser(@Validated @RequestBody PersonalUpdatePasswordRequest request) {
this.checkPermission(request.getId());
if (normalUserService.updatePassword(request)) {
if (simpleUserService.updatePassword(request)) {
SessionUtils.kickOutUser(SessionUtils.getUser().getId());
}
return "OK";

View File

@ -11,8 +11,8 @@ import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.dto.user.UserExtendDTO;
import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.OrganizationService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.service.SystemOrganizationLogService;
import io.metersphere.system.service.SystemProjectService;
import io.metersphere.system.utils.PageUtils;
@ -43,7 +43,7 @@ import java.util.Map;
public class SystemOrganizationController {
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Resource
private SystemProjectService systemProjectService;
@Resource
@ -182,6 +182,6 @@ public class SystemOrganizationController {
public List<UserExtendDTO> getMemberOption(@PathVariable String sourceId,
@Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
return normalUserService.getMemberOption(sourceId, keyword);
return simpleUserService.getMemberOption(sourceId, keyword);
}
}

View File

@ -15,7 +15,7 @@ import io.metersphere.system.dto.user.UserExtendDTO;
import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.security.CheckOwner;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.service.SystemProjectLogService;
import io.metersphere.system.service.SystemProjectService;
import io.metersphere.system.utils.PageUtils;
@ -43,7 +43,7 @@ public class SystemProjectController {
@Resource
private SystemProjectService systemProjectService;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@PostMapping("/add")
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ_ADD)
@ -156,7 +156,7 @@ public class SystemProjectController {
@RequiresPermissions(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ)
public List<User> getUserList(@Schema(description = "查询关键字,根据邮箱和用户名查询")
@RequestParam(value = "keyword", required = false) String keyword) {
return normalUserService.getUserList(keyword);
return simpleUserService.getUserList(keyword);
}
@PostMapping("/pool-options")

View File

@ -49,7 +49,7 @@ import java.util.Map;
@RequestMapping("/system/user")
public class UserController {
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Resource
private UserToolService userToolService;
@Resource
@ -67,14 +67,14 @@ public class UserController {
@Operation(summary = "通过email或id查找用户")
@RequiresPermissions(PermissionConstants.SYSTEM_USER_READ)
public UserDTO getUser(@PathVariable String keyword) {
return normalUserService.getUserDTOByKeyword(keyword);
return simpleUserService.getUserDTOByKeyword(keyword);
}
@PostMapping("/add")
@Operation(summary = "系统设置-系统-用户-添加用户")
@RequiresPermissions(PermissionConstants.SYSTEM_USER_ADD)
public UserBatchCreateResponse addUser(@Validated({Created.class}) @RequestBody UserBatchCreateRequest userCreateDTO) {
return normalUserService.addUser(userCreateDTO, UserSource.LOCAL.name(), SessionUtils.getUserId());
return simpleUserService.addUser(userCreateDTO, UserSource.LOCAL.name(), SessionUtils.getUserId());
}
@PostMapping("/update")
@ -82,7 +82,7 @@ public class UserController {
@RequiresPermissions(PermissionConstants.SYSTEM_USER_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#request)", msClass = UserLogService.class)
public UserEditRequest updateUser(@Validated({Updated.class}) @RequestBody UserEditRequest request) {
return normalUserService.updateUser(request, SessionUtils.getUserId());
return simpleUserService.updateUser(request, SessionUtils.getUserId());
}
@PostMapping("/page")
@ -91,7 +91,7 @@ public class UserController {
public Pager<List<UserTableResponse>> list(@Validated @RequestBody BasePageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "create_time desc,id desc");
return PageUtils.setPageInfo(page, normalUserService.list(request));
return PageUtils.setPageInfo(page, simpleUserService.list(request));
}
@PostMapping("/update/enable")
@ -99,14 +99,14 @@ public class UserController {
@RequiresPermissions(PermissionConstants.SYSTEM_USER_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.batchUpdateEnableLog(#request)", msClass = UserLogService.class)
public TableBatchProcessResponse updateUserEnable(@Validated @RequestBody UserChangeEnableRequest request) {
return normalUserService.updateUserEnable(request, SessionUtils.getUserId(), SessionUtils.getUser().getName());
return simpleUserService.updateUserEnable(request, SessionUtils.getUserId(), SessionUtils.getUser().getName());
}
@PostMapping(value = "/import", consumes = {"multipart/form-data"})
@Operation(summary = "系统设置-系统-用户-导入用户")
@RequiresPermissions(PermissionConstants.SYSTEM_USER_IMPORT)
public UserImportResponse importUser(@RequestPart(value = "file", required = false) MultipartFile excelFile) {
return normalUserService.importByExcel(excelFile, UserSource.LOCAL.name(), SessionUtils.getUserId());
return simpleUserService.importByExcel(excelFile, UserSource.LOCAL.name(), SessionUtils.getUserId());
}
@PostMapping("/delete")
@ -114,7 +114,7 @@ public class UserController {
@Log(type = OperationLogType.DELETE, expression = "#msClass.deleteLog(#request)", msClass = UserLogService.class)
@RequiresPermissions(PermissionConstants.SYSTEM_USER_DELETE)
public TableBatchProcessResponse deleteUser(@Validated @RequestBody TableBatchProcessDTO request) {
return normalUserService.deleteUser(request, SessionUtils.getUserId(), SessionUtils.getUser().getName());
return simpleUserService.deleteUser(request, SessionUtils.getUserId(), SessionUtils.getUser().getName());
}
@PostMapping("/reset/password")
@ -122,7 +122,7 @@ public class UserController {
@RequiresPermissions(PermissionConstants.SYSTEM_USER_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.resetPasswordLog(#request)", msClass = UserLogService.class)
public TableBatchProcessResponse resetPassword(@Validated @RequestBody TableBatchProcessDTO request) {
return normalUserService.resetPassword(request, SessionUtils.getUserId());
return simpleUserService.resetPassword(request, SessionUtils.getUserId());
}
@GetMapping("/get/global/system/role")
@ -186,18 +186,18 @@ public class UserController {
@Operation(summary = "系统设置-系统-用户-邀请用户注册")
@RequiresPermissions(PermissionConstants.SYSTEM_USER_INVITE)
public UserInviteResponse invite(@Validated @RequestBody UserInviteRequest request) {
return normalUserService.saveInviteRecord(request, SessionUtils.getUser());
return simpleUserService.saveInviteRecord(request, SessionUtils.getUser());
}
@GetMapping("/check-invite/{inviteId}")
@Operation(summary = "系统设置-系统-用户-用户接受注册邀请并创建账户")
public void checkInviteNum(@PathVariable String inviteId) {
normalUserService.getUserInviteAndCheckEfficient(inviteId);
simpleUserService.getUserInviteAndCheckEfficient(inviteId);
}
@PostMapping("/register-by-invite")
@Operation(summary = "系统设置-系统-用户-用户接受注册邀请并创建账户")
public String registerByInvite(@Validated @RequestBody UserRegisterRequest request) throws Exception {
return normalUserService.registerByInvite(request);
return simpleUserService.registerByInvite(request);
}
}

View File

@ -41,7 +41,7 @@ public class GlobalUserRoleRelationService extends BaseUserRoleRelationService {
@Resource
private GlobalUserRoleService globalUserRoleService;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Resource
private UserToolService userToolService;
@Resource
@ -71,7 +71,7 @@ public class GlobalUserRoleRelationService extends BaseUserRoleRelationService {
this.checkGlobalSystemUserRoleLegality(
Collections.singletonList(request.getRoleId()));
//检查用户的合法性
normalUserService.checkUserLegality(request.getUserIds());
simpleUserService.checkUserLegality(request.getUserIds());
List<UserRoleRelation> userRoleRelations = new ArrayList<>();
request.getUserIds().forEach(userId -> {
UserRoleRelation userRoleRelation = new UserRoleRelation();
@ -100,7 +100,7 @@ public class GlobalUserRoleRelationService extends BaseUserRoleRelationService {
//获取本次处理的用户
request.setSelectIds(userToolService.getBatchUserIds(request));
//检查用户的合法性
normalUserService.checkUserLegality(request.getSelectIds());
simpleUserService.checkUserLegality(request.getSelectIds());
List<UserRoleRelation> savedUserRoleRelation = this.selectByUserIdAndRuleId(request.getSelectIds(), request.getRoleIds());
//过滤已经存储过的用户关系
Map<String, List<String>> userRoleIdMap = savedUserRoleRelation.stream()

View File

@ -15,7 +15,7 @@ import io.metersphere.system.dto.user.UserDTO;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.mapper.UserExtendMapper;
import io.metersphere.system.mapper.UserMapper;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.uid.IDGenerator;
import io.metersphere.system.utils.user.PersonalRequestUtils;
import jakarta.annotation.Resource;
@ -39,7 +39,7 @@ public class PersonalControllerTests extends BaseTest {
@Resource
private UserMapper userMapper;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Test
@Order(0)
@ -63,7 +63,7 @@ public class PersonalControllerTests extends BaseTest {
@Order(1)
void testPersonalUpdateInfo() throws Exception {
//方法测试
normalUserService.checkUserEmail(IDGenerator.nextStr(), "admin_update@metersphere.io");
simpleUserService.checkUserEmail(IDGenerator.nextStr(), "admin_update@metersphere.io");
PersonalUpdateRequest request = new PersonalUpdateRequest();
request.setId(loginUser);
@ -76,7 +76,7 @@ public class PersonalControllerTests extends BaseTest {
boolean methodCheck = false;
try {
normalUserService.checkUserEmail(IDGenerator.nextStr(), "admin_update@metersphere.io");
simpleUserService.checkUserEmail(IDGenerator.nextStr(), "admin_update@metersphere.io");
} catch (Exception e) {
methodCheck = true;
}

View File

@ -24,7 +24,7 @@ import io.metersphere.system.dto.sdk.OptionDTO;
import io.metersphere.system.mapper.BaseUserMapper;
import io.metersphere.system.mapper.UserMapper;
import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.service.NormalUserService;
import io.metersphere.system.service.SimpleUserService;
import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
@ -47,7 +47,7 @@ public class TestPlanReportService {
@Resource
private UserMapper userMapper;
@Resource
private NormalUserService normalUserService;
private SimpleUserService simpleUserService;
@Resource
private SqlSessionFactory sqlSessionFactory;
@Resource
@ -91,7 +91,7 @@ public class TestPlanReportService {
return new ArrayList<>();
}
List<String> distinctUserIds = reportList.stream().map(TestPlanReportPageResponse::getCreateUser).distinct().toList();
Map<String, String> userMap = normalUserService.getUserMapByIds(distinctUserIds);
Map<String, String> userMap = simpleUserService.getUserMapByIds(distinctUserIds);
reportList.forEach(report -> report.setCreateUserName(userMap.get(report.getCreateUser())));
return reportList;
}