@Override public void saveOrUpdateReportJob(ReportJobDO reportJob) { ReportJobDO oldReportJob = reportJobDAO.getReportJobByTime(reportJob.getReportTime()); if (oldReportJob == null) { reportJobDAO.insertReportJob(reportJob); } else { oldReportJob.setSuccessNum(reportJob.getSuccessNum()); oldReportJob.setErrorNum(reportJob.getErrorNum()); oldReportJob.setJobNum(reportJob.getJobNum()); oldReportJob.setRt(reportJob.getRt()); reportJobDAO.updateReportJob(oldReportJob); } }
@Override public List<ReportJobDO> findReportJob(ReportJobDO reportJob) { List<ReportJobDO> resultList = reportJobDAO.findReportJob(reportJob); for (ReportJobDO job : resultList) { job.setTotalNum(job.getSuccessNum() + job.getErrorNum()); job.setSuccessRate( new BigDecimal((job.getSuccessNum() * 100 + 0.0) / job.getTotalNum()) .setScale(2, RoundingMode.HALF_DOWN)); job.setErrorRate( new BigDecimal(100).subtract(job.getSuccessRate()).setScale(2, RoundingMode.HALF_DOWN)); } return resultList; }