调度报表新增"运行中"中状态项,数据加载SQL优化

pull/6/head
xuxueli 7 years ago
parent 8f80395ac1
commit 0169d537ef

@ -1144,6 +1144,8 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 1、修复打包部署时资源文件乱码问题 - 1、修复打包部署时资源文件乱码问题
- 2、修复新版本chrome滚动到顶部失效问题 - 2、修复新版本chrome滚动到顶部失效问题
- 3、国际化调度中心实现国际化支持中文、英文两种语言默认为中文。 - 3、国际化调度中心实现国际化支持中文、英文两种语言默认为中文。
- 4、调度报表新增"运行中"中状态项数据加载SQL优化
- 5、调度报表缓存优化修复大数据量执行日志加载缓慢的问题
### TODO LIST ### TODO LIST
- 1、任务权限管理执行器为粒度分配权限核心操作校验权限 - 1、任务权限管理执行器为粒度分配权限核心操作校验权限
@ -1161,7 +1163,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 13、任务依赖增强新增任务类型 "流程任务",流程节点可挂载普通类型任务,承担任务依赖功能。现有子任务模型取消;需要考虑任务依赖死循环问题; - 13、任务依赖增强新增任务类型 "流程任务",流程节点可挂载普通类型任务,承担任务依赖功能。现有子任务模型取消;需要考虑任务依赖死循环问题;
- 14、分片任务某一分片失败支持分片转移 - 14、分片任务某一分片失败支持分片转移
- 15、调度中心触发任务后先推送触发队列异步触发然后立即返回。降低quartz线程占用时长。 - 15、调度中心触发任务后先推送触发队列异步触发然后立即返回。降低quartz线程占用时长。
- 16、调度报表加载速度慢问题
## 七、其他 ## 七、其他

@ -28,7 +28,7 @@ public class I18nUtil {
public static Properties loadI18nProp(){ public static Properties loadI18nProp(){
if (prop != null && (System.currentTimeMillis()-lastCacheTim)<60*1000) { if (prop != null && (System.currentTimeMillis()-lastCacheTim)<60*1000) {
return prop; //return prop;
} }
try { try {
// bild i18n prop // bild i18n prop

@ -41,8 +41,7 @@ public interface XxlJobLogDao {
public int triggerCountByHandleCode(@Param("handleCode") int handleCode); public int triggerCountByHandleCode(@Param("handleCode") int handleCode);
public List<Map<String, Object>> triggerCountByDay(@Param("from") Date from, public List<Map<String, Object>> triggerCountByDay(@Param("from") Date from,
@Param("to") Date to, @Param("to") Date to);
@Param("handleCode") int handleCode);
public int clearLog(@Param("jobGroup") int jobGroup, public int clearLog(@Param("jobGroup") int jobGroup,
@Param("jobId") int jobId, @Param("jobId") int jobId,

@ -323,35 +323,30 @@ public class XxlJobServiceImpl implements XxlJobService {
@Override @Override
public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) { public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
List<String> triggerDayList = new ArrayList<String>(); List<String> triggerDayList = new ArrayList<String>();
List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();
List<Integer> triggerDayCountSucList = new ArrayList<Integer>(); List<Integer> triggerDayCountSucList = new ArrayList<Integer>();
List<Integer> triggerDayCountFailList = new ArrayList<Integer>(); List<Integer> triggerDayCountFailList = new ArrayList<Integer>();
int triggerCountRunningTotal = 0;
int triggerCountSucTotal = 0; int triggerCountSucTotal = 0;
int triggerCountFailTotal = 0; int triggerCountFailTotal = 0;
List<Map<String, Object>> triggerCountMapAll = xxlJobLogDao.triggerCountByDay(startDate, endDate, -1); List<Map<String, Object>> triggerCountMapAll = xxlJobLogDao.triggerCountByDay(startDate, endDate);
List<Map<String, Object>> triggerCountMapSuc = xxlJobLogDao.triggerCountByDay(startDate, endDate, ReturnT.SUCCESS_CODE);
if (CollectionUtils.isNotEmpty(triggerCountMapAll)) { if (CollectionUtils.isNotEmpty(triggerCountMapAll)) {
for (Map<String, Object> item: triggerCountMapAll) { for (Map<String, Object> item: triggerCountMapAll) {
String day = String.valueOf(item.get("triggerDay")); String day = String.valueOf(item.get("triggerDay"));
int dayAllCount = Integer.valueOf(String.valueOf(item.get("triggerCount"))); int triggerDayCount = Integer.valueOf(String.valueOf(item.get("triggerDayCount")));
int daySucCount = 0; int triggerDayCountRunning = Integer.valueOf(String.valueOf(item.get("triggerDayCountRunning")));
int dayFailCount = dayAllCount - daySucCount; int triggerDayCountSuc = Integer.valueOf(String.valueOf(item.get("triggerDayCountSuc")));
int triggerDayCountFail = triggerDayCount - triggerDayCountRunning - triggerDayCountSuc;
if (CollectionUtils.isNotEmpty(triggerCountMapSuc)) {
for (Map<String, Object> sucItem: triggerCountMapSuc) {
String daySuc = String.valueOf(sucItem.get("triggerDay"));
if (day.equals(daySuc)) {
daySucCount = Integer.valueOf(String.valueOf(sucItem.get("triggerCount")));
dayFailCount = dayAllCount - daySucCount;
}
}
}
triggerDayList.add(day); triggerDayList.add(day);
triggerDayCountSucList.add(daySucCount); triggerDayCountRunningList.add(triggerDayCountRunning);
triggerDayCountFailList.add(dayFailCount); triggerDayCountSucList.add(triggerDayCountSuc);
triggerCountSucTotal += daySucCount; triggerDayCountFailList.add(triggerDayCountFail);
triggerCountFailTotal += dayFailCount;
triggerCountRunningTotal += triggerDayCountRunning;
triggerCountSucTotal += triggerDayCountSuc;
triggerCountFailTotal += triggerDayCountFail;
} }
} else { } else {
for (int i = 4; i > -1; i--) { for (int i = 4; i > -1; i--) {
@ -363,8 +358,11 @@ public class XxlJobServiceImpl implements XxlJobService {
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
result.put("triggerDayList", triggerDayList); result.put("triggerDayList", triggerDayList);
result.put("triggerDayCountRunningList", triggerDayCountRunningList);
result.put("triggerDayCountSucList", triggerDayCountSucList); result.put("triggerDayCountSucList", triggerDayCountSucList);
result.put("triggerDayCountFailList", triggerDayCountFailList); result.put("triggerDayCountFailList", triggerDayCountFailList);
result.put("triggerCountRunningTotal", triggerCountRunningTotal);
result.put("triggerCountSucTotal", triggerCountSucTotal); result.put("triggerCountSucTotal", triggerCountSucTotal);
result.put("triggerCountFailTotal", triggerCountFailTotal); result.put("triggerCountFailTotal", triggerCountFailTotal);
return new ReturnT<Map<String, Object>>(result); return new ReturnT<Map<String, Object>>(result);

@ -93,11 +93,7 @@ job_dashboard_jobgroup_num_tip=调度中心在线的执行器机器数量
job_dashboard_report=调度报表 job_dashboard_report=调度报表
job_dashboard_report_loaddata_fail=调度报表数据加载异常 job_dashboard_report_loaddata_fail=调度报表数据加载异常
job_dashboard_date_report=日期分布图 job_dashboard_date_report=日期分布图
job_dashboard_date_report_suc_count=成功调度次数
job_dashboard_date_report_fail_count=失败调度次数
job_dashboard_rate_report=成功比例图 job_dashboard_rate_report=成功比例图
job_dashboard_rate_report_suc_count=成功调度次数
job_dashboard_rate_report_fail_count=失败调度次数
## job info ## job info
jobinfo_name=任务管理 jobinfo_name=任务管理

@ -93,11 +93,7 @@ job_dashboard_jobgroup_num_tip=The number of online executor machines perceived
job_dashboard_report=Scheduling report job_dashboard_report=Scheduling report
job_dashboard_report_loaddata_fail=Scheduling report load data error job_dashboard_report_loaddata_fail=Scheduling report load data error
job_dashboard_date_report=Date distribution job_dashboard_date_report=Date distribution
job_dashboard_date_report_suc_count=Successful scheduling number
job_dashboard_date_report_fail_count=Fail scheduling number
job_dashboard_rate_report=Percentage distribution job_dashboard_rate_report=Percentage distribution
job_dashboard_rate_report_suc_count=Successful scheduling percentage
job_dashboard_rate_report_fail_count=Fail scheduling percentage
## job info ## job info
jobinfo_name=Job Manage jobinfo_name=Job Manage

@ -163,13 +163,14 @@
</select> </select>
<select id="triggerCountByDay" resultType="java.util.Map" > <select id="triggerCountByDay" resultType="java.util.Map" >
SELECT DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay, COUNT(id) triggerCount SELECT
FROM XXL_JOB_QRTZ_TRIGGER_LOG DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
WHERE trigger_time BETWEEN #{from} and #{to} COUNT(handle_code) triggerDayCount,
<if test="handleCode gt 0"> SUM(CASE WHEN handle_code = 0 then 1 else 0 end) as triggerDayCountRunning,
AND handle_code = #{handleCode} SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
</if> FROM XXL_JOB_QRTZ_TRIGGER_LOG
GROUP BY triggerDay; WHERE trigger_time BETWEEN #{from} and #{to}
GROUP BY triggerDay;
</select> </select>
<delete id="clearLog" > <delete id="clearLog" >

@ -89,7 +89,7 @@ $(function () {
} }
}, },
legend: { legend: {
data:[I18n.job_dashboard_date_report_suc_count, I18n.job_dashboard_date_report_fail_count] data:[I18n.joblog_status_suc, I18n.joblog_status_fail, I18n.joblog_status_running]
}, },
toolbox: { toolbox: {
feature: { feature: {
@ -116,14 +116,14 @@ $(function () {
], ],
series : [ series : [
{ {
name:I18n.job_dashboard_date_report_suc_count, name:I18n.joblog_status_suc,
type:'line', type:'line',
stack: 'Total', stack: 'Total',
areaStyle: {normal: {}}, areaStyle: {normal: {}},
data: data.content.triggerDayCountSucList data: data.content.triggerDayCountSucList
}, },
{ {
name:I18n.job_dashboard_date_report_fail_count, name:I18n.joblog_status_fail,
type:'line', type:'line',
stack: 'Total', stack: 'Total',
label: { label: {
@ -134,9 +134,16 @@ $(function () {
}, },
areaStyle: {normal: {}}, areaStyle: {normal: {}},
data: data.content.triggerDayCountFailList data: data.content.triggerDayCountFailList
},
{
name:I18n.joblog_status_running,
type:'line',
stack: 'Total',
areaStyle: {normal: {}},
data: data.content.triggerDayCountRunningList
} }
], ],
color:['#00A65A', '#F39C12'] color:['#00A65A', '#c23632', '#F39C12']
}; };
var lineChart = echarts.init(document.getElementById('lineChart')); var lineChart = echarts.init(document.getElementById('lineChart'));
@ -155,27 +162,31 @@ $(function () {
}, },
tooltip : { tooltip : {
trigger: 'item', trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)" formatter: "{b} : {c} ({d}%)"
}, },
legend: { legend: {
orient: 'vertical', orient: 'vertical',
left: 'left', left: 'left',
data: [I18n.job_dashboard_rate_report_suc_count, I18n.job_dashboard_rate_report_fail_count ] data: [I18n.joblog_status_suc, I18n.joblog_status_fail, I18n.joblog_status_running ]
}, },
series : [ series : [
{ {
name: '', //name: '分布比例',
type: 'pie', type: 'pie',
radius : '55%', radius : '55%',
center: ['50%', '60%'], center: ['50%', '60%'],
data:[ data:[
{ {
value:data.content.triggerCountSucTotal, name:I18n.joblog_status_suc,
name:I18n.job_dashboard_rate_report_suc_count value:data.content.triggerCountSucTotal
},
{
name:I18n.joblog_status_fail,
value:data.content.triggerCountFailTotal
}, },
{ {
value:data.content.triggerCountFailTotal, name:I18n.joblog_status_running,
name:I18n.job_dashboard_rate_report_fail_count value:data.content.triggerCountRunningTotal
} }
], ],
itemStyle: { itemStyle: {
@ -187,7 +198,7 @@ $(function () {
} }
} }
], ],
color:['#00A65A', '#F39C12'] color:['#00A65A', '#c23632', '#F39C12']
}; };
var pieChart = echarts.init(document.getElementById('pieChart')); var pieChart = echarts.init(document.getElementById('pieChart'));
pieChart.setOption(option); pieChart.setOption(option);

@ -50,7 +50,7 @@ public class XxlJobLogDaoTest {
dto = xxlJobLogDao.load(log.getId()); dto = xxlJobLogDao.load(log.getId());
List<Map<String, Object>> list2 = xxlJobLogDao.triggerCountByDay(DateUtils.addDays(new Date(), 30), new Date(), 200); List<Map<String, Object>> list2 = xxlJobLogDao.triggerCountByDay(DateUtils.addDays(new Date(), 30), new Date());
int ret4 = xxlJobLogDao.clearLog(1, 1, new Date(), 100); int ret4 = xxlJobLogDao.clearLog(1, 1, new Date(), 100);

Loading…
Cancel
Save