feat: 2.5.0
1. namespace 未完成
This commit is contained in:
parent
f3718624a0
commit
2374bb8d59
@ -8,14 +8,14 @@ USE
|
||||
CREATE TABLE `namespace`
|
||||
(
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`name` varchar(64) NOT NULL DEFAULT '' COMMENT '名称',
|
||||
`unique_id` varchar(64) NOT NULL DEFAULT '' COMMENT '唯一id',
|
||||
`name` varchar(64) NOT NULL COMMENT '名称',
|
||||
`unique_id` varchar(64) NOT NULL COMMENT '唯一id',
|
||||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '逻辑删除 1、删除',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_name` (`name`),
|
||||
UNIQUE KEY `uk_name` (`unique_id`)
|
||||
UNIQUE KEY `uk_unique_id` (`unique_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='命名空间';
|
||||
|
||||
@ -246,6 +246,7 @@ CREATE TABLE `system_user_permission`
|
||||
(
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||||
`namespace_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '命名空间id',
|
||||
`system_user_id` bigint(20) NOT NULL COMMENT '系统用户id',
|
||||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
|
@ -4,6 +4,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 标识某个操作的具体原因
|
||||
*
|
||||
|
@ -14,5 +14,9 @@ public class JobBatchQueryDO {
|
||||
private Integer taskBatchStatus;
|
||||
private String jobName;
|
||||
private Long jobId;
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private Long namespaceId;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.aizuda.easy.retry.template.datasource.persistence.mapper;
|
||||
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Namespace;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 命名空间 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xiaowoniu
|
||||
* @since 2023-11-21
|
||||
*/
|
||||
@Mapper
|
||||
public interface NamespaceMapper extends BaseMapper<Namespace> {
|
||||
|
||||
}
|
@ -14,6 +14,9 @@ public class GroupConfig implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
|
||||
private String groupName;
|
||||
|
||||
private Integer groupStatus;
|
||||
|
@ -29,6 +29,11 @@ public class Job implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private Long namespaceId;
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
|
@ -32,6 +32,12 @@ public class JobTaskBatch implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private Long namespaceId;
|
||||
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.aizuda.easy.retry.template.datasource.persistence.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 命名空间
|
||||
* </p>
|
||||
*
|
||||
* @author xiaowoniu
|
||||
* @since 2023-11-21
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("namespace")
|
||||
public class Namespace implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 唯一id
|
||||
*/
|
||||
private String uniqueId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createDt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateDt;
|
||||
|
||||
/**
|
||||
* 逻辑删除 1、删除
|
||||
*/
|
||||
private Byte deleted;
|
||||
}
|
@ -12,6 +12,8 @@ public class NotifyConfig implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String sceneName;
|
||||
|
@ -13,6 +13,8 @@ public class RetryDeadLetter implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
private String uniqueId;
|
||||
|
||||
private String groupName;
|
||||
|
@ -15,6 +15,8 @@ public class RetryTask implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
private String uniqueId;
|
||||
|
||||
private String groupName;
|
||||
|
@ -13,6 +13,8 @@ public class RetryTaskLog implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
private String uniqueId;
|
||||
|
||||
private String groupName;
|
||||
|
@ -18,6 +18,9 @@ public class SceneConfig implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long namespaceId;
|
||||
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String sceneName;
|
||||
|
@ -7,6 +7,7 @@
|
||||
<id column="id" property="id" />
|
||||
<result column="group_name" property="groupName" />
|
||||
<result column="job_id" property="jobId" />
|
||||
<result column="namespace_id" property="namespaceId" />
|
||||
<result column="task_batch_status" property="taskBatchStatus" />
|
||||
<result column="create_dt" property="createDt" />
|
||||
<result column="update_dt" property="updateDt" />
|
||||
@ -18,6 +19,7 @@
|
||||
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type
|
||||
FROM job_task_batch a join job b on a.job_id = b.id
|
||||
<where>
|
||||
namespace_id = #{queryDO.namespaceId}
|
||||
<if test="queryDO.jobId != null">
|
||||
and job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
|
@ -7,6 +7,7 @@
|
||||
<id column="id" property="id" />
|
||||
<result column="group_name" property="groupName" />
|
||||
<result column="job_id" property="jobId" />
|
||||
<result column="namespace_id" property="namespaceId" />
|
||||
<result column="task_batch_status" property="taskBatchStatus" />
|
||||
<result column="create_dt" property="createDt" />
|
||||
<result column="update_dt" property="updateDt" />
|
||||
@ -18,6 +19,7 @@
|
||||
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type
|
||||
FROM job_task_batch a join job b on a.job_id = b.id
|
||||
<where>
|
||||
namespace_id = #{queryDO.namespaceId}
|
||||
<if test="queryDO.jobId != null">
|
||||
and job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aizuda.easy.retry.template.datasource.persistence.mapper.NamespaceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.Namespace">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="unique_id" property="uniqueId" />
|
||||
<result column="create_dt" property="createDt" />
|
||||
<result column="update_dt" property="updateDt" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
@ -7,6 +7,7 @@
|
||||
<id column="id" property="id" />
|
||||
<result column="group_name" property="groupName" />
|
||||
<result column="job_id" property="jobId" />
|
||||
<result column="namespace_id" property="namespaceId" />
|
||||
<result column="task_batch_status" property="taskBatchStatus" />
|
||||
<result column="create_dt" property="createDt" />
|
||||
<result column="update_dt" property="updateDt" />
|
||||
@ -18,6 +19,7 @@
|
||||
SELECT a.*, b.job_name, b.task_type, b.block_strategy, b.trigger_type
|
||||
FROM job_task_batch a join job b on a.job_id = b.id
|
||||
<where>
|
||||
namespace_id = #{queryDO.namespaceId}
|
||||
<if test="queryDO.jobId != null">
|
||||
and job_id = #{queryDO.jobId}
|
||||
</if>
|
||||
|
@ -80,7 +80,7 @@ public class BlockStrategies {
|
||||
// 重新生成任务
|
||||
JobTaskBatchGenerator jobTaskBatchGenerator = SpringContext.getBeanByType(JobTaskBatchGenerator.class);
|
||||
JobTaskBatchGeneratorContext jobTaskBatchGeneratorContext = JobTaskConverter.INSTANCE.toJobTaskGeneratorContext(context);
|
||||
jobTaskBatchGeneratorContext.setTaskBatchStatus(JobTaskBatchStatusEnum.FAIL.getStatus());
|
||||
jobTaskBatchGeneratorContext.setTaskBatchStatus(JobTaskBatchStatusEnum.CANCEL.getStatus());
|
||||
jobTaskBatchGeneratorContext.setOperationReason(JobOperationReasonEnum.JOB_DISCARD.getReason());
|
||||
jobTaskBatchGenerator.generateJobTaskBatch(jobTaskBatchGeneratorContext);
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ public abstract class AbstractGenerator implements TaskGenerator {
|
||||
}
|
||||
|
||||
RetryTask retryTask = RetryTaskConverter.INSTANCE.toRetryTask(taskInfo);
|
||||
retryTask.setNamespaceId(sceneConfig.getNamespaceId());
|
||||
retryTask.setUniqueId(getIdGenerator(taskContext.getGroupName()));
|
||||
retryTask.setTaskType(TaskTypeEnum.RETRY.getType());
|
||||
retryTask.setGroupName(taskContext.getGroupName());
|
||||
|
@ -2,7 +2,6 @@ package com.aizuda.easy.retry.server.retry.task.support.timer;
|
||||
|
||||
import com.aizuda.easy.retry.common.core.context.SpringContext;
|
||||
import com.aizuda.easy.retry.common.core.enums.RetryStatusEnum;
|
||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||
import com.aizuda.easy.retry.server.retry.task.support.dispatch.task.TaskExecutor;
|
||||
import com.aizuda.easy.retry.server.retry.task.support.dispatch.task.TaskActuatorFactory;
|
||||
import com.aizuda.easy.retry.template.datasource.access.AccessTemplate;
|
||||
|
@ -69,8 +69,8 @@ public class GroupConfigController {
|
||||
|
||||
@LoginRequired
|
||||
@GetMapping("/all/group-name/list")
|
||||
public List<String> getAllGroupNameList() {
|
||||
return groupConfigService.getAllGroupNameList();
|
||||
public List<String> getAllGroupNameList(@RequestParam("namespaceId") Long namespaceId) {
|
||||
return groupConfigService.getAllGroupNameList(namespaceId);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.aizuda.easy.retry.server.web.controller;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.annotation.LoginUser;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.NamespaceResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.NamespaceService;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SystemUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:02
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/namespace")
|
||||
public class NamespaceController {
|
||||
|
||||
@Autowired
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
@PostMapping
|
||||
public Boolean saveNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
|
||||
return namespaceService.saveNamespace(namespaceRequestVO);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public Boolean updateNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
|
||||
return namespaceService.updateNamespace(namespaceRequestVO);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public PageResult<List<NamespaceResponseVO>> getNamespacePage(NamespaceQueryVO queryVO) {
|
||||
return namespaceService.getNamespacePage(queryVO);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public List<NamespaceResponseVO> getNamespaceByUserId(@LoginUser SystemUser systemUser) {
|
||||
return namespaceService.getNamespaceByUserId(systemUser);
|
||||
}
|
||||
}
|
@ -22,4 +22,9 @@ public class GroupConfigQueryVO extends BaseQueryVO {
|
||||
@NotNull(message = "组状态不能为空")
|
||||
private Integer groupStatus;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private Long namespaceId;
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,12 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class GroupConfigRequestVO {
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
@NotNull(message = "命名空间id 不能为空")
|
||||
private Long namespaceId;
|
||||
|
||||
@NotBlank(message = "组名称不能为空")
|
||||
@Pattern(regexp = "^[A-Za-z0-9_]{1,64}$", message = "仅支持长度为1~64字符且类型为数字、字母和下划线")
|
||||
private String groupName;
|
||||
|
@ -16,4 +16,9 @@ public class JobBatchQueryVO extends BaseQueryVO {
|
||||
private String jobName;
|
||||
private Integer taskBatchStatus;
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
private Long namespaceId;
|
||||
}
|
||||
|
@ -15,4 +15,6 @@ public class JobQueryVO extends BaseQueryVO {
|
||||
private String groupName;
|
||||
private String jobName;
|
||||
private Integer jobStatus;
|
||||
private Long namespaceId;
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,12 @@ public class JobRequestVO {
|
||||
@NotBlank(message = "jobName 不能为空")
|
||||
private String jobName;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
@NotNull(message = "命名空间id 不能为空")
|
||||
private Long namespaceId;
|
||||
|
||||
/**
|
||||
* 重试状态 0、关闭、1、开启
|
||||
*/
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.aizuda.easy.retry.server.web.model.request;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.model.base.BaseQueryVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:21
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class NamespaceQueryVO extends BaseQueryVO {
|
||||
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.aizuda.easy.retry.server.web.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:15
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@Data
|
||||
public class NamespaceRequestVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@NotBlank(message= "name 不能为空")
|
||||
private String name;
|
||||
|
||||
}
|
@ -14,4 +14,5 @@ import lombok.EqualsAndHashCode;
|
||||
public class NotifyConfigQueryVO extends BaseQueryVO {
|
||||
private String groupName;
|
||||
private String sceneName;
|
||||
private Long namespaceId;
|
||||
}
|
||||
|
@ -20,6 +20,12 @@ public class NotifyConfigRequestVO {
|
||||
@Pattern(regexp = "^[A-Za-z0-9_]{1,64}$", message = "仅支持长度为1~64字符且类型为数字、字母和下划线")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 命名空间id
|
||||
*/
|
||||
@NotNull(message = "命名空间id 不能为空")
|
||||
private Long namespaceId;
|
||||
|
||||
private String sceneName;
|
||||
|
||||
@NotNull(message = "通知状态不能为空")
|
||||
|
@ -14,4 +14,5 @@ public class RetryDeadLetterQueryVO extends BaseQueryVO {
|
||||
private String bizNo;
|
||||
private String idempotentId;
|
||||
private String uniqueId;
|
||||
private Long namespaceId;
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.aizuda.easy.retry.server.web.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:39
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@Data
|
||||
public class NamespaceResponseVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 唯一id
|
||||
*/
|
||||
private String uniqueId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createDt;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateDt;
|
||||
|
||||
}
|
@ -23,5 +23,5 @@ public interface GroupConfigService {
|
||||
|
||||
GroupConfigResponseVO getGroupConfigByGroupName(String groupName);
|
||||
|
||||
List<String> getAllGroupNameList();
|
||||
List<String> getAllGroupNameList(final Long namespaceId);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.aizuda.easy.retry.server.web.service;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.NamespaceResponseVO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SystemUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:14
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
public interface NamespaceService {
|
||||
|
||||
Boolean saveNamespace(NamespaceRequestVO namespaceRequestVO);
|
||||
|
||||
Boolean updateNamespace(NamespaceRequestVO namespaceRequestVO);
|
||||
|
||||
PageResult<List<NamespaceResponseVO>> getNamespacePage(NamespaceQueryVO queryVO);
|
||||
|
||||
List<NamespaceResponseVO> getNamespaceByUserId(SystemUser systemUser);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.aizuda.easy.retry.server.web.service.convert;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.model.response.NamespaceResponseVO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Namespace;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 16:20
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
public interface NamespaceResponseVOConverter {
|
||||
|
||||
NamespaceResponseVOConverter INSTANCE = Mappers.getMapper(NamespaceResponseVOConverter.class);
|
||||
|
||||
List<NamespaceResponseVO> toNamespaceResponseVOs(List<Namespace> namespaces);
|
||||
}
|
@ -24,7 +24,6 @@ import com.aizuda.easy.retry.template.datasource.persistence.po.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.jdbc.BadSqlGrammarException;
|
||||
@ -142,8 +141,9 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
public PageResult<List<GroupConfigResponseVO>> getGroupConfigForPage(GroupConfigQueryVO queryVO) {
|
||||
|
||||
LambdaQueryWrapper<GroupConfig> groupConfigLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
groupConfigLambdaQueryWrapper.eq(GroupConfig::getNamespaceId, queryVO.getNamespaceId());
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
groupConfigLambdaQueryWrapper.like(GroupConfig::getGroupName, queryVO.getGroupName());
|
||||
groupConfigLambdaQueryWrapper.like(GroupConfig::getGroupName, queryVO.getGroupName() + "%");
|
||||
}
|
||||
|
||||
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
|
||||
@ -236,10 +236,11 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllGroupNameList() {
|
||||
public List<String> getAllGroupNameList(final Long namespaceId) {
|
||||
ConfigAccess<GroupConfig> groupConfigAccess = accessTemplate.getGroupConfigAccess();
|
||||
|
||||
return groupConfigAccess.list(new LambdaQueryWrapper<GroupConfig>()
|
||||
.eq(GroupConfig::getNamespaceId, namespaceId)
|
||||
.select(GroupConfig::getGroupName)).stream()
|
||||
.map(GroupConfig::getGroupName)
|
||||
.collect(Collectors.toList());
|
||||
|
@ -52,12 +52,13 @@ public class JobBatchServiceImpl implements JobBatchService {
|
||||
|
||||
JobBatchQueryDO jobBatchQueryDO = new JobBatchQueryDO();
|
||||
if (StrUtil.isNotBlank(queryVO.getJobName())) {
|
||||
jobBatchQueryDO.setJobName("%" + queryVO.getJobName() + "%");
|
||||
jobBatchQueryDO.setJobName(queryVO.getJobName() + "%");
|
||||
}
|
||||
|
||||
jobBatchQueryDO.setJobId(queryVO.getJobId());
|
||||
jobBatchQueryDO.setTaskBatchStatus(queryVO.getTaskBatchStatus());
|
||||
jobBatchQueryDO.setGroupName(queryVO.getGroupName());
|
||||
jobBatchQueryDO.setNamespaceId(queryVO.getNamespaceId());
|
||||
List<JobBatchResponseDO> batchResponseDOList = jobTaskBatchMapper.selectJobBatchList(pageDTO, jobBatchQueryDO);
|
||||
|
||||
List<JobBatchResponseVO> batchResponseVOList = JobBatchResponseVOConverter.INSTANCE.toJobBatchResponseVOs(
|
||||
|
@ -61,6 +61,7 @@ public class JobServiceImpl implements JobService {
|
||||
|
||||
LambdaQueryWrapper<Job> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Job::getDeleted, StatusEnum.NO.getStatus());
|
||||
queryWrapper.eq(Job::getNamespaceId, queryVO.getNamespaceId());
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
queryWrapper.eq(Job::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
|
@ -0,0 +1,75 @@
|
||||
package com.aizuda.easy.retry.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
||||
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceRequestVO;
|
||||
import com.aizuda.easy.retry.server.web.model.response.NamespaceResponseVO;
|
||||
import com.aizuda.easy.retry.server.web.service.NamespaceService;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.NamespaceResponseVOConverter;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.NamespaceMapper;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.JobTaskBatch;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Namespace;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.SystemUser;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2023-11-21 15:42
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@Service
|
||||
public class NamespaceServiceImpl implements NamespaceService {
|
||||
|
||||
@Autowired
|
||||
private NamespaceMapper namespaceMapper;
|
||||
|
||||
@Override
|
||||
public Boolean saveNamespace(final NamespaceRequestVO namespaceRequestVO) {
|
||||
Namespace namespace = new Namespace();
|
||||
namespace.setName(namespaceRequestVO.getName());
|
||||
namespace.setUniqueId(IdUtil.simpleUUID());
|
||||
return 1 == namespaceMapper.insert(namespace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateNamespace(final NamespaceRequestVO namespaceRequestVO) {
|
||||
Long id = namespaceRequestVO.getId();
|
||||
Assert.notNull(id, () -> new EasyRetryServerException("参数错误"));
|
||||
|
||||
Namespace namespace = new Namespace();
|
||||
namespace.setName(namespaceRequestVO.getName());
|
||||
namespace.setId(id);
|
||||
return 1 == namespaceMapper.updateById(namespace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<List<NamespaceResponseVO>> getNamespacePage(final NamespaceQueryVO queryVO) {
|
||||
|
||||
PageDTO<Namespace> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
|
||||
LambdaQueryWrapper<Namespace> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(queryVO.getName())) {
|
||||
queryWrapper.like(Namespace::getName, "%" + queryVO.getName() + "%");
|
||||
}
|
||||
|
||||
queryWrapper.eq(Namespace::getDeleted, StatusEnum.NO);
|
||||
|
||||
PageDTO<Namespace> selectPage = namespaceMapper.selectPage(pageDTO, queryWrapper);
|
||||
return new PageResult<>(pageDTO, NamespaceResponseVOConverter.INSTANCE.toNamespaceResponseVOs(selectPage.getRecords()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NamespaceResponseVO> getNamespaceByUserId(final SystemUser systemUser) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
PageDTO<NotifyConfig> pageDTO = new PageDTO<>();
|
||||
|
||||
LambdaQueryWrapper<NotifyConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(NotifyConfig::getNamespaceId, queryVO.getNamespaceId());
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
queryWrapper.eq(NotifyConfig::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user