Commit b64c9878 by guojuxing

用户批量转移分组添加全部转移逻辑

parent e8123d70
......@@ -4,7 +4,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -108,12 +110,24 @@ public class UserController {
}
@RequestMapping("/bulk-transfer-user-to-new-account-group")
public RestResponse bulkTransferAccountGroup(String userIds, Integer targetAccountGroupId) {
List<Integer> userIdList = Arrays.stream(userIds.split(","))
.filter(e -> StringUtils.isNumeric(e))
.mapToInt(e -> Integer.parseInt(e))
.boxed()
.collect(Collectors.toList());
public RestResponse bulkTransferAccountGroup(String userIds, Integer targetAccountGroupId, boolean isAll) {
List<Integer> userIdList = null;
if (isAll) {
ServiceResponse<List<UserDTO>> result = userApiService.listUser(new UserQO()
.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId()));
if (result.isSuccess()) {
List<UserDTO> userList = result.getResult();
if (CollectionUtils.isNotEmpty(userList)) {
userIdList = userList.stream().map(e -> e.getUserId()).collect(Collectors.toList());
}
}
} else {
userIdList = Arrays.stream(userIds.split(","))
.filter(e -> StringUtils.isNumeric(e))
.mapToInt(e -> Integer.parseInt(e))
.boxed()
.collect(Collectors.toList());
}
return ResultControllerUtils.commonResult(userApiService.bulkTransferAccountGroup(userIdList, targetAccountGroupId));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment