From 7cbee82d2572041332eb69bc2d0d9c6a93492efe Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期二, 15 十月 2024 11:52:48 +0800 Subject: [PATCH] HttpCollectorIhDB --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/service/impl/ScheduleJobServiceImpl.java | 41 ++++++++++++++++++----------------------- 1 files changed, 18 insertions(+), 23 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/service/impl/ScheduleJobServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/service/impl/ScheduleJobServiceImpl.java index 917cdf2..677e041 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/service/impl/ScheduleJobServiceImpl.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/service/impl/ScheduleJobServiceImpl.java @@ -1,25 +1,20 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - package com.iailab.module.data.job.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.constant.Constant; import com.iailab.framework.common.page.PageData; +import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; -import com.iailab.module.data.job.entity.ScheduleJobEntity; +import com.iailab.framework.security.core.util.SecurityFrameworkUtils; +import com.iailab.framework.tenant.core.context.TenantContextHolder; import com.iailab.module.data.job.entity.ScheduleJobEntity; import com.iailab.module.data.job.dao.ScheduleJobDao; import com.iailab.module.data.job.dto.ScheduleJobDTO; import com.iailab.module.data.job.service.ScheduleJobService; import com.iailab.module.data.job.utils.ScheduleUtils; +import com.iailab.module.data.job.vo.ScheduleJobReqVO; import org.apache.commons.lang3.StringUtils; import org.quartz.Scheduler; import javax.annotation.Resource; @@ -37,12 +32,8 @@ private Scheduler scheduler; @Override - public PageData<ScheduleJobDTO> page(Map<String, Object> params) { - IPage<ScheduleJobEntity> page = baseDao.selectPage( - getPage(params, Constant.CREATE_DATE, false), - getWrapper(params) - ); - return getPageData(page, ScheduleJobDTO.class); + public PageResult<ScheduleJobEntity> page(ScheduleJobReqVO reqVO) { + return baseDao.selectPage(reqVO); } @Override @@ -64,9 +55,13 @@ @Override @Transactional(rollbackFor = Exception.class) public void save(ScheduleJobDTO dto) { + Long tenantId = TenantContextHolder.getRequiredTenantId(); ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class); - entity.setCreateDate(new Date()); + entity.setId(System.currentTimeMillis()); entity.setStatus(Constant.ScheduleStatus.NORMAL.getValue()); + entity.setTenantId(tenantId); + entity.setCreator(SecurityFrameworkUtils.getLoginUser().getId()); + entity.setCreateDate(new Date()); this.insert(entity); ScheduleUtils.createScheduleJob(scheduler, entity); @@ -75,8 +70,11 @@ @Override @Transactional(rollbackFor = Exception.class) public void update(ScheduleJobDTO dto) { + Long tenantId = TenantContextHolder.getRequiredTenantId(); ScheduleJobEntity entity = ConvertUtils.sourceToTarget(dto, ScheduleJobEntity.class); entity.setUpdateDate(new Date()); + entity.setUpdater(SecurityFrameworkUtils.getLoginUser().getId()); + entity.setTenantId(tenantId); ScheduleUtils.updateScheduleJob(scheduler, entity); this.updateById(entity); @@ -84,13 +82,10 @@ @Override @Transactional(rollbackFor = Exception.class) - public void deleteBatch(Long[] ids) { - for(Long id : ids){ - ScheduleUtils.deleteScheduleJob(scheduler, id); - } - - //删除数据 - this.deleteBatchIds(Arrays.asList(ids)); + public void deleteBatch(Long id) { + ScheduleUtils.deleteScheduleJob(scheduler, id); + + baseDao.deleteById(id); } @Override -- Gitblit v1.9.3