public Report saveReport(Report r, String reportType) { if ("year".equals(r.getType())) { r.setTime(null); } User user = (User) ActionContext.getContext().getSession().get(WebConstants.SESS_USER_OBJ); if (user instanceof Org) { Org org = (Org) user; Cun cun = org.getCun(); Report report = reportDao.getReport(reportType, org, cun, r.getYear(), r.getType(), r.getTime()); for (int i = 1; i <= 60; i++) { report.setItem(i, r.getItem(i)); } report.setCun(cun); report.setOrg(org); report.setYear(r.getYear()); report.setType(r.getType()); report.setTime(r.getTime()); report.setLock(1); // 1表示已经锁定 reportDao.saveOrUpdate(report); // 如果是月份的报表,则生成季度和年份的报表 if ("month".equals(r.getType())) { generateSeasonAndYear(reportType, org, cun, r); } return report; } return null; }
public void requestUnlock(Report r, String reportType) { User user = (User) ActionContext.getContext().getSession().get(WebConstants.SESS_USER_OBJ); if (user instanceof Org) { Org org = (Org) user; Cun cun = org.getCun(); Report report = reportDao.getReport(reportType, org, cun, r.getYear(), r.getType(), r.getTime()); report.setLock(2); // 2表示请求解锁 reportDao.saveOrUpdate(report); } }