fix: 2.5.0:
1、重复、定时任务批量统计批量新增或更新改为普通新增或更新
This commit is contained in:
parent
02b900125f
commit
5b985a0231
@ -21,9 +21,7 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface JobSummaryMapper extends BaseMapper<JobSummary> {
|
public interface JobSummaryMapper extends BaseMapper<JobSummary> {
|
||||||
|
|
||||||
int insertBatchJobSummary(@Param("list") List<JobSummary> list);
|
int insertOrUpdate(@Param("list") List<JobSummary> list);
|
||||||
|
|
||||||
int updateBatchTriggerAtById(@Param("list") List<JobSummary> list);
|
|
||||||
|
|
||||||
IPage<DashboardRetryLineResponseDO.Task> jobTaskList(@Param("namespaceId") String namespaceId, Page<Object> page);
|
IPage<DashboardRetryLineResponseDO.Task> jobTaskList(@Param("namespaceId") String namespaceId, Page<Object> page);
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface RetrySummaryMapper extends BaseMapper<RetrySummary> {
|
public interface RetrySummaryMapper extends BaseMapper<RetrySummary> {
|
||||||
|
|
||||||
int insertBatchRetrySummary(@Param("list") List<RetrySummary> list);
|
int insertOrUpdate(@Param("list") List<RetrySummary> list);
|
||||||
|
|
||||||
int updateBatchSceneNameById(@Param("list") List<RetrySummary> list);
|
|
||||||
|
|
||||||
DashboardCardResponseDO.RetryTask retryTask(@Param("namespaceId") String namespaceId);
|
DashboardCardResponseDO.RetryTask retryTask(@Param("namespaceId") String namespaceId);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<insert id="insertBatchJobSummary">
|
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
job_summary (namespace_id, group_name, job_id, trigger_at,
|
job_summary (namespace_id, group_name, job_id, trigger_at,
|
||||||
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)
|
||||||
@ -38,40 +38,10 @@
|
|||||||
#{item.cancelReason}
|
#{item.cancelReason}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
job_id = values(`job_id`), trigger_at = values(`trigger_at`)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateBatchTriggerAtById" parameterType="java.util.List">
|
|
||||||
UPDATE job_summary js,
|
|
||||||
(
|
|
||||||
<foreach collection="list" item="item" index="index" separator=" union all ">
|
|
||||||
SELECT
|
|
||||||
#{item.namespaceId} AS namespace_id,
|
|
||||||
#{item.groupName} AS group_name,
|
|
||||||
#{item.jobId} AS job_id,
|
|
||||||
#{item.triggerAt} AS trigger_at,
|
|
||||||
#{item.successNum} AS success_num,
|
|
||||||
#{item.failNum} AS fail_num,
|
|
||||||
#{item.failReason} AS fail_reason,
|
|
||||||
#{item.stopNum} AS stop_num,
|
|
||||||
#{item.stopReason} AS stop_reason,
|
|
||||||
#{item.cancelNum} AS cancel_num,
|
|
||||||
#{item.cancelReason} AS cancel_reason
|
|
||||||
</foreach>
|
|
||||||
) tt
|
|
||||||
SET
|
|
||||||
js.namespace_id = tt.namespace_id,
|
|
||||||
js.group_name = tt.group_name,
|
|
||||||
js.job_id = tt.job_id,
|
|
||||||
js.success_num = tt.success_num,
|
|
||||||
js.fail_num = tt.fail_num,
|
|
||||||
js.fail_reason = tt.fail_reason,
|
|
||||||
js.stop_num = tt.stop_num,
|
|
||||||
js.stop_reason = tt.stop_reason,
|
|
||||||
js.cancel_num = tt.cancel_num,
|
|
||||||
js.cancel_reason = tt.cancel_reason
|
|
||||||
WHERE js.job_id = tt.job_id AND js.trigger_at = tt.trigger_at
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<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
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<insert id="insertBatchRetrySummary">
|
<insert id="insertOrUpdate" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
retry_summary (namespace_id, group_name, scene_name, trigger_at, running_num, finish_num, max_count_num,
|
||||||
suspend_num)
|
suspend_num)
|
||||||
@ -32,38 +32,13 @@
|
|||||||
#{item.suspendNum}
|
#{item.suspendNum}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
namespace_id = values(`namespace_id`),
|
||||||
|
group_name = values(`group_name`),
|
||||||
|
scene_name = values(`scene_name`),
|
||||||
|
trigger_at = values(`trigger_at`)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateBatchSceneNameById" parameterType="java.util.List">
|
|
||||||
UPDATE retry_summary rs,
|
|
||||||
(
|
|
||||||
<foreach collection="list" item="item" index="index" separator=" union all ">
|
|
||||||
SELECT
|
|
||||||
#{item.namespaceId} AS namespace_id,
|
|
||||||
#{item.groupName} AS group_name,
|
|
||||||
#{item.sceneName} AS scene_name,
|
|
||||||
#{item.triggerAt} AS trigger_at,
|
|
||||||
#{item.runningNum} AS running_num,
|
|
||||||
#{item.finishNum} AS finish_num,
|
|
||||||
#{item.maxCountNum} AS max_count_num,
|
|
||||||
#{item.suspendNum} AS suspend_num
|
|
||||||
</foreach>
|
|
||||||
) tt
|
|
||||||
SET
|
|
||||||
rs.namespace_id = tt.namespace_id,
|
|
||||||
rs.group_name = tt.group_name,
|
|
||||||
rs.scene_name = tt.scene_name,
|
|
||||||
rs.running_num = tt.running_num,
|
|
||||||
rs.finish_num = tt.finish_num,
|
|
||||||
rs.max_count_num = tt.max_count_num,
|
|
||||||
rs.suspend_num = tt.suspend_num
|
|
||||||
WHERE
|
|
||||||
rs.namespace_id = tt.namespace_id
|
|
||||||
AND rs.group_name = tt.group_name
|
|
||||||
AND rs.scene_name = tt.scene_name
|
|
||||||
AND rs.trigger_at = tt.trigger_at
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<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 ifnull(sum(running_num), 0) AS runningNum,
|
SELECT ifnull(sum(running_num), 0) AS runningNum,
|
||||||
@ -78,23 +53,20 @@
|
|||||||
<select id="retryTaskBarList"
|
<select id="retryTaskBarList"
|
||||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTaskBar">
|
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardCardResponseDO$RetryTaskBar">
|
||||||
SELECT tmp.date AS x, ifnull(b.taskTotal, 0) AS taskTotal
|
SELECT tmp.date AS x, ifnull(b.taskTotal, 0) AS taskTotal
|
||||||
FROM (
|
FROM (SELECT curdate() AS date
|
||||||
SELECT curdate() AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS date
|
||||||
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), interval 2 day) AS date
|
||||||
SELECT DATE_SUB(CURDATE(), interval 2 day) AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), interval 3 day) AS date
|
||||||
SELECT DATE_SUB(CURDATE(), interval 3 day) AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), interval 4 day) AS date
|
||||||
SELECT DATE_SUB(CURDATE(), interval 4 day) AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), interval 5 day) AS date
|
||||||
SELECT DATE_SUB(CURDATE(), interval 5 day) AS date
|
UNION ALL
|
||||||
UNION ALL
|
SELECT DATE_SUB(CURDATE(), interval 6 day) AS date) tmp
|
||||||
SELECT DATE_SUB(CURDATE(), interval 6 day) AS date
|
LEFT JOIN (SELECT DATE (trigger_at) AS triggerAt,
|
||||||
) tmp
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT DATE (trigger_at) AS triggerAt,
|
|
||||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary
|
SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary
|
||||||
WHERE namespace_id = #{namespaceId}
|
WHERE namespace_id = #{namespaceId}
|
||||||
GROUP BY triggerAt
|
GROUP BY triggerAt
|
||||||
|
@ -69,11 +69,8 @@ public class JobSummarySchedule extends AbstractSchedule implements Lifecycle {
|
|||||||
|
|
||||||
// insertOrUpdate
|
// insertOrUpdate
|
||||||
List<JobSummary> jobSummaryList = jobSummaryList(todayFrom, summaryResponseDOList);
|
List<JobSummary> jobSummaryList = jobSummaryList(todayFrom, summaryResponseDOList);
|
||||||
int total = jobSummaryMapper.updateBatchTriggerAtById(jobSummaryList);
|
int totalJobSummary = jobSummaryMapper.insertOrUpdate(jobSummaryList);
|
||||||
if (total < 1) {
|
LogUtils.debug(log, "job summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, totalJobSummary);
|
||||||
jobSummaryMapper.insertBatchJobSummary(jobSummaryList);
|
|
||||||
}
|
|
||||||
LogUtils.debug(log, "job summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error(log, "job summary dashboard log error", e);
|
LogUtils.error(log, "job summary dashboard log error", e);
|
||||||
|
@ -67,11 +67,8 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle
|
|||||||
|
|
||||||
// insertOrUpdate
|
// insertOrUpdate
|
||||||
List<RetrySummary> retrySummaryList = retrySummaryList(todayFrom, dashboardRetryResponseDOList);
|
List<RetrySummary> retrySummaryList = retrySummaryList(todayFrom, dashboardRetryResponseDOList);
|
||||||
int total = retrySummaryMapper.updateBatchSceneNameById(retrySummaryList);
|
int totalRetrySummary = retrySummaryMapper.insertOrUpdate(retrySummaryList);
|
||||||
if (total < 1) {
|
LogUtils.debug(log, "retry summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, totalRetrySummary);
|
||||||
retrySummaryMapper.insertBatchRetrySummary(retrySummaryList);
|
|
||||||
}
|
|
||||||
LogUtils.debug(log, "retry summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error(log, "retry summary dashboard log error", e);
|
LogUtils.error(log, "retry summary dashboard log error", e);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<v-chart :force-fit="true" :height="405" :data="pieData" :scale="pieScale" >
|
<v-chart :force-fit="true" :height="405" :data="pieData" :scale="pieScale" >
|
||||||
<v-tooltip :showTitle="true" dataKey="value*percent" />
|
<v-tooltip :showTitle="false" dataKey="value*percent" />
|
||||||
<v-axis />
|
<v-axis />
|
||||||
<v-legend dataKey="value" />
|
<v-legend dataKey="value" />
|
||||||
<v-pie position="percent" color="value" :vStyle="pieStyle" />
|
<v-pie position="percent" color="value" :vStyle="pieStyle" />
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<v-chart :force-fit="true" :height="405" :data="pieData" :scale="pieScale" >
|
<v-chart :force-fit="true" :height="405" :data="pieData" :scale="pieScale" >
|
||||||
<v-tooltip :showTitle="false" dataKey="name*percent" />
|
<v-tooltip :showTitle="false" dataKey="value*percent" />
|
||||||
<v-axis />
|
<v-axis />
|
||||||
<v-legend dataKey="value" />
|
<v-legend dataKey="value" />
|
||||||
<v-pie position="percent" color="value" :vStyle="pieStyle" />
|
<v-pie position="percent" color="value" :vStyle="pieStyle" />
|
||||||
|
Loading…
Reference in New Issue
Block a user