fix: 2.5.0:
1、Dashboard修改临界12点的问题 2、修复组、折线图没有按命名空间隔离的问题
This commit is contained in:
parent
171ef66695
commit
fe176790d7
@ -64,4 +64,9 @@ public class DashboardLineResponseDO {
|
||||
*/
|
||||
private Long cancelNum;
|
||||
|
||||
/**
|
||||
* 定时-成功数
|
||||
*/
|
||||
private Long success;
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ public interface JobSummaryMapper extends BaseMapper<JobSummary> {
|
||||
IPage<DashboardRetryLineResponseDO.Task> jobTaskList(@Param("namespaceId") String namespaceId, Page<Object> page);
|
||||
|
||||
List<DashboardLineResponseDO> jobLineList(@Param("namespaceId") String namespaceId,
|
||||
@Param("groupName") String groupName,
|
||||
@Param("type") String type,
|
||||
@Param("from") LocalDateTime from,
|
||||
@Param("to") LocalDateTime to);
|
||||
|
@ -32,6 +32,7 @@ public interface RetrySummaryMapper extends BaseMapper<RetrySummary> {
|
||||
IPage<DashboardRetryLineResponseDO.Task> retryTaskList(@Param("namespaceId") String namespaceId, Page<Object> page);
|
||||
|
||||
List<DashboardLineResponseDO> retryLineList(@Param("namespaceId") String namespaceId,
|
||||
@Param("groupName") String groupName,
|
||||
@Param("type") String type,
|
||||
@Param("from") LocalDateTime from,
|
||||
@Param("to") LocalDateTime to);
|
||||
|
@ -93,14 +93,19 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
AS createDt,
|
||||
ifnull(SUM(success_num), 0) AS successNum,
|
||||
ifnull(SUM(success_num), 0) AS success,
|
||||
ifnull(SUM(fail_num), 0) AS failNum,
|
||||
ifnull(SUM(stop_num), 0) AS stopNum,
|
||||
ifnull(SUM(cancel_num), 0) AS cancelNum,
|
||||
ifnull(SUM(fail_num + stop_num + cancel_num), 0) AS fail,
|
||||
ifnull(SUM(success_num + fail_num + stop_num + cancel_num), 0) AS total
|
||||
FROM job_summary
|
||||
WHERE namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
|
@ -57,7 +57,11 @@
|
||||
rs.finish_num = tt.finish_num,
|
||||
rs.max_count_num = tt.max_count_num,
|
||||
rs.suspend_num = tt.suspend_num
|
||||
WHERE rs.scene_name = tt.scene_name AND rs.trigger_at = tt.trigger_at
|
||||
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"
|
||||
@ -92,6 +96,7 @@
|
||||
LEFT JOIN (
|
||||
SELECT DATE (trigger_at) AS triggerAt,
|
||||
SUM(running_num + finish_num + max_count_num + suspend_num) AS taskTotal FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId}
|
||||
GROUP BY triggerAt
|
||||
) b
|
||||
ON tmp.date = b.triggerAt
|
||||
@ -124,7 +129,12 @@
|
||||
ifnull(SUM(suspend_num), 0) AS suspendNum,
|
||||
ifnull(SUM(finish_num + running_num + max_count_num + suspend_num), 0) AS total
|
||||
FROM retry_summary
|
||||
WHERE namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
<where>
|
||||
<if test="groupName != null and groupName != '' ">
|
||||
AND group_name = #{groupName}
|
||||
</if>
|
||||
AND namespace_id = #{namespaceId} AND trigger_at BETWEEN #{from} AND #{to}
|
||||
</where>
|
||||
GROUP BY createDt
|
||||
</select>
|
||||
|
||||
|
@ -114,5 +114,9 @@ public class SystemProperties {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard 任务容错天数
|
||||
*/
|
||||
private int summaryDay = 7;
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.aizuda.easy.retry.common.core.enums.JobTaskBatchStatusEnum;
|
||||
import com.aizuda.easy.retry.common.core.log.LogUtils;
|
||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||
import com.aizuda.easy.retry.server.common.Lifecycle;
|
||||
import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
||||
import com.aizuda.easy.retry.server.common.dto.JobTaskBatchReason;
|
||||
import com.aizuda.easy.retry.server.common.schedule.AbstractSchedule;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.JobBatchSummaryResponseDO;
|
||||
@ -35,6 +36,8 @@ public class JobSummarySchedule extends AbstractSchedule implements Lifecycle {
|
||||
private JobTaskBatchMapper jobTaskBatchMapper;
|
||||
@Autowired
|
||||
private JobSummaryMapper jobSummaryMapper;
|
||||
@Autowired
|
||||
private SystemProperties systemProperties;
|
||||
|
||||
@Override
|
||||
public String lockName() {
|
||||
@ -54,21 +57,24 @@ public class JobSummarySchedule extends AbstractSchedule implements Lifecycle {
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
// 定时按日实时查询统计数据(00:00:00 - 23:59:59)
|
||||
LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
|
||||
LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
|
||||
List<JobBatchSummaryResponseDO> summaryResponseDOList = jobTaskBatchMapper.summaryJobBatchList(todayFrom, todayTo);
|
||||
if (summaryResponseDOList == null || summaryResponseDOList.size() < 1) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < systemProperties.getSummaryDay(); i++) {
|
||||
|
||||
// insertOrUpdate
|
||||
List<JobSummary> jobSummaryList = jobSummaryList(todayFrom, summaryResponseDOList);
|
||||
int total = jobSummaryMapper.updateBatchTriggerAtById(jobSummaryList);
|
||||
if (total < 1) {
|
||||
jobSummaryMapper.insertBatchJobSummary(jobSummaryList);
|
||||
// 定时按日实时查询统计数据(00:00:00 - 23:59:59)
|
||||
LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i);
|
||||
LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusDays(-i);
|
||||
List<JobBatchSummaryResponseDO> summaryResponseDOList = jobTaskBatchMapper.summaryJobBatchList(todayFrom, todayTo);
|
||||
if (summaryResponseDOList == null || summaryResponseDOList.size() < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// insertOrUpdate
|
||||
List<JobSummary> jobSummaryList = jobSummaryList(todayFrom, summaryResponseDOList);
|
||||
int total = jobSummaryMapper.updateBatchTriggerAtById(jobSummaryList);
|
||||
if (total < 1) {
|
||||
jobSummaryMapper.insertBatchJobSummary(jobSummaryList);
|
||||
}
|
||||
LogUtils.debug(log, "job summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
||||
}
|
||||
LogUtils.debug(log, "job summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(log, "job summary dashboard log error", e);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.aizuda.easy.retry.server.retry.task.support.schedule;
|
||||
|
||||
import com.aizuda.easy.retry.common.core.log.LogUtils;
|
||||
import com.aizuda.easy.retry.server.common.Lifecycle;
|
||||
import com.aizuda.easy.retry.server.common.config.SystemProperties;
|
||||
import com.aizuda.easy.retry.server.common.schedule.AbstractSchedule;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DashboardRetryResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper;
|
||||
@ -33,6 +34,8 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle
|
||||
private RetryTaskLogMapper retryTaskLogMapper;
|
||||
@Autowired
|
||||
private RetrySummaryMapper retrySummaryMapper;
|
||||
@Autowired
|
||||
private SystemProperties systemProperties;
|
||||
|
||||
@Override
|
||||
public String lockName() {
|
||||
@ -52,21 +55,24 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
// 重试按日实时查询统计数据(00:00:00 - 23:59:59)
|
||||
LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
|
||||
LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
|
||||
List<DashboardRetryResponseDO> dashboardRetryResponseDOList = retryTaskLogMapper.retrySummaryRetryTaskLogList(todayFrom, todayTo);
|
||||
if (dashboardRetryResponseDOList == null || dashboardRetryResponseDOList.size() < 1) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < systemProperties.getSummaryDay(); i++) {
|
||||
|
||||
// insertOrUpdate
|
||||
List<RetrySummary> retrySummaryList = retrySummaryList(todayFrom, dashboardRetryResponseDOList);
|
||||
int total = retrySummaryMapper.updateBatchSceneNameById(retrySummaryList);
|
||||
if (total < 1) {
|
||||
retrySummaryMapper.insertBatchRetrySummary(retrySummaryList);
|
||||
// 重试按日实时查询统计数据(00:00:00 - 23:59:59)
|
||||
LocalDateTime todayFrom = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(-i);
|
||||
LocalDateTime todayTo = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusDays(-i);
|
||||
List<DashboardRetryResponseDO> dashboardRetryResponseDOList = retryTaskLogMapper.retrySummaryRetryTaskLogList(todayFrom, todayTo);
|
||||
if (dashboardRetryResponseDOList == null || dashboardRetryResponseDOList.size() < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// insertOrUpdate
|
||||
List<RetrySummary> retrySummaryList = retrySummaryList(todayFrom, dashboardRetryResponseDOList);
|
||||
int total = retrySummaryMapper.updateBatchSceneNameById(retrySummaryList);
|
||||
if (total < 1) {
|
||||
retrySummaryMapper.insertBatchRetrySummary(retrySummaryList);
|
||||
}
|
||||
LogUtils.debug(log, "retry summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
||||
}
|
||||
LogUtils.debug(log, "retry summary dashboard success todayFrom:[{}] todayTo:[{}] total:[{}]", todayFrom, todayTo, total);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(log, "retry summary dashboard log error", e);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public enum DateTypeEnum {
|
||||
.setFailNum(0L)
|
||||
.setMaxCountNum(0L)
|
||||
.setRunningNum(0L)
|
||||
.setSuccess(0L)
|
||||
.setSuccessNum(0L)
|
||||
.setSuspendNum(0L)
|
||||
.setStopNum(0L)
|
||||
@ -70,6 +71,7 @@ public enum DateTypeEnum {
|
||||
.setFailNum(0L)
|
||||
.setMaxCountNum(0L)
|
||||
.setRunningNum(0L)
|
||||
.setSuccess(0L)
|
||||
.setSuccessNum(0L)
|
||||
.setSuspendNum(0L)
|
||||
.setStopNum(0L)
|
||||
@ -105,6 +107,7 @@ public enum DateTypeEnum {
|
||||
.setFailNum(0L)
|
||||
.setMaxCountNum(0L)
|
||||
.setRunningNum(0L)
|
||||
.setSuccess(0L)
|
||||
.setSuccessNum(0L)
|
||||
.setSuspendNum(0L)
|
||||
.setStopNum(0L)
|
||||
@ -127,6 +130,28 @@ public enum DateTypeEnum {
|
||||
* 年
|
||||
*/
|
||||
YEAR(dashboardLineResponseVOList -> {
|
||||
Map<String, DashboardLineResponseVO> dispatchQuantityResponseVOMap = dashboardLineResponseVOList.stream().collect(Collectors.toMap(DashboardLineResponseVO::getCreateDt, i -> i));
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
||||
String format = LocalDateTime.of(LocalDate.now().minusMonths(i), LocalTime.MIN).format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
||||
DashboardLineResponseVO dashboardLineResponseVO = dispatchQuantityResponseVOMap.get(format);
|
||||
if (Objects.isNull(dashboardLineResponseVO)) {
|
||||
dashboardLineResponseVO = new DashboardLineResponseVO()
|
||||
.setTotal(0L)
|
||||
.setTotalNum(0L)
|
||||
.setFail(0L)
|
||||
.setFailNum(0L)
|
||||
.setMaxCountNum(0L)
|
||||
.setRunningNum(0L)
|
||||
.setSuccess(0L)
|
||||
.setSuccessNum(0L)
|
||||
.setSuspendNum(0L)
|
||||
.setStopNum(0L)
|
||||
.setCancelNum(0L)
|
||||
.setCreateDt(format);
|
||||
dashboardLineResponseVOList.add(dashboardLineResponseVO);
|
||||
}
|
||||
}
|
||||
}, (startTime) -> {
|
||||
return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfYear()), LocalTime.MIN.withNano(0));
|
||||
}, (endTime) -> {
|
||||
|
@ -66,4 +66,9 @@ public class DashboardLineResponseVO {
|
||||
*/
|
||||
private Long cancelNum;
|
||||
|
||||
/**
|
||||
* 定时-成功数
|
||||
*/
|
||||
private Long success;
|
||||
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type);
|
||||
LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(StrUtil.isNotBlank(startTime) ? LocalDateTime.parse(startTime, 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);
|
||||
List<DashboardLineResponseDO> dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(namespaceId, type, startDateTime, endDateTime);
|
||||
List<DashboardLineResponseDO> dashboardRetryLinkeResponseDOList = retrySummaryMapper.retryLineList(namespaceId, groupName, type, startDateTime, endDateTime);
|
||||
List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardRetryLinkeResponseDOList);
|
||||
dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList);
|
||||
dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt()));
|
||||
@ -133,7 +133,7 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
DateTypeEnum dateTypeEnum = DateTypeEnum.valueOf(type);
|
||||
LocalDateTime startDateTime = dateTypeEnum.getStartTime().apply(StrUtil.isNotBlank(startTime) ? LocalDateTime.parse(startTime, 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);
|
||||
List<DashboardLineResponseDO> dashboardLineResponseDOList = jobSummaryMapper.jobLineList(namespaceId, type, startDateTime, endDateTime);
|
||||
List<DashboardLineResponseDO> dashboardLineResponseDOList = jobSummaryMapper.jobLineList(namespaceId, groupName, type, startDateTime, endDateTime);
|
||||
List<DashboardLineResponseVO> dashboardLineResponseVOList = DispatchQuantityResponseVOConverter.INSTANCE.toDashboardLineResponseVO(dashboardLineResponseDOList);
|
||||
dateTypeEnum.getConsumer().accept(dashboardLineResponseVOList);
|
||||
dashboardLineResponseVOList.sort(Comparator.comparing(a -> a.getCreateDt()));
|
||||
|
@ -81,7 +81,7 @@
|
||||
<a href="#" @click="dataHandler('YEAR')"><a-checkable-tag :checked="type == 'YEAR'">{{ $t('dashboard.analysis.all-year') }}</a-checkable-tag></a>
|
||||
</div>
|
||||
<div class="extra-item">
|
||||
<a-range-picker @change="dateChange" :show-time="{format: 'HH:mm:ss',defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" format="YYYY-MM-DD HH:mm:ss" :placeholder="['Start Time', 'End Time']" />
|
||||
<a-range-picker @change="dateChange" :show-time="{format: 'HH:mm:ss',defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" format="YYYY-MM-DD HH:mm:ss" :placeholder="['开始时间', '结束时间']" />
|
||||
</div>
|
||||
<a-select placeholder="请输入组名称" @change="value => handleChange(value)" :style="{width: '256px'}">
|
||||
<a-select-option v-for="item in groupNameList" :value="item" :key="item">{{ item }}</a-select-option>
|
||||
|
@ -118,7 +118,7 @@ export default {
|
||||
this.rankList = res.data.rankList
|
||||
this.taskList = res.data.taskList
|
||||
res.data.dashboardLineResponseDOList.forEach(res => {
|
||||
this.successNum += res.successNum
|
||||
this.successNum += res.success
|
||||
this.failNum += res.failNum
|
||||
this.stopNum += res.stopNum
|
||||
this.cancelNum += res.cancelNum
|
||||
|
Loading…
Reference in New Issue
Block a user