feat(sj_1.0.0): 组导入支持条件筛选
This commit is contained in:
parent
ae6f427d89
commit
fe4a69c66f
@ -5,6 +5,7 @@ import com.aizuda.snailjob.common.core.exception.SnailJobCommonException;
|
||||
import com.aizuda.snailjob.server.web.annotation.LoginRequired;
|
||||
import com.aizuda.snailjob.server.web.annotation.RoleEnum;
|
||||
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||
import com.aizuda.snailjob.server.web.model.request.ExportGroupVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.GroupConfigResponseVO;
|
||||
@ -20,7 +21,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 重试组接口
|
||||
@ -103,7 +103,7 @@ public class GroupConfigController {
|
||||
@PostMapping("/export")
|
||||
@LoginRequired
|
||||
@OriginalControllerReturnValue
|
||||
public ResponseEntity<String> exportGroup(@RequestBody Set<Long> groupIds) {
|
||||
return ExportUtils.doExport(groupConfigService.exportGroup(groupIds));
|
||||
public ResponseEntity<String> exportGroup(@RequestBody ExportGroupVO exportGroupVO) {
|
||||
return ExportUtils.doExport(groupConfigService.exportGroup(exportGroupVO));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.aizuda.snailjob.server.web.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author: opensnail
|
||||
* @date : 2024-05-29
|
||||
* @since : sj_1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class ExportGroupVO {
|
||||
|
||||
private String groupName;
|
||||
|
||||
private Integer groupStatus;
|
||||
|
||||
private Set<Long> groupIds;
|
||||
|
||||
}
|
@ -5,20 +5,18 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* @author: opensnail
|
||||
* @date : 2021-11-22 13:45
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class GroupConfigQueryVO extends BaseQueryVO {
|
||||
|
||||
@NotBlank(message = "组名称不能为空")
|
||||
@Pattern(regexp = "^[A-Za-z0-9_-]{1,64}$", message = "仅支持长度为1~64字符且类型为数字、字母、下划线和短横线")
|
||||
private String groupName;
|
||||
|
||||
@NotNull(message = "组状态不能为空")
|
||||
private Integer groupStatus;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.web.service;
|
||||
|
||||
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||
import com.aizuda.snailjob.server.web.model.request.ExportGroupVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.response.GroupConfigResponseVO;
|
||||
@ -36,5 +37,5 @@ public interface GroupConfigService {
|
||||
|
||||
void importGroup(@Valid @NotEmpty(message = "导入数据不能为空") List<GroupConfigRequestVO> requestVOS);
|
||||
|
||||
String exportGroup(Set<Long> groupIds);
|
||||
String exportGroup(ExportGroupVO exportGroupVO);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.aizuda.snailjob.server.common.exception.SnailJobServerException;
|
||||
import com.aizuda.snailjob.server.common.handler.ConfigVersionSyncHandler;
|
||||
import com.aizuda.snailjob.server.common.util.PartitionTaskUtils;
|
||||
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||
import com.aizuda.snailjob.server.web.model.request.ExportGroupVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigQueryVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.GroupConfigRequestVO;
|
||||
import com.aizuda.snailjob.server.web.model.request.UserSessionVO;
|
||||
@ -184,6 +185,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
new PageDTO<>(queryVO.getPage(), queryVO.getSize()),
|
||||
new LambdaQueryWrapper<GroupConfig>()
|
||||
.eq(GroupConfig::getNamespaceId, namespaceId)
|
||||
.eq(Objects.nonNull(queryVO.getGroupStatus()), GroupConfig::getGroupStatus, queryVO.getGroupStatus())
|
||||
.in(userSessionVO.isUser(), GroupConfig::getGroupName, userSessionVO.getGroupNames())
|
||||
.likeRight(StrUtil.isNotBlank(queryVO.getGroupName()), GroupConfig::getGroupName,
|
||||
StrUtil.trim(queryVO.getGroupName()))
|
||||
@ -420,7 +422,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String exportGroup(final Set<Long> groupIds) {
|
||||
public String exportGroup(ExportGroupVO exportGroupVO) {
|
||||
String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId();
|
||||
|
||||
List<GroupConfigRequestVO> allRequestList = Lists.newArrayList();
|
||||
@ -429,7 +431,9 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
new LambdaQueryWrapper<GroupConfig>()
|
||||
.ge(GroupConfig::getId, startId)
|
||||
.eq(GroupConfig::getNamespaceId, namespaceId)
|
||||
.in(CollUtil.isNotEmpty(groupIds), GroupConfig::getId, groupIds)
|
||||
.eq(Objects.nonNull(exportGroupVO.getGroupStatus()), GroupConfig::getGroupStatus, exportGroupVO.getGroupStatus())
|
||||
.in(CollUtil.isNotEmpty(exportGroupVO.getGroupIds()), GroupConfig::getId, exportGroupVO.getGroupIds())
|
||||
.likeRight(StrUtil.isNotBlank(exportGroupVO.getGroupName()), GroupConfig::getGroupName, StrUtil.trim(exportGroupVO.getGroupName()))
|
||||
.orderByAsc(GroupConfig::getId)
|
||||
).getRecords();
|
||||
return groupConfigs.stream().map(GroupConfigPartitionTask::new).toList();
|
||||
|
Loading…
Reference in New Issue
Block a user