use of com.qlangtech.tis.workflow.pojo.WorkFlowBuildHistoryCriteria in project tis by qlangtech.
the class DataxAction method doGetExecStatistics.
@Func(value = PermissionConstant.DATAX_MANAGE, sideEffect = false)
public void doGetExecStatistics(Context context) throws Exception {
WorkFlowBuildHistoryCriteria historyCriteria = new WorkFlowBuildHistoryCriteria();
Date from = ManageUtils.getOffsetDate(-7);
SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd");
Map<String, DataXExecStatus> execStatis = Maps.newTreeMap();
ExecResult execResult = null;
DataXExecStatus execStatus = null;
String timeLab = null;
for (int i = 0; i < 8; i++) {
timeLab = dateFormat.format(ManageUtils.getOffsetDate(-i));
execStatis.put(timeLab, new DataXExecStatus(timeLab));
}
int successCount = 0;
int errCount = 0;
historyCriteria.createCriteria().andAppIdEqualTo(this.getAppDomain().getAppid()).andCreateTimeGreaterThan(from);
for (WorkFlowBuildHistory h : this.wfDAOFacade.getWorkFlowBuildHistoryDAO().selectByExample(historyCriteria)) {
execResult = ExecResult.parse(h.getState());
execStatus = execStatis.get(dateFormat.format(h.getCreateTime()));
if (execStatus == null) {
continue;
}
if (execResult == ExecResult.SUCCESS) {
execStatus.successCount++;
successCount++;
} else if (execResult == ExecResult.FAILD) {
execStatus.errCount++;
errCount++;
}
}
Map<String, Object> bizResult = Maps.newHashMap();
bizResult.put("data", execStatis.values());
Map<String, Integer> allStatis = Maps.newHashMap();
allStatis.put("errCount", errCount);
allStatis.put("successCount", successCount);
bizResult.put("statis", allStatis);
this.setBizResult(context, bizResult);
}
Aggregations