diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardCardResponseDO.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardCardResponseDO.java index 99f2913f..58c7e0b2 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardCardResponseDO.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardCardResponseDO.java @@ -61,13 +61,13 @@ public class DashboardCardResponseDO { @Data public static class RetryTaskBar { /** - * 时间x + * 时间x轴 */ private String x; /** - * 总数y + * 任务总数y轴 */ - private Long y; + private Long taskTotal; } } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardLineResponseDO.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardLineResponseDO.java new file mode 100644 index 00000000..e1ee25b1 --- /dev/null +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardLineResponseDO.java @@ -0,0 +1,67 @@ +package com.aizuda.easy.retry.template.datasource.persistence.dataobject; + +import lombok.Data; + +/** + * @author: wodeyangzipingpingwuqi + * @date : 2023-11-30 + */ +@Data +public class DashboardLineResponseDO { + + /** + * 时间x轴 + */ + private String createDt; + + /** + * 总量,计算百分比 + */ + private Long total; + + /** + * 重试-成功数 + */ + private Long successNum; + + /** + * 重试-运行数 + */ + private Long runningNum; + + /** + * 重试-最大次数 + */ + private Long maxCountNum; + + /** + * 重试-暂停数 + */ + private Long suspendNum; + + /** + * 定时-失败任务 + */ + private Long fail; + + /** + * 定时-总任务数 + */ + private Long totalNum; + + /** + * 定时-无效任务数 + */ + private Long failNum; + + /** + * 定时-停止数 + */ + private Long stopNum; + + /** + * 定时-取消数 + */ + private Long cancelNum; + +} diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLineResponseDO.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLineResponseDO.java index aba78075..b8b373e4 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLineResponseDO.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLineResponseDO.java @@ -24,7 +24,7 @@ public class DashboardRetryLineResponseDO { /** * 折线图列表 */ - private List dispatchQuantityResponseVOList; + private List dashboardLineResponseDOList; @Data public static class Task { diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLinkeResponseDO.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLinkeResponseDO.java deleted file mode 100644 index 076c42cd..00000000 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DashboardRetryLinkeResponseDO.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.aizuda.easy.retry.template.datasource.persistence.dataobject; - -import lombok.Data; - -/** - * @author: wodeyangzipingpingwuqi - * @date : 2023-11-30 - */ -@Data -public class DashboardRetryLinkeResponseDO { - - private String createDt; - - private Long total; - - private Long successNum; - - private Long runningNum; - - private Long maxCountNum; - - private Long suspendNum; -} diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DispatchQuantityResponseDO.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DispatchQuantityResponseDO.java deleted file mode 100644 index 1783ce45..00000000 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/dataobject/DispatchQuantityResponseDO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aizuda.easy.retry.template.datasource.persistence.dataobject; - -import lombok.Data; - -/** - * @author: www.byteblogs.com - * @date : 2022-04-22 20:27 - */ -@Data -public class DispatchQuantityResponseDO { - - private String createDt; - - private Long total; - - private Long successNum; - - private Long fail; - - private Long totalNum; - - private Long failNum; - - private Long stopNum; - - private Long cancelNum; -} diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java index a49b7c9c..757edbe7 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/JobSummaryMapper.java @@ -1,8 +1,8 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DispatchQuantityResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -27,10 +27,10 @@ public interface JobSummaryMapper extends BaseMapper { IPage jobTaskList(@Param("namespaceId") String namespaceId, Page page); - List jobLineList(@Param("namespaceId") String namespaceId, - @Param("type") String type, - @Param("from") LocalDateTime from, - @Param("to") LocalDateTime to); + List jobLineList(@Param("namespaceId") String namespaceId, + @Param("type") String type, + @Param("from") LocalDateTime from, + @Param("to") LocalDateTime to); DashboardCardResponseDO.JobTask toJobTask(@Param("namespaceId") String namespaceId); diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java index 2871acf6..c93e1661 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetrySummaryMapper.java @@ -2,7 +2,7 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLinkeResponseDO; +import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.RetrySummary; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -31,10 +31,10 @@ public interface RetrySummaryMapper extends BaseMapper { IPage retryTaskList(@Param("namespaceId") String namespaceId, Page page); - List retryLineList(@Param("namespaceId") String namespaceId, - @Param("type") String type, - @Param("from") LocalDateTime from, - @Param("to") LocalDateTime to); + List retryLineList(@Param("namespaceId") String namespaceId, + @Param("type") String type, + @Param("from") LocalDateTime from, + @Param("to") LocalDateTime to); List dashboardRank(@Param("namespaceId") String namespaceId, diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java index 8f3aaf12..3c2580b2 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/persistence/mapper/RetryTaskLogMapper.java @@ -2,8 +2,6 @@ package com.aizuda.easy.retry.template.datasource.persistence.mapper; import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryResponseDO; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DispatchQuantityResponseDO; -import com.aizuda.easy.retry.template.datasource.persistence.dataobject.SceneQuantityRankResponseDO; import com.aizuda.easy.retry.template.datasource.persistence.po.RetryTaskLog; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml index a912552a..655c712e 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/mysql/mapper/JobSummaryMapper.xml @@ -73,14 +73,23 @@ - SELECT DATE_FORMAT(trigger_at, '%Y-%m-%d') AS x, - SUM(running_num + finish_num + max_count_num + suspend_num) AS y - FROM retry_summary - WHERE namespace_id = #{namespaceId} - GROUP BY trigger_at LIMIT 7 + SELECT tmp.date AS x, ifnull(b.taskTotal, 0) AS taskTotal + FROM ( + SELECT curdate() AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), interval 2 day) AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), interval 3 day) AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), interval 4 day) AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), interval 5 day) AS date + UNION ALL + SELECT DATE_SUB(CURDATE(), interval 6 day) AS date + ) tmp + LEFT JOIN ( + SELECT DATE (trigger_at) AS triggerAt, + SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary + GROUP BY triggerAt + ) b + ON tmp.date = b.triggerAt