feat:(1.3.0-beta1): 1.修复owner_id拼写错误 2.维护snail_job_mysql脚本

This commit is contained in:
opensnail 2024-12-27 21:44:54 +08:00
parent d19635b3e4
commit 9cfb76adde
5 changed files with 17 additions and 13 deletions

View File

@ -50,7 +50,7 @@ CREATE TABLE `sj_notify_config`
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` varchar(64) NOT NULL COMMENT '组名称',
`business_id` varchar(64) NOT NULL COMMENT '业务id (job_id或workflow_id或scene_name)',
`notify_name` varchar(64) NOT NULL DEFAULT '' COMMENT '通知名称',
`system_task_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '任务类型 1. 重试任务 2. 重试回调 3、JOB任务 4、WORKFLOW任务',
`notify_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '通知状态 0、未启用 1、启用',
`recipient_ids` varchar(128) NOT NULL COMMENT '接收人id列表',
@ -198,6 +198,7 @@ CREATE TABLE `sj_retry_scene_config`
`max_retry_count` int(11) NOT NULL DEFAULT 5 COMMENT '最大重试次数',
`back_off` tinyint(4) NOT NULL DEFAULT 1 COMMENT '1、默认等级 2、固定间隔时间 3、CRON 表达式',
`trigger_interval` varchar(16) NOT NULL DEFAULT '' COMMENT '间隔时长',
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
`deadline_request` bigint(20) unsigned NOT NULL DEFAULT 60000 COMMENT 'Deadline Request 调用链超时 单位毫秒',
`executor_timeout` int(11) unsigned NOT NULL DEFAULT 5 COMMENT '任务执行超时时间,单位秒',
`route_key` tinyint(4) NOT NULL DEFAULT 4 COMMENT '路由策略',
@ -314,6 +315,8 @@ CREATE TABLE `sj_job`
`retry_interval` int(11) NOT NULL DEFAULT 0 COMMENT '重试间隔(s)',
`bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
`resident` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是常驻任务',
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
`owner_id` bigint(20) NULL COMMENT '负责人id',
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',
`deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '逻辑删除 1、删除',
@ -463,6 +466,7 @@ CREATE TABLE `sj_workflow`
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
`flow_info` text DEFAULT NULL COMMENT '流程信息',
`wf_context` text DEFAULT NULL COMMENT '上下文',
`notify_ids` varchar(128) NOT NULL DEFAULT '' COMMENT '通知告警场景配置id列表',
`bucket_index` int(11) NOT NULL DEFAULT 0 COMMENT 'bucket',
`version` int(11) NOT NULL COMMENT '版本号',
`ext_attrs` varchar(256) NULL DEFAULT '' COMMENT '扩展字段',

View File

@ -150,6 +150,6 @@ public class Job extends CreateUpdateDt {
/**
* 负责人id
*/
private Long owerId;
private Long ownerId;
}

View File

@ -133,6 +133,6 @@ public class JobRequestVO {
/**
* 负责人id
*/
private Long owerId;
private Long ownerId;
}

View File

@ -138,8 +138,8 @@ public class JobResponseVO {
/**
* 负责人名称
*/
private String owerName;
private Long owerId;
private String ownerName;
private Long ownerId;
}

View File

@ -91,13 +91,13 @@ public class JobServiceImpl implements JobService {
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
List<String> groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName());
Set<Long> owerIds = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>()
Set<Long> ownerIds = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>()
.select(SystemUser::getId)
.likeRight(SystemUser::getUsername, queryVO.getOwerName()))
.stream()
.map(i -> i.getId())
.collect(Collectors.toSet());
if (CollUtil.isEmpty(owerIds) && StrUtil.isNotBlank(queryVO.getOwerName())) {
if (CollUtil.isEmpty(ownerIds) && StrUtil.isNotBlank(queryVO.getOwerName())) {
return new PageResult<>(pageDTO, Lists.newArrayList());
}
@ -110,14 +110,14 @@ public class JobServiceImpl implements JobService {
StrUtil.trim(queryVO.getExecutorInfo()))
.eq(Objects.nonNull(queryVO.getJobStatus()), Job::getJobStatus, queryVO.getJobStatus())
.eq(Job::getDeleted, StatusEnum.NO.getStatus())
.in(CollUtil.isNotEmpty(owerIds), Job::getOwerId, owerIds)
.in(CollUtil.isNotEmpty(ownerIds), Job::getOwnerId, ownerIds)
.orderByDesc(Job::getId));
List<JobResponseVO> jobResponseList = JobResponseVOConverter.INSTANCE.convertList(selectPage.getRecords());
for (JobResponseVO jobResponseVO : jobResponseList) {
SystemUser systemUser = systemUserMapper.selectById(jobResponseVO.getOwerId());
SystemUser systemUser = systemUserMapper.selectById(jobResponseVO.getOwnerId());
if (Objects.nonNull(systemUser)) {
jobResponseVO.setOwerName(systemUser.getUsername());
jobResponseVO.setOwnerName(systemUser.getUsername());
}
}
return new PageResult<>(pageDTO, jobResponseList);
@ -162,7 +162,7 @@ public class JobServiceImpl implements JobService {
job.setNextTriggerAt(calculateNextTriggerAt(jobRequestVO, DateUtils.toNowMilli()));
job.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
job.setNotifyIds(JsonUtil.toJsonString(jobRequestVO.getNotifyIds()));
job.setOwerId(jobRequestVO.getOwerId());
job.setOwnerId(jobRequestVO.getOwnerId());
job.setId(null);
return 1 == jobMapper.insert(job);
}
@ -177,7 +177,7 @@ public class JobServiceImpl implements JobService {
// 判断常驻任务
Job updateJob = JobConverter.INSTANCE.convert(jobRequestVO);
updateJob.setNotifyIds(JsonUtil.toJsonString(jobRequestVO.getNotifyIds()));
updateJob.setOwerId(jobRequestVO.getOwerId());
updateJob.setOwnerId(jobRequestVO.getOwnerId());
updateJob.setResident(isResident(jobRequestVO));
updateJob.setNamespaceId(job.getNamespaceId());