parent
13da0485f7
commit
26d360e060
|
@ -89,6 +89,8 @@ public class UserController {
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
|
@Log(isBefore = true, type = OperationLogType.DELETE, module = OperationLogModule.SYSTEM_USER, isBatch = true,
|
||||||
|
details = "#msClass.getLogs(#userBatchProcessRequest)", msClass = UserService.class)
|
||||||
@RequiresPermissions(PermissionConstants.SYSTEM_USER_READ_DELETE)
|
@RequiresPermissions(PermissionConstants.SYSTEM_USER_READ_DELETE)
|
||||||
public UserBatchProcessResponse deleteUser(@Validated @RequestBody UserChangeEnableRequest userBatchProcessRequest) {
|
public UserBatchProcessResponse deleteUser(@Validated @RequestBody UserChangeEnableRequest userBatchProcessRequest) {
|
||||||
return userService.deleteUser(userBatchProcessRequest.getUserIdList());
|
return userService.deleteUser(userBatchProcessRequest.getUserIdList());
|
||||||
|
|
|
@ -9,10 +9,7 @@ import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||||
import io.metersphere.sdk.log.constants.OperationLogType;
|
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||||
import io.metersphere.sdk.log.service.OperationLogService;
|
import io.metersphere.sdk.log.service.OperationLogService;
|
||||||
import io.metersphere.sdk.mapper.BaseUserMapper;
|
import io.metersphere.sdk.mapper.BaseUserMapper;
|
||||||
import io.metersphere.sdk.util.BeanUtils;
|
import io.metersphere.sdk.util.*;
|
||||||
import io.metersphere.sdk.util.CodingUtil;
|
|
||||||
import io.metersphere.sdk.util.LogUtils;
|
|
||||||
import io.metersphere.sdk.util.Translator;
|
|
||||||
import io.metersphere.system.domain.OperationLog;
|
import io.metersphere.system.domain.OperationLog;
|
||||||
import io.metersphere.system.domain.User;
|
import io.metersphere.system.domain.User;
|
||||||
import io.metersphere.system.domain.UserExample;
|
import io.metersphere.system.domain.UserExample;
|
||||||
|
@ -20,6 +17,7 @@ import io.metersphere.system.dto.UserBatchCreateDTO;
|
||||||
import io.metersphere.system.dto.UserCreateInfo;
|
import io.metersphere.system.dto.UserCreateInfo;
|
||||||
import io.metersphere.system.dto.excel.UserExcel;
|
import io.metersphere.system.dto.excel.UserExcel;
|
||||||
import io.metersphere.system.dto.excel.UserExcelRowDTO;
|
import io.metersphere.system.dto.excel.UserExcelRowDTO;
|
||||||
|
import io.metersphere.system.dto.request.UserBatchProcessRequest;
|
||||||
import io.metersphere.system.dto.request.UserChangeEnableRequest;
|
import io.metersphere.system.dto.request.UserChangeEnableRequest;
|
||||||
import io.metersphere.system.dto.request.UserEditRequest;
|
import io.metersphere.system.dto.request.UserEditRequest;
|
||||||
import io.metersphere.system.dto.response.UserBatchProcessResponse;
|
import io.metersphere.system.dto.response.UserBatchProcessResponse;
|
||||||
|
@ -78,6 +76,32 @@ public class UserService {
|
||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<User> selectByIdList(@NotEmpty List<String> userIdList) {
|
||||||
|
UserExample example = new UserExample();
|
||||||
|
example.createCriteria().andIdIn(userIdList);
|
||||||
|
return userMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
//切面方法调用:获取接口日志
|
||||||
|
public List<OperationLog> getLogs(UserBatchProcessRequest request) {
|
||||||
|
List<OperationLog> logs = new ArrayList<>();
|
||||||
|
List<User> userList = this.selectByIdList(request.getUserIdList());
|
||||||
|
userList.forEach(user -> {
|
||||||
|
OperationLog log = new OperationLog();
|
||||||
|
log.setId(UUID.randomUUID().toString());
|
||||||
|
log.setCreateUser(SessionUtils.getUserId());
|
||||||
|
log.setProjectId("system");
|
||||||
|
log.setType(OperationLogType.DELETE.name());
|
||||||
|
log.setModule(OperationLogModule.SYSTEM_USER);
|
||||||
|
log.setCreateTime(System.currentTimeMillis());
|
||||||
|
log.setMethod("deleteUser");
|
||||||
|
log.setSourceId(user.getId());
|
||||||
|
log.setDetails(user.getName());
|
||||||
|
logs.add(log);
|
||||||
|
});
|
||||||
|
return logs;
|
||||||
|
}
|
||||||
|
|
||||||
private void validateUserInfo(List<UserCreateInfo> userList) {
|
private void validateUserInfo(List<UserCreateInfo> userList) {
|
||||||
//判断参数内是否含有重复邮箱
|
//判断参数内是否含有重复邮箱
|
||||||
List<String> emailList = new ArrayList<>();
|
List<String> emailList = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue