fix(3.2.0) Dashboard对应mapper函数少参数,用于条件判断

* style: 格式化mysql的SQL文件
* style: 格式化mysql的mapper.xml文件
* fix: Dashboard对应mapper函数少参数,用于条件判断
* fix: `job_summary`表缺`system_task_type`字段
This commit is contained in:
dhb52 2024-03-29 05:37:55 +00:00 committed by byteblogs168
parent 035f468749
commit 8c58aca247
14 changed files with 236 additions and 213 deletions

View File

@ -380,7 +380,7 @@ CREATE TABLE `job_task_batch`
KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`), KEY `idx_job_id_task_batch_status` (`job_id`, `task_batch_status`),
KEY `idx_create_dt` (`create_dt`), KEY `idx_create_dt` (`create_dt`),
KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`), KEY `idx_namespace_id_group_name` (`namespace_id`, `group_name`),
KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`,`workflow_node_id`) KEY `idx_workflow_task_batch_id_workflow_node_id` (`workflow_task_batch_id`, `workflow_node_id`)
) ENGINE = InnoDB ) ENGINE = InnoDB
AUTO_INCREMENT = 0 AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次'; DEFAULT CHARSET = utf8mb4 COMMENT ='任务批次';
@ -413,6 +413,7 @@ CREATE TABLE `job_summary`
`namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id', `namespace_id` VARCHAR(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
`group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称', `group_name` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '组名称',
`business_id` bigint NOT NULL COMMENT '业务id (job_id或workflow_id)', `business_id` bigint NOT NULL COMMENT '业务id (job_id或workflow_id)',
`system_task_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '任务类型 3、JOB任务 4、WORKFLOW任务',
`trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间', `trigger_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '统计时间',
`success_num` int NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量', `success_num` int NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量',
`fail_num` int NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量', `fail_num` int NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量',

View File

@ -4,7 +4,6 @@ import com.aizuda.easy.retry.template.datasource.persistence.dataobject.Dashboar
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO; 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.DashboardRetryLineResponseDO;
import com.aizuda.easy.retry.template.datasource.persistence.po.Job; import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
import com.aizuda.easy.retry.template.datasource.persistence.po.JobNotifyConfig;
import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary; import com.aizuda.easy.retry.template.datasource.persistence.po.JobSummary;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -13,7 +12,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -28,9 +26,9 @@ public interface JobSummaryMapper extends BaseMapper<JobSummary> {
IPage<DashboardRetryLineResponseDO.Task> jobTaskList(@Param("ew") Wrapper<Job> wrapper, Page<Object> page); IPage<DashboardRetryLineResponseDO.Task> jobTaskList(@Param("ew") Wrapper<Job> wrapper, Page<Object> page);
List<DashboardLineResponseDO> jobLineList(@Param("ew") Wrapper<JobSummary> wrapper); List<DashboardLineResponseDO> jobLineList(String dateFormat, @Param("ew") Wrapper<JobSummary> wrapper);
List<DashboardRetryLineResponseDO.Rank> dashboardRank(@Param("ew") Wrapper<JobSummary> wrapper); List<DashboardRetryLineResponseDO.Rank> dashboardRank(Integer systemTaskType, @Param("ew") Wrapper<JobSummary> wrapper);
DashboardCardResponseDO.JobTask toJobTask(@Param("ew") Wrapper<JobSummary> wrapper); DashboardCardResponseDO.JobTask toJobTask(@Param("ew") Wrapper<JobSummary> wrapper);
} }

View File

@ -32,7 +32,7 @@ public interface RetrySummaryMapper extends BaseMapper<RetrySummary> {
IPage<DashboardRetryLineResponseDO.Task> retryTaskList(@Param("ew") Wrapper<SceneConfig> wrapper, Page<Object> page); IPage<DashboardRetryLineResponseDO.Task> retryTaskList(@Param("ew") Wrapper<SceneConfig> wrapper, Page<Object> page);
List<DashboardLineResponseDO> retryLineList(@Param("ew") Wrapper<RetrySummary> wrapper); List<DashboardLineResponseDO> retryLineList(String type, @Param("ew") Wrapper<RetrySummary> wrapper);
List<DashboardRetryLineResponseDO.Rank> dashboardRank(@Param("ew") Wrapper<RetrySummary> wrapper); List<DashboardRetryLineResponseDO.Rank> dashboardRank(@Param("ew") Wrapper<RetrySummary> wrapper);
} }

View File

@ -27,17 +27,16 @@
</resultMap> </resultMap>
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
update job rt, UPDATE job rt,
( (
<foreach collection="list" item="item" index="index" separator=" union all "> <foreach collection="list" item="item" index="index" separator=" UNION ALL ">
select SELECT
#{item.nextTriggerAt} as next_trigger_at, #{item.nextTriggerAt} AS next_trigger_at,
#{item.id} as id #{item.id} AS id
</foreach> </foreach>
) tt ) tt
set SET rt.next_trigger_at = tt.next_trigger_at
rt.next_trigger_at = tt.next_trigger_at WHERE rt.id = tt.id
where rt.id = tt.id
</update> </update>
</mapper> </mapper>

View File

@ -20,8 +20,7 @@
</resultMap> </resultMap>
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO INSERT INTO job_summary (namespace_id, group_name, business_id, trigger_at, system_task_type,
job_summary (namespace_id, group_name, business_id, trigger_at, system_task_type,
success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason) success_num,fail_num,fail_reason,stop_num,stop_reason, cancel_num,cancel_reason)
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
@ -41,24 +40,24 @@
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
success_num = values(`success_num`), success_num = VALUES(`success_num`),
fail_num = values(`fail_num`), fail_num = VALUES(`fail_num`),
fail_reason = values(`fail_reason`), fail_reason = VALUES(`fail_reason`),
stop_num = values(`stop_num`), stop_num = VALUES(`stop_num`),
stop_reason = values(`stop_reason`), stop_reason = VALUES(`stop_reason`),
cancel_num = values(`cancel_num`), cancel_num = VALUES(`cancel_num`),
cancel_reason = values(`cancel_reason`) cancel_reason = VALUES(`cancel_reason`)
</insert> </insert>
<select id="jobLineList" <select id="jobLineList"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardLineResponseDO">
SELECT SELECT
DATE_FORMAT(trigger_at, #{dateFormat}) AS createDt, DATE_FORMAT(trigger_at, #{dateFormat}) AS createDt,
ifnull(SUM(success_num), 0) AS success, IFNULL(SUM(success_num), 0) AS success,
ifnull(SUM(stop_num), 0) AS stop, IFNULL(SUM(stop_num), 0) AS stop,
ifnull(SUM(cancel_num), 0) AS cancel, IFNULL(SUM(cancel_num), 0) AS cancel,
ifnull(SUM(fail_num), 0) AS fail, IFNULL(SUM(fail_num), 0) AS fail,
ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total IFNULL(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
FROM job_summary FROM job_summary
${ew.customSqlSegment} ${ew.customSqlSegment}
GROUP BY DATE_FORMAT(trigger_at, #{dateFormat}) GROUP BY DATE_FORMAT(trigger_at, #{dateFormat})
@ -67,11 +66,11 @@
<select id="toJobTask" <select id="toJobTask"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$JobTask"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$JobTask">
SELECT SELECT
ifnull(sum(success_num), 0) AS successNum, IFNULL(SUM(success_num), 0) AS successNum,
ifnull(sum(stop_num), 0) AS stopNum, IFNULL(SUM(stop_num), 0) AS stopNum,
ifnull(sum(cancel_num), 0) AS cancelNum, IFNULL(SUM(cancel_num), 0) AS cancelNum,
ifnull(sum(fail_num), 0) AS failNum, IFNULL(SUM(fail_num), 0) AS failNum,
ifnull(sum(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum IFNULL(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS totalNum
FROM job_summary FROM job_summary
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
@ -85,17 +84,19 @@
<if test="systemTaskType == 4"> <if test="systemTaskType == 4">
CONCAT(group_name, '/', (SELECT workflow_name FROM workflow WHERE id = business_id)) name, CONCAT(group_name, '/', (SELECT workflow_name FROM workflow WHERE id = business_id)) name,
</if> </if>
SUM(fail_num) AS total FROM job_summary SUM(fail_num) AS total
FROM job_summary
${ew.customSqlSegment} ${ew.customSqlSegment}
HAVING total > 0 HAVING total > 0
ORDER BY total DESC LIMIT 10 ORDER BY total DESC
LIMIT 10
</select> </select>
<select id="jobTaskList" <select id="jobTaskList"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Task">
SELECT group_name AS groupName, SELECT group_name AS groupName,
SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run, SUM(CASE WHEN (job_status = 1) THEN 1 ELSE 0 END) AS run,
count(*) AS total COUNT(*) AS total
FROM job FROM job
${ew.customSqlSegment} ${ew.customSqlSegment}
GROUP BY namespace_id, group_name GROUP BY namespace_id, group_name

View File

@ -15,19 +15,30 @@
<result column="task_type" jdbcType="TINYINT" property="taskType"/> <result column="task_type" jdbcType="TINYINT" property="taskType"/>
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" /> <result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, create_dt, task_type id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, create_dt, task_type
</sql> </sql>
<insert id="insertBatch"> <insert id="insertBatch">
insert into retry_dead_letter (namespace_id, unique_id, group_name, scene_name, INSERT INTO retry_dead_letter (namespace_id, unique_id, group_name, scene_name,
idempotent_id, biz_no, executor_name, args_str, idempotent_id, biz_no, executor_name, args_str,
ext_attrs, create_dt ext_attrs, create_dt
) )
values VALUES
<foreach collection="retryDeadLetters" item="retryDeadLetter" separator=","> <foreach collection="retryDeadLetters" item="retryDeadLetter" separator=",">
(#{retryDeadLetter.namespaceId,jdbcType=VARCHAR}, #{retryDeadLetter.uniqueId,jdbcType=VARCHAR}, #{retryDeadLetter.groupName,jdbcType=VARCHAR}, #{retryDeadLetter.sceneName,jdbcType=VARCHAR}, (
#{retryDeadLetter.idempotentId,jdbcType=VARCHAR}, #{retryDeadLetter.bizNo,jdbcType=VARCHAR}, #{retryDeadLetter.executorName,jdbcType=VARCHAR}, #{retryDeadLetter.argsStr,jdbcType=VARCHAR}, #{retryDeadLetter.namespaceId,jdbcType=VARCHAR},
#{retryDeadLetter.extAttrs,jdbcType=VARCHAR}, #{retryDeadLetter.createDt,jdbcType=TIMESTAMP}) #{retryDeadLetter.uniqueId,jdbcType=VARCHAR},
#{retryDeadLetter.groupName,jdbcType=VARCHAR},
#{retryDeadLetter.sceneName,jdbcType=VARCHAR},
#{retryDeadLetter.idempotentId,jdbcType=VARCHAR},
#{retryDeadLetter.bizNo,jdbcType=VARCHAR},
#{retryDeadLetter.executorName,jdbcType=VARCHAR},
#{retryDeadLetter.argsStr,jdbcType=VARCHAR},
#{retryDeadLetter.extAttrs,jdbcType=VARCHAR},
#{retryDeadLetter.createDt,jdbcType=TIMESTAMP}
)
</foreach> </foreach>
</insert> </insert>

View File

@ -41,8 +41,7 @@
<select id="retryTask" <select id="retryTask"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
SELECT SELECT IFNULL(SUM(running_num), 0) AS runningNum,
IFNULL(SUM(running_num), 0) AS runningNum,
IFNULL(SUM(finish_num), 0) AS finishNum, IFNULL(SUM(finish_num), 0) AS finishNum,
IFNULL(SUM(max_count_num), 0) AS maxCountNum, IFNULL(SUM(max_count_num), 0) AS maxCountNum,
IFNULL(SUM(suspend_num), 0) AS suspendNum, IFNULL(SUM(suspend_num), 0) AS suspendNum,
@ -53,8 +52,11 @@
<select id="retryTaskBarList" <select id="retryTaskBarList"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTask">
SELECT SELECT trigger_at,
trigger_at, running_num, finish_num, max_count_num, suspend_num running_num,
finish_num,
max_count_num,
suspend_num
FROM retry_summary FROM retry_summary
${ew.customSqlSegment} ${ew.customSqlSegment}
LIMIT 7 LIMIT 7
@ -93,13 +95,13 @@
<select id="dashboardRank" <select id="dashboardRank"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryLineResponseDO$Rank">
SELECT SELECT CONCAT(group_name, '/', scene_name) `name`,
CONCAT(group_name, '/', scene_name) `name`,
SUM(running_num + finish_num + max_count_num + suspend_num) AS total SUM(running_num + finish_num + max_count_num + suspend_num) AS total
FROM retry_summary FROM retry_summary
${ew.customSqlSegment} ${ew.customSqlSegment}
HAVING total > 0 HAVING total > 0
ORDER BY total DESC LIMIT 10 ORDER BY total DESC
LIMIT 10
</select> </select>
<select id="retryTaskList" <select id="retryTaskList"

View File

@ -17,8 +17,7 @@
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/> <result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id id, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
, unique_id, group_name, scene_name, idempotent_id, biz_no, executor_name, args_str, ext_attrs, retry_status,
create_dt, task_type, namespace_id create_dt, task_type, namespace_id
</sql> </sql>

View File

@ -42,8 +42,7 @@
#{item.id} AS id #{item.id} AS id
</foreach> </foreach>
) tt ) tt
SET SET jlm.message = tt.message, jlm.log_num = tt.log_num
jlm.message = tt.message, jlm.log_num = tt.log_num
WHERE jlm.id = tt.id WHERE jlm.id = tt.id
</update> </update>

View File

@ -32,16 +32,15 @@
</foreach> </foreach>
</insert> </insert>
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
update retry_task_${partition} rt, UPDATE retry_task_${partition} rt,
( (
<foreach collection="list" item="item" index="index" separator=" union all "> <foreach collection="list" item="item" index="index" separator=" UNION ALL ">
select SELECT
#{item.nextTriggerAt} as next_trigger_at, #{item.nextTriggerAt} AS next_trigger_at,
#{item.id} as id #{item.id} AS id
</foreach> </foreach>
) tt ) tt
set SET rt.next_trigger_at = tt.next_trigger_at
rt.next_trigger_at = tt.next_trigger_at WHERE rt.id = tt.id
where rt.id = tt.id
</update> </update>
</mapper> </mapper>

View File

@ -15,25 +15,39 @@
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" /> <result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" /> <result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt id, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
</sql> </sql>
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> <insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
insert into server_node (namespace_id, group_name, host_id, host_ip, host_port, INSERT INTO server_node (namespace_id, group_name, host_id, host_ip, host_port,
expire_at, node_type, ext_attrs, context_path, create_dt) expire_at, node_type, ext_attrs, context_path, create_dt)
values VALUES
<foreach collection="records" item="item" index="index" separator=","> <foreach collection="records" item="item" index="index" separator=",">
(#{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR}, (
#{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT}, #{item.namespaceId,jdbcType=VARCHAR},
#{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP}) #{item.groupName,jdbcType=VARCHAR},
#{item.hostId,jdbcType=VARCHAR},
#{item.hostIp,jdbcType=VARCHAR},
#{item.hostPort,jdbcType=INTEGER},
#{item.expireAt,jdbcType=TIMESTAMP},
#{item.nodeType,jdbcType=TINYINT},
#{item.extAttrs,jdbcType=VARCHAR},
#{item.contextPath,jdbcType=VARCHAR},
#{item.createDt,jdbcType=TIMESTAMP}
)
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
expire_at = values(`expire_at`) expire_at = VALUES(`expire_at`)
</insert> </insert>
<select id="countActivePod" <select id="countActivePod"
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO"> resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
SELECT node_type as nodeType, count(*) as total SELECT
from server_node node_type AS nodeType,
COUNT(*) AS total
FROM server_node
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
</mapper> </mapper>

View File

@ -15,19 +15,18 @@
<result column="deleted" property="deleted" /> <result column="deleted" property="deleted" />
<result column="ext_attrs" property="extAttrs" /> <result column="ext_attrs" property="extAttrs" />
</resultMap> </resultMap>
<update id="updateBatchNextTriggerAtById" parameterType="java.util.List"> <update id="updateBatchNextTriggerAtById" parameterType="java.util.List">
update workflow rt, UPDATE workflow rt,
( (
<foreach collection="list" item="item" index="index" separator=" union all "> <foreach collection="list" item="item" index="index" separator=" UNION ALL ">
select SELECT
#{item.nextTriggerAt} as next_trigger_at, #{item.nextTriggerAt} AS next_trigger_at,
#{item.id} as id #{item.id} AS id
</foreach> </foreach>
) tt ) tt
set SET rt.next_trigger_at = tt.next_trigger_at
rt.next_trigger_at = tt.next_trigger_at WHERE rt.id = tt.id
where rt.id = tt.id
</update> </update>
</mapper> </mapper>

View File

@ -9,6 +9,7 @@ import com.aizuda.easy.retry.common.core.util.NetUtil;
import com.aizuda.easy.retry.common.log.EasyRetryLog; import com.aizuda.easy.retry.common.log.EasyRetryLog;
import com.aizuda.easy.retry.server.common.dto.DistributeInstance; import com.aizuda.easy.retry.server.common.dto.DistributeInstance;
import com.aizuda.easy.retry.server.common.dto.ServerNodeExtAttrs; import com.aizuda.easy.retry.server.common.dto.ServerNodeExtAttrs;
import com.aizuda.easy.retry.server.common.enums.DashboardLineEnum;
import com.aizuda.easy.retry.server.common.enums.SyetemTaskTypeEnum; import com.aizuda.easy.retry.server.common.enums.SyetemTaskTypeEnum;
import com.aizuda.easy.retry.server.common.enums.SystemModeEnum; import com.aizuda.easy.retry.server.common.enums.SystemModeEnum;
import com.aizuda.easy.retry.server.common.register.ServerRegister; import com.aizuda.easy.retry.server.common.register.ServerRegister;
@ -164,10 +165,10 @@ public class DashBoardServiceImpl implements DashBoardService {
LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(StrUtil.isNotBlank(endTime) ? LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null); LocalDateTime endDateTime = dateTypeEnum.getEndTime().apply(StrUtil.isNotBlank(endTime) ? LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null);
LambdaQueryWrapper<RetrySummary> wrapper1 = new LambdaQueryWrapper<RetrySummary>() LambdaQueryWrapper<RetrySummary> wrapper1 = new LambdaQueryWrapper<RetrySummary>()
.in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames) .in(CollUtil.isNotEmpty(groupNames), RetrySummary::getGroupName, groupNames)
.eq(StrUtil.isNotBlank(groupName), RetrySummary::getGroupName, groupNames) .eq(StrUtil.isNotBlank(groupName), RetrySummary::getGroupName, groupName)
.eq(RetrySummary::getNamespaceId, namespaceId) .eq(RetrySummary::getNamespaceId, namespaceId)
.between(RetrySummary::getTriggerAt, startDateTime, endDateTime); .between(RetrySummary::getTriggerAt, startDateTime, endDateTime);
List<DashboardLineResponseDO> dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(wrapper1); List<DashboardLineResponseDO> dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(type, wrapper1);
List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardRetryLinkeResponseDOList); List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardRetryLinkeResponseDOList);
dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList); dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList);
dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt())); dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt()));
@ -221,7 +222,7 @@ public class DashBoardServiceImpl implements DashBoardService {
.eq(JobSummary::getSystemTaskType, systemTaskType) .eq(JobSummary::getSystemTaskType, systemTaskType)
.eq(JobSummary::getNamespaceId, namespaceId) .eq(JobSummary::getNamespaceId, namespaceId)
.between(JobSummary::getTriggerAt, startDateTime, endDateTime); .between(JobSummary::getTriggerAt, startDateTime, endDateTime);
List<DashboardLineResponseDO> dashboardLineResponseDOList = jobSummaryMapper.jobLineList(queryWrapper); List<DashboardLineResponseDO> dashboardLineResponseDOList = jobSummaryMapper.jobLineList(DashboardLineEnum.modeOf(type).getDateFormat(), queryWrapper);
List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardLineResponseDOList); List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardLineResponseDOList);
dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList); dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList);
dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt())); dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt()));
@ -235,7 +236,7 @@ public class DashBoardServiceImpl implements DashBoardService {
.eq(JobSummary::getSystemTaskType, systemTaskType) .eq(JobSummary::getSystemTaskType, systemTaskType)
.eq(JobSummary::getNamespaceId, namespaceId) .eq(JobSummary::getNamespaceId, namespaceId)
.groupBy(JobSummary::getNamespaceId, JobSummary::getGroupName, JobSummary::getBusinessId); .groupBy(JobSummary::getNamespaceId, JobSummary::getGroupName, JobSummary::getBusinessId);
List<DashboardRetryLineResponseDO.Rank> rankList = jobSummaryMapper.dashboardRank(wrapper); List<DashboardRetryLineResponseDO.Rank> rankList = jobSummaryMapper.dashboardRank(systemTaskType, wrapper);
List<DashboardRetryLineResponseVO.Rank> ranks = SceneQuantityRankResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVORank(rankList); List<DashboardRetryLineResponseVO.Rank> ranks = SceneQuantityRankResponseVOConverter.INSTANCE.toDashboardRetryLineResponseVORank(rankList);
dashboardRetryLineResponseVO.setRankList(ranks); dashboardRetryLineResponseVO.setRankList(ranks);
return dashboardRetryLineResponseVO; return dashboardRetryLineResponseVO;