diff --git a/core/core-backend/src/main/java/io/dataease/commons/utils/CronUtils.java b/core/core-backend/src/main/java/io/dataease/commons/utils/CronUtils.java index f23cff758b..f396f5df1d 100644 --- a/core/core-backend/src/main/java/io/dataease/commons/utils/CronUtils.java +++ b/core/core-backend/src/main/java/io/dataease/commons/utils/CronUtils.java @@ -1,6 +1,6 @@ package io.dataease.commons.utils; -import io.dataease.task.dao.auto.entity.CoreSysTask; +import io.dataease.utils.LogUtil; import org.apache.commons.lang3.ObjectUtils; import org.quartz.CronExpression; import org.quartz.CronScheduleBuilder; @@ -12,19 +12,9 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; -/** - * @author song.tianyang - * @Date 2020/12/17 4:06 下午 - * @Description CRON解析类 - */ public class CronUtils { - /** - * 解析表达式,获取CronTrigger - * - * @param cron - * @return - */ + public static CronTrigger getCronTrigger(String cron) { if (!CronExpression.isValidExpression(cron)) { throw new RuntimeException("cron :" + cron + "表达式解析错误"); @@ -32,28 +22,6 @@ public class CronUtils { return TriggerBuilder.newTrigger().withIdentity("Calculate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build(); } - /** - * 获取以指定时间为开始时间的下一次执行时间 - * - * @param cron - * @param start - * @return - */ - public static Date getNextTriggerTime(String cron, Date start) { - if (start == null) { - return getNextTriggerTime(cron); - } else { - CronTrigger trigger = getCronTrigger(cron); - return trigger.getFireTimeAfter(start); - } - } - - /** - * 获取以当前日期为准的下一次执行时间 - * - * @param cron - * @return - */ public static Date getNextTriggerTime(String cron) { Date date = null; try { @@ -61,38 +29,39 @@ public class CronUtils { Date startDate = trigger.getStartTime(); date = trigger.getFireTimeAfter(startDate); } catch (Exception e) { - + LogUtil.error(e.getMessage(), e); } return date; } - public static String cron(CoreSysTask taskEntity) { - if (taskEntity.getRateType() == -1) { - return taskEntity.getRateVal(); + public static String cron(Integer rateType, String rateVal) { + if (rateType == 0) { + return rateVal; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = null; try { - date = sdf.parse(taskEntity.getRateVal()); + date = sdf.parse(rateVal); } catch (ParseException e) { e.printStackTrace(); } Calendar instance = Calendar.getInstance(); + assert date != null; instance.setTime(date); - if (taskEntity.getRateType() == 0) { + if (rateType == 1) { return instance.get(Calendar.SECOND) + " " + instance.get(Calendar.MINUTE) + " " + instance.get(Calendar.HOUR_OF_DAY) + " * * ?"; } - if (taskEntity.getRateType() == 1) { + if (rateType == 2) { return instance.get(Calendar.SECOND) + " " + instance.get(Calendar.MINUTE) + " " + instance.get(Calendar.HOUR_OF_DAY) + " ? * " + getDayOfWeek(instance); } - if (taskEntity.getRateType() == 2) { + if (rateType == 3) { return instance.get(Calendar.SECOND) + " " + instance.get(Calendar.MINUTE) + " " + instance.get(Calendar.HOUR_OF_DAY) + " " + @@ -102,13 +71,6 @@ public class CronUtils { return null; } - public static String cron() { - Calendar instance = Calendar.getInstance(); - instance.add(Calendar.SECOND, 5); - return instance.get(Calendar.SECOND) + " " + - instance.get(Calendar.MINUTE) + " " + - instance.get(Calendar.HOUR_OF_DAY) + " * * ?"; - } private static String getDayOfWeek(Calendar instance) { int index = instance.get(Calendar.DAY_OF_WEEK); @@ -120,7 +82,7 @@ public class CronUtils { public static Boolean taskExpire(Long endTime) { if (ObjectUtils.isEmpty(endTime)) return false; - Long now = System.currentTimeMillis(); + long now = System.currentTimeMillis(); return now > endTime; } diff --git a/core/core-backend/src/main/java/io/dataease/datasource/manage/DatasourceSyncManage.java b/core/core-backend/src/main/java/io/dataease/datasource/manage/DatasourceSyncManage.java index 13f8192082..d2a98d3cf3 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/manage/DatasourceSyncManage.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/manage/DatasourceSyncManage.java @@ -18,11 +18,9 @@ import io.dataease.datasource.request.DatasourceRequest; import io.dataease.datasource.request.EngineRequest; import io.dataease.datasource.server.DatasourceServer; import io.dataease.datasource.server.DatasourceTaskServer; -import io.dataease.datasource.server.EngineServer; import io.dataease.exception.DEException; -import io.dataease.job.sechedule.ExtractDataJob; -import io.dataease.job.sechedule.ScheduleManager; -import io.dataease.utils.JsonUtil; +import io.dataease.job.schedule.ExtractDataJob; +import io.dataease.job.schedule.ScheduleManager; import io.dataease.utils.LogUtil; import jakarta.annotation.Resource; import org.apache.commons.lang3.StringUtils; diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index c393560ee9..05923ea7d3 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -35,8 +35,8 @@ import io.dataease.datasource.request.DatasourceRequest; import io.dataease.engine.constant.SQLConstants; import io.dataease.exception.DEException; import io.dataease.i18n.Translator; -import io.dataease.job.sechedule.CheckDsStatusJob; -import io.dataease.job.sechedule.ScheduleManager; +import io.dataease.job.schedule.CheckDsStatusJob; +import io.dataease.job.schedule.ScheduleManager; import io.dataease.license.config.XpackInteract; import io.dataease.log.DeLog; import io.dataease.model.BusiNodeRequest; diff --git a/core/core-backend/src/main/java/io/dataease/job/sechedule/CheckDsStatusJob.java b/core/core-backend/src/main/java/io/dataease/job/schedule/CheckDsStatusJob.java similarity index 83% rename from core/core-backend/src/main/java/io/dataease/job/sechedule/CheckDsStatusJob.java rename to core/core-backend/src/main/java/io/dataease/job/schedule/CheckDsStatusJob.java index 71c63b3b70..54cbd97a2e 100644 --- a/core/core-backend/src/main/java/io/dataease/job/sechedule/CheckDsStatusJob.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/CheckDsStatusJob.java @@ -1,11 +1,13 @@ -package io.dataease.job.sechedule; +package io.dataease.job.schedule; import io.dataease.datasource.server.DatasourceServer; import io.dataease.utils.CommonBeanFactory; import io.dataease.utils.LogUtil; import jakarta.annotation.Resource; -import org.quartz.*; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; import org.springframework.stereotype.Component; @Component diff --git a/core/core-backend/src/main/java/io/dataease/job/sechedule/DeScheduleJob.java b/core/core-backend/src/main/java/io/dataease/job/schedule/DeScheduleJob.java similarity index 96% rename from core/core-backend/src/main/java/io/dataease/job/sechedule/DeScheduleJob.java rename to core/core-backend/src/main/java/io/dataease/job/schedule/DeScheduleJob.java index a6336d567a..029036ecc0 100644 --- a/core/core-backend/src/main/java/io/dataease/job/sechedule/DeScheduleJob.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/DeScheduleJob.java @@ -1,4 +1,4 @@ -package io.dataease.job.sechedule; +package io.dataease.job.schedule; import io.dataease.utils.LogUtil; import org.quartz.*; diff --git a/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java b/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java new file mode 100644 index 0000000000..ffa7d2b056 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java @@ -0,0 +1,45 @@ +package io.dataease.job.schedule; + +import io.dataease.commons.utils.CronUtils; +import io.dataease.license.config.XpackInteract; +import jakarta.annotation.Resource; +import org.apache.commons.lang3.ObjectUtils; +import org.quartz.JobDataMap; +import org.quartz.JobKey; +import org.quartz.TriggerKey; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Component +public class DeTaskExecutor { + + @Resource + private ScheduleManager scheduleManager; + + @XpackInteract(value = "xpackTaskExecutor", replace = true) + public boolean execute(Long taskId) { + return false; + } + + public void addOrUpdateTask(Long taskId, String cron, Long startTime, Long endTime) { + if (CronUtils.taskExpire(endTime)) { + return; + } + String key = taskId.toString(); + JobKey jobKey = new JobKey(key, key); + TriggerKey triggerKey = new TriggerKey(key, key); + JobDataMap jobDataMap = new JobDataMap(); + jobDataMap.put("taskId", taskId); + Date end = null; + if (ObjectUtils.isNotEmpty(endTime)) end = new Date(endTime); + scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, DeXpackScheduleJob.class, cron, new Date(startTime), end, jobDataMap); + } + + public void removeTask(Long taskId) { + String key = taskId.toString(); + JobKey jobKey = new JobKey(key); + TriggerKey triggerKey = new TriggerKey(key); + scheduleManager.removeJob(jobKey, triggerKey); + } +} diff --git a/core/core-backend/src/main/java/io/dataease/job/schedule/DeXpackScheduleJob.java b/core/core-backend/src/main/java/io/dataease/job/schedule/DeXpackScheduleJob.java new file mode 100644 index 0000000000..2a0f1903b1 --- /dev/null +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/DeXpackScheduleJob.java @@ -0,0 +1,24 @@ +package io.dataease.job.schedule; + +import io.dataease.utils.CommonBeanFactory; +import jakarta.annotation.Resource; +import org.quartz.*; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +@Component +public class DeXpackScheduleJob implements Job { + @Resource + private DeTaskExecutor deTaskExecutor; + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + Trigger trigger = jobExecutionContext.getTrigger(); + JobKey jobKey = trigger.getJobKey(); + JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); + Long taskId = jobDataMap.getLong("taskId"); + if (!deTaskExecutor.execute(taskId)) { + Objects.requireNonNull(CommonBeanFactory.getBean(ScheduleManager.class)).removeJob(jobKey, trigger.getKey()); + } + } +} diff --git a/core/core-backend/src/main/java/io/dataease/job/sechedule/ExtractDataJob.java b/core/core-backend/src/main/java/io/dataease/job/schedule/ExtractDataJob.java similarity index 79% rename from core/core-backend/src/main/java/io/dataease/job/sechedule/ExtractDataJob.java rename to core/core-backend/src/main/java/io/dataease/job/schedule/ExtractDataJob.java index 729ef22f7f..0ffbaae2b7 100644 --- a/core/core-backend/src/main/java/io/dataease/job/sechedule/ExtractDataJob.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/ExtractDataJob.java @@ -1,14 +1,13 @@ -package io.dataease.job.sechedule; +package io.dataease.job.schedule; import io.dataease.datasource.manage.DatasourceSyncManage; -import io.dataease.datasource.server.DatasourceServer; import io.dataease.utils.CommonBeanFactory; import org.quartz.JobExecutionContext; import org.springframework.stereotype.Component; @Component -public class ExtractDataJob extends DeScheduleJob{ +public class ExtractDataJob extends DeScheduleJob { private DatasourceSyncManage datasourceSyncManage; public ExtractDataJob() { diff --git a/core/core-backend/src/main/java/io/dataease/job/sechedule/Schedular.java b/core/core-backend/src/main/java/io/dataease/job/schedule/Schedular.java similarity index 92% rename from core/core-backend/src/main/java/io/dataease/job/sechedule/Schedular.java rename to core/core-backend/src/main/java/io/dataease/job/schedule/Schedular.java index cb42755571..88de462f25 100644 --- a/core/core-backend/src/main/java/io/dataease/job/sechedule/Schedular.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/Schedular.java @@ -1,4 +1,4 @@ -package io.dataease.job.sechedule; +package io.dataease.job.schedule; import com.fit2cloud.quartz.anno.QuartzScheduled; import io.dataease.datasource.server.DatasourceServer; @@ -6,7 +6,6 @@ import jakarta.annotation.Resource; import org.springframework.stereotype.Component; - @Component public class Schedular { diff --git a/core/core-backend/src/main/java/io/dataease/job/sechedule/ScheduleManager.java b/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java similarity index 94% rename from core/core-backend/src/main/java/io/dataease/job/sechedule/ScheduleManager.java rename to core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java index 8231f94386..6691644506 100644 --- a/core/core-backend/src/main/java/io/dataease/job/sechedule/ScheduleManager.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java @@ -1,4 +1,4 @@ -package io.dataease.job.sechedule; +package io.dataease.job.schedule; import io.dataease.exception.DEException; @@ -8,7 +8,6 @@ import jakarta.annotation.Resource; import org.quartz.*; import org.springframework.stereotype.Component; - import java.util.Date; import java.util.HashMap; import java.util.List; @@ -31,7 +30,7 @@ public class ScheduleManager { * @throws SchedulerException */ public void addSimpleJob(JobKey jobKey, TriggerKey triggerKey, Class cls, int repeatIntervalTime, - JobDataMap jobDataMap) throws SchedulerException { + JobDataMap jobDataMap) throws SchedulerException { JobBuilder jobBuilder = JobBuilder.newJob(cls).withIdentity(jobKey); @@ -64,7 +63,7 @@ public class ScheduleManager { * @param jobDataMap */ public void addCronJob(JobKey jobKey, TriggerKey triggerKey, Class jobClass, String cron, Date startTime, - Date endTime, JobDataMap jobDataMap) { + Date endTime, JobDataMap jobDataMap) { try { LogUtil.info("addCronJob: " + triggerKey.getName() + "," + triggerKey.getGroup()); @@ -105,7 +104,7 @@ public class ScheduleManager { } public void addCronJob(JobKey jobKey, TriggerKey triggerKey, Class jobClass, String cron, Date startTime, - Date endTime) { + Date endTime) { addCronJob(jobKey, triggerKey, jobClass, cron, startTime, endTime, null); } @@ -315,7 +314,7 @@ public class ScheduleManager { * @throws SchedulerException */ public void addOrUpdateSimpleJob(JobKey jobKey, TriggerKey triggerKey, Class clz, - int intervalTime, JobDataMap jobDataMap) throws SchedulerException { + int intervalTime, JobDataMap jobDataMap) throws SchedulerException { if (scheduler.checkExists(triggerKey)) { modifySimpleJobTime(triggerKey, intervalTime); @@ -326,20 +325,20 @@ public class ScheduleManager { } public void addOrUpdateSingleJob(JobKey jobKey, TriggerKey triggerKey, Class clz, - Date date, JobDataMap jobDataMap) throws DEException { + Date date, JobDataMap jobDataMap) throws DEException { try { if (scheduler.checkExists(triggerKey)) { modifySingleJobTime(triggerKey, date); } else { addSingleJob(jobKey, triggerKey, clz, date, jobDataMap); } - }catch (Exception e){ + } catch (Exception e) { DEException.throwException(e); } } public void addOrUpdateSingleJob(JobKey jobKey, TriggerKey triggerKey, Class clz, - Date date) throws SchedulerException { + Date date) throws SchedulerException { addOrUpdateSingleJob(jobKey, triggerKey, clz, date, null); } @@ -359,7 +358,7 @@ public class ScheduleManager { * @throws SchedulerException */ public void addOrUpdateCronJob(JobKey jobKey, TriggerKey triggerKey, Class jobClass, String cron, Date startTime, - Date endTime, JobDataMap jobDataMap) throws DEException { + Date endTime, JobDataMap jobDataMap) throws DEException { LogUtil.info("AddOrUpdateCronJob: " + jobKey.getName() + "," + triggerKey.getGroup()); try { @@ -368,13 +367,13 @@ public class ScheduleManager { } else { addCronJob(jobKey, triggerKey, jobClass, cron, startTime, endTime, jobDataMap); } - }catch (Exception e){ + } catch (Exception e) { DEException.throwException(e); } } public void addOrUpdateCronJob(JobKey jobKey, TriggerKey triggerKey, Class jobClass, String cron, Date startTime, - Date endTime) throws SchedulerException { + Date endTime) throws SchedulerException { addOrUpdateCronJob(jobKey, triggerKey, jobClass, cron, startTime, endTime, null); } diff --git a/core/core-backend/src/main/java/io/dataease/task/dao/auto/entity/CoreSysTask.java b/core/core-backend/src/main/java/io/dataease/task/dao/auto/entity/CoreSysTask.java deleted file mode 100644 index c906457fd4..0000000000 --- a/core/core-backend/src/main/java/io/dataease/task/dao/auto/entity/CoreSysTask.java +++ /dev/null @@ -1,167 +0,0 @@ -package io.dataease.task.dao.auto.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; - -/** - *

- * - *

- * - * @author fit2cloud - * @since 2023-04-12 - */ -@TableName("core_sys_task") -public class CoreSysTask implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 任务ID - */ - @TableId(value = "task_id", type = IdType.AUTO) - private Long taskId; - - /** - * 任务名称 - */ - private String taskName; - - /** - * 任务类型 - */ - private String taskType; - - /** - * 开始时间 - */ - private Long startTime; - - /** - * 结束时间 - */ - private Long endTime; - - /** - * 频率方式 - */ - private Integer rateType; - - /** - * 频率值 - */ - private String rateVal; - - /** - * 创建者ID - */ - private Long creator; - - /** - * 创建时间 - */ - private Long createTime; - - /** - * 运行状态 - */ - private Boolean status; - - public Long getTaskId() { - return taskId; - } - - public void setTaskId(Long taskId) { - this.taskId = taskId; - } - - public String getTaskName() { - return taskName; - } - - public void setTaskName(String taskName) { - this.taskName = taskName; - } - - public String getTaskType() { - return taskType; - } - - public void setTaskType(String taskType) { - this.taskType = taskType; - } - - public Long getStartTime() { - return startTime; - } - - public void setStartTime(Long startTime) { - this.startTime = startTime; - } - - public Long getEndTime() { - return endTime; - } - - public void setEndTime(Long endTime) { - this.endTime = endTime; - } - - public Integer getRateType() { - return rateType; - } - - public void setRateType(Integer rateType) { - this.rateType = rateType; - } - - public String getRateVal() { - return rateVal; - } - - public void setRateVal(String rateVal) { - this.rateVal = rateVal; - } - - public Long getCreator() { - return creator; - } - - public void setCreator(Long creator) { - this.creator = creator; - } - - public Long getCreateTime() { - return createTime; - } - - public void setCreateTime(Long createTime) { - this.createTime = createTime; - } - - public Boolean getStatus() { - return status; - } - - public void setStatus(Boolean status) { - this.status = status; - } - - @Override - public String toString() { - return "CoreSysTask{" + - "taskId = " + taskId + - ", taskName = " + taskName + - ", taskType = " + taskType + - ", startTime = " + startTime + - ", endTime = " + endTime + - ", rateType = " + rateType + - ", rateVal = " + rateVal + - ", creator = " + creator + - ", createTime = " + createTime + - ", status = " + status + - "}"; - } -} diff --git a/core/core-backend/src/main/java/io/dataease/task/dao/auto/mapper/CoreSysTaskMapper.java b/core/core-backend/src/main/java/io/dataease/task/dao/auto/mapper/CoreSysTaskMapper.java deleted file mode 100644 index f44d0878dc..0000000000 --- a/core/core-backend/src/main/java/io/dataease/task/dao/auto/mapper/CoreSysTaskMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.dataease.task.dao.auto.mapper; - -import io.dataease.task.dao.auto.entity.CoreSysTask; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author fit2cloud - * @since 2023-04-12 - */ -public interface CoreSysTaskMapper extends BaseMapper { - -} diff --git a/core/core-backend/src/main/resources/i18n/core_zh_CN.properties b/core/core-backend/src/main/resources/i18n/core_zh_CN.properties index f3b366becc..4fc8609f59 100644 --- a/core/core-backend/src/main/resources/i18n/core_zh_CN.properties +++ b/core/core-backend/src/main/resources/i18n/core_zh_CN.properties @@ -18,6 +18,7 @@ i18n_menu.datasource=\u6570\u636E\u6E90 i18n_menu.user=\u7528\u6237\u7BA1\u7406 i18n_menu.org=\u7EC4\u7EC7\u7BA1\u7406 i18n_menu.auth=\u6743\u9650\u914D\u7F6E +i18n_menu.report=\u5B9A\u65F6\u62A5\u544A i18n_menu.sync=\u540C\u6B65\u7BA1\u7406 i18n_menu.summary=\u6982\u89C8 i18n_menu.ds=\u6570\u636E\u8FDE\u63A5\u7BA1\u7406 diff --git a/core/core-frontend/src/assets/svg/report.svg b/core/core-frontend/src/assets/svg/report.svg new file mode 100644 index 0000000000..50204b1d74 --- /dev/null +++ b/core/core-frontend/src/assets/svg/report.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 0be8929032..00ff342c48 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -2242,5 +2242,42 @@ export default { appearance: { give_up: '放弃更新', save_apply: '保存并应用' + }, + report: { + title: '定时报告', + task_name: '任务名称', + last_exec_time: '上次执行时间', + last_exec_result: '上次执行结果', + task_status: '任务状态', + next_exec_time: '下次执行时间', + creator: '创建人', + create_time: '创建时间', + status_wait: '等待发送', + status_stop: '任务停止', + status_finish: '任务结束', + status_send: '发送中', + search_tips: '通过任务名称搜索', + report_title: '任务列表', + instance_title: '任务日志', + add_task: '添加任务', + lark_groups: '飞书群', + send_setting: '发送设置', + start_time: '开始时间', + end_time: '结束时间', + once_a_day: '每天', + once_a_week: '每周', + once_a_month: '每月', + week_mon: '一', + week_tue: '二', + week_wed: '三', + week_thu: '四', + week_fri: '五', + week_sat: '六', + week_sun: '日', + every_exec: '执行一次', + date: '日', + last_status_running: '运行中', + last_status_fail: '失败', + last_status_success: '成功' } } diff --git a/de-xpack b/de-xpack index fb7d5598b6..22e8ad631b 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit fb7d5598b6c23469dac21c5cefc4d388c27236fc +Subproject commit 22e8ad631b05f078920385f440ae97561fa8c351 diff --git a/installer/dataease/docker-compose-selenium.yml b/installer/dataease/docker-compose-selenium.yml new file mode 100644 index 0000000000..5bea38f1f0 --- /dev/null +++ b/installer/dataease/docker-compose-selenium.yml @@ -0,0 +1,13 @@ +version: '2.1' +services: + de-selenium: + image: selenium/standalone-chrome:latest + container_name: de-selenium + shm_size: 2gb + environment: + - SE_START_XVFB=false + - SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true + ports: + - "4444:4444" + networks: + - dataease-network \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6345bb8fd1..70b8952b8f 100644 --- a/pom.xml +++ b/pom.xml @@ -42,10 +42,17 @@ 1.3.0 3.3.1 3.1.0 + 31.1-jre + + com.google.guava + guava + ${guava.version} + import + com.alibaba.cloud spring-cloud-alibaba-dependencies @@ -106,6 +113,7 @@ easyexcel ${easyexcel.version} + diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/ReportApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/ReportApi.java new file mode 100644 index 0000000000..7f404c01fe --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/ReportApi.java @@ -0,0 +1,73 @@ +package io.dataease.api.report; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.api.report.dto.*; +import io.dataease.api.report.vo.ReportGridVO; +import io.dataease.api.report.vo.ReportInstanceVO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +@Tag(name = "定时报告") +@ApiSupport(order = 888, author = "fit2cloud-someone") +public interface ReportApi { + + @Operation(summary = "查询报告列表") + @Parameters({ + @Parameter(name = "goPage", description = "目标页码", required = true, in = ParameterIn.PATH), + @Parameter(name = "pageSize", description = "每页容量", required = true, in = ParameterIn.PATH), + @Parameter(name = "request", description = "过滤条件", required = true) + }) + @PostMapping("/pager/{goPage}/{pageSize}") + IPage pager(@PathVariable("goPage") int goPage, @PathVariable("pageSize") int pageSize, @RequestBody ReportGridRequest request); + + @Operation(summary = "创建任务") + @PostMapping("/create") + void create(@RequestBody ReportCreator creator); + + @Operation(summary = "更新任务") + @PostMapping("/update") + void update(@RequestBody ReportEditor editor); + + @Operation(summary = "立即运行") + @PostMapping("/fireNow/{taskId}") + void fireNow(@PathVariable("taskId") Long taskId); + + @Operation(summary = "停止") + @PostMapping("/stop/{taskId}") + void stopNow(@PathVariable("taskId") Long taskId); + + @Operation(summary = "删除") + @PostMapping("/delete") + void delete(@RequestBody List taskIdList); + + + @Operation(summary = "查询详情") + @GetMapping("/info/{taskId}") + ReportEditor info(@PathVariable("taskId") Long taskId); + + @Operation(summary = "查询日志列表") + @Parameters({ + @Parameter(name = "goPage", description = "目标页码", required = true, in = ParameterIn.PATH), + @Parameter(name = "pageSize", description = "每页容量", required = true, in = ParameterIn.PATH), + @Parameter(name = "request", description = "过滤条件", required = true) + }) + @PostMapping("/logPager/{goPage}/{pageSize}") + IPage pager(@PathVariable("goPage") int goPage, @PathVariable("pageSize") int pageSize, @RequestBody ReportInstanceRequest request); + + @Operation(summary = "删除日志") + @PostMapping("/deleteLog") + void deleteInstance(@RequestBody ReportInstanceDelRequest request); + + @GetMapping("/logMsg") + String logMsg(@RequestBody ReportInstanceMsgRequest request); +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java new file mode 100644 index 0000000000..1d969e7281 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportCreator.java @@ -0,0 +1,54 @@ +package io.dataease.api.report.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +public class ReportCreator implements Serializable { + @Serial + private static final long serialVersionUID = 376997744239219719L; + + private String name; + + private String title; + + private String content; + + private Integer rtid; + + @JsonSerialize(using= ToStringSerializer.class) + private Long rid; + + private Integer format; + + private List viewIdList; + + private Integer viewDataRange; + + private String pixel; + + private List reciFlagList; + + private List uidList; + + private List ridList; + + private List emailList; + + private List larkGroupList; + + private Integer extWaitTime; + + private Integer rateType; + + private String rateVal; + + private Long startTime; + + private Long endTime; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportEditor.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportEditor.java new file mode 100644 index 0000000000..830f954855 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportEditor.java @@ -0,0 +1,19 @@ +package io.dataease.api.report.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +@EqualsAndHashCode(callSuper = true) +@Data +public class ReportEditor extends ReportCreator{ + + @Serial + private static final long serialVersionUID = 4580864230335912932L; + @JsonSerialize(using= ToStringSerializer.class) + private Long taskId; + +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportGridRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportGridRequest.java new file mode 100644 index 0000000000..4b0c2fa3a2 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportGridRequest.java @@ -0,0 +1,25 @@ +package io.dataease.api.report.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +public class ReportGridRequest implements Serializable { + @Serial + private static final long serialVersionUID = 3478936079850972546L; + + private List uidList; + + private List lastStatusList; + + private List statusList; + + private List timeList; + + private String keyword; + + private Boolean timeDesc; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceDelRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceDelRequest.java new file mode 100644 index 0000000000..9ce461b76b --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceDelRequest.java @@ -0,0 +1,16 @@ +package io.dataease.api.report.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class ReportInstanceDelRequest implements Serializable { + @Serial + private static final long serialVersionUID = 3972312402268432597L; + + private Long instanceId; + + private Integer timeFlag; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceMsgRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceMsgRequest.java new file mode 100644 index 0000000000..c541552ceb --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceMsgRequest.java @@ -0,0 +1,16 @@ +package io.dataease.api.report.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class ReportInstanceMsgRequest implements Serializable { + @Serial + private static final long serialVersionUID = 7192222037770564561L; + + private Long taskId; + + private Long instanceId; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceRequest.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceRequest.java new file mode 100644 index 0000000000..26bc814ad6 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/dto/ReportInstanceRequest.java @@ -0,0 +1,21 @@ +package io.dataease.api.report.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +public class ReportInstanceRequest implements Serializable { + @Serial + private static final long serialVersionUID = 6928403022356816279L; + + private Long taskId; + + private List execStatusList; + + private List timeList; + + private String keyword; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportGridVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportGridVO.java new file mode 100644 index 0000000000..50c7d59ff9 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportGridVO.java @@ -0,0 +1,31 @@ +package io.dataease.api.report.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class ReportGridVO implements Serializable { + + @Serial + private static final long serialVersionUID = -5178055146669970633L; + @JsonSerialize(using= ToStringSerializer.class) + private Long id; + + private String name; + + private Long lastExecTime; + + private Integer lastExecStatus; + + private Integer status; + + private Long nextExecTime; + + private String creator; + + private Long createTime; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportInstanceVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportInstanceVO.java new file mode 100644 index 0000000000..8f7bb8554a --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/report/vo/ReportInstanceVO.java @@ -0,0 +1,20 @@ +package io.dataease.api.report.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +@Data +public class ReportInstanceVO implements Serializable { + @Serial + private static final long serialVersionUID = -7845204306008848053L; + + private Long id; + + private String name; + + private Long startTime; + + private Integer execStatus; +} diff --git a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java index 8312e307f0..27b379bef3 100644 --- a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java +++ b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/user/api/UserApi.java @@ -79,6 +79,10 @@ public interface UserApi { @PostMapping("/role/option") List optionForRole(@RequestBody UserRequest request); + @Operation(summary = "组织内用户") + @GetMapping("/org/option") + List optionForOrg(); + @Operation(summary = "角色已绑用户") @Parameters({ @Parameter(name = "goPage", description = "目标页码", required = true, in = ParameterIn.PATH),