Ejemplo n.º 1
0
  private void generateSeasonAndYear(String reportType, Org org, Cun cun, Report r) {
    // 生成季度的
    int month = Integer.valueOf(r.getTime());
    int time = month % 3 == 0 ? month / 3 : month / 3 + 1;
    Report reportSeason =
        reportDao.getReport(reportType, org, cun, r.getYear(), "season", time + "");
    int minMonth = time * 3 - 2;
    int maxMonth = time * 3;
    clearItems(reportSeason);
    for (int m = minMonth; m <= maxMonth; m++) {
      Report mReport = reportDao.getReport(reportType, org, cun, r.getYear(), "month", m + "");
      addItems(reportSeason, mReport);
      // 特殊字段处理
      if (maxMonth == m && "1".equals(reportType)) {
        reportSeason.setItem13(mReport.getItem13());
        reportSeason.setItem14(mReport.getItem14());
        reportSeason.setItem31(mReport.getItem31());
        fillReport(reportSeason);
      } else if (maxMonth == m && "2".equals(reportType)) {
        reportSeason.setItem1(mReport.getItem1());
      } else {
        reportSeason.setItem13("");
        reportSeason.setItem14("");
      }
    }
    clearItemsZero(reportSeason);
    reportDao.saveOrUpdate(reportSeason);

    // 生成年度的
    Report reportYear = reportDao.getReport(reportType, org, cun, r.getYear(), "year", null);
    clearItems(reportYear);
    for (int m = 1; m <= 12; m++) {
      Report mReport = reportDao.getReport(reportType, org, cun, r.getYear(), "month", m + "");
      addItems(reportYear, mReport);
      // 特殊字段处理
      if (12 == m && "1".equals(reportType)) {
        reportYear.setItem13(mReport.getItem13());
        reportYear.setItem14(mReport.getItem14());
        reportYear.setItem31(mReport.getItem31());
        fillReport(reportYear);
      } else if (12 == m && "2".equals(reportType)) {
        reportYear.setItem1(mReport.getItem1());
      } else {
        reportYear.setItem13("");
        reportYear.setItem14("");
      }
    }
    clearItemsZero(reportYear);
    reportDao.saveOrUpdate(reportYear);
  }
Ejemplo n.º 2
0
  // 显示最新的cun的数据
  public void fillReport(Report r) {
    User user = (User) ActionContext.getContext().getSession().get(WebConstants.SESS_USER_OBJ);
    if (user instanceof Org) {
      Org org = (Org) user;
      Cun cun = org.getCun();
      cun = reportDao.getEntityById(Cun.class, cun.getId());
      // Long familySum = reportDao.getEntitySum(Family.class, "cun",
      // cun);
      r.setItem1(cun.getPoorFamilyNum() == null ? "" : cun.getPoorFamilyNum() + "");
      // Long personSum = familyDao.getPersonSum(cun);
      r.setItem2(cun.getPoorPersonNum() == null ? "" : cun.getPoorPersonNum() + "");

      r.setItem3(cun.getPoorFamilyNum1() == null ? "" : cun.getPoorFamilyNum1() + "");
      r.setItem4(cun.getPoorPersonNum1() == null ? "" : cun.getPoorPersonNum1() + "");
      r.setItem5(cun.getPoorFamilyNum3() == null ? "" : cun.getPoorFamilyNum3() + "");
      r.setItem6(cun.getPoorPersonNum3() == null ? "" : cun.getPoorPersonNum3() + "");
      r.setItem7(cun.getPoorFamilyNum2() == null ? "" : cun.getPoorFamilyNum2() + "");
      r.setItem8(cun.getPoorPersonNum2() == null ? "" : cun.getPoorPersonNum2() + "");
      r.setItem9(cun.getPoorFamilyNum4() == null ? "" : cun.getPoorFamilyNum4() + "");
      r.setItem10(cun.getPoorPersonNum4() == null ? "" : cun.getPoorPersonNum4() + "");
      r.setItem11(cun.getWeiHouse() == null ? "" : cun.getWeiHouse() + "");

      // if(Util.isEmpty(r.getItem30()))
      r.setItem30(cun.getIncome() == null ? "" : cun.getIncome() + "");
      // if("0".equals(r.getItem30())){
      // r.setItem30("");
      // }
    }
  }