Exemplo n.º 1
0
  /**
   * 设置进入查询处理的初始值
   *
   * @param actionForm ActionForm 表单From
   * @param request HttpServletRequest Web请求
   * @param response HttpServletResponse Web结果
   * @throws CDealException 处理异常
   */
  public static void setQueryDefault(
      QueryForm aWebForm, HttpServletRequest request, HttpServletResponse response)
      throws CDealException {
    QueryForm aWebForm1 = (QueryForm) aWebForm;
    Connection mConn = null;
    PreparedStatement pstmt = null;
    String str = ""; // 要返回的 string
    String sKey = ""; // 取出的TREEMAP的KEY
    String sValue = ""; // 取出的TREEMAP的value
    TreeMap permission;
    try {
      CUserBean loginUser =
          (CUserBean) request.getSession().getAttribute(CConstants.USER_BEAN); // 用户BEAN
      // 第一次进入需要初始许可事项和部门列表
      if (!loginUser.getAttach().containsKey(Common.JCPermissionIDList)) {
        Common.setDepartAndPermissionList(loginUser);
      }
      // 得到许可实施机关列表
      TreeMap tmDepartmentList = (TreeMap) loginUser.getAttach().get(Common.JCDepartmentList);
      // 得到许可事项列表
      TreeMap tmPermissionList = (TreeMap) loginUser.getAttach().get(Common.JCPermissionList);
      // 添加许可实施机关到一个数组里面去.然后统一输出到页面
      Iterator it = tmDepartmentList.keySet().iterator();
      str = "var department=new Array('','全部'";
      int k = 0;
      while (it.hasNext()) {
        k++;
        sKey = (String) it.next();
        str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY
        sValue = (String) tmDepartmentList.get(sKey);
        str += "'" + sValue + "'\n"; // 取出的TREEMAP的value
      }
      str += ");\n";
      str += " var permissionitem = new Array (" + k + ");\n";
      str += "permissionitem[0]=new Array('','全部');\n";

      // 添加许可事项列表
      Iterator itt = tmPermissionList.keySet().iterator();
      int j = 1;
      while (itt.hasNext()) {
        sKey = (String) itt.next();
        permission = (TreeMap) tmPermissionList.get(sKey);
        Iterator itt2 = permission.keySet().iterator();
        // 添加每个部门对应的许可事项
        str += "permissionitem[" + j + "]=new Array('','全部'";
        while (itt2.hasNext()) {
          sKey = (String) itt2.next();
          str += ",'" + sKey + "',"; // 取出的TREEMAP的KEY
          sValue = (String) permission.get(sKey);
          str += "'" + sValue + "'\n"; // 取出的TREEMAP的value
        }
        str += ");\n";
        j++;
      }
      // 设置业务范围的选项
      aWebForm1.setPrint_busi_str(Common.getBusiArea(aWebForm.getBusi_area()));
      // 把部门数组和许可事项输出到页面上
      aWebForm1.setPrintSql(str);
    } catch (Exception e) {
      throw new CDealException("设置进入时限监察查询处理的初始值时失败。", e);
    } finally {
      if (pstmt != null)
        try {
          pstmt.close();
        } catch (Exception e) {
        }
      ;
      if (mConn != null)
        try {
          mConn.close();
        } catch (Exception e) {
        }
      ;
    }
  }
Exemplo n.º 2
0
  /**
   * 补交告知查询处理
   *
   * @param actionForm ActionForm 表单From
   * @param request HttpServletRequest Web请求
   * @param response HttpServletResponse Web结果
   * @throws CDealException 处理异常
   */
  public static void doQuery(
      QueryForm pQueryForm, HttpServletRequest request, HttpServletResponse response)
      throws CDealException {
    try {
      QueryForm aWebForm = (QueryForm) pQueryForm;
      String[] sql_select; // 需要查询的字段
      String sql_where; // 最终的查询条件
      String[] sql_from; // 查询表
      String sql_order; // 排序

      String sql_selectCol =
          "a.DQCLZT,a.DEPARTID,a.BLZT,a.bljg,a.YXTYWBH,a.XMMC,to_char(a.shoulisj,'yyyy-mm-dd') shoulisj,to_char(a.bujiaogaozhisj,'yyyy-mm-dd') bujiaogaozhisj, to_char(a.bujiaoshoulisj, 'yyyy-mm-dd') bujiaoshoulisj,a.ssgzr,a.YWLSH,a.XKSXBH,a.XKSXXXBH,b.ITEMNAME bname,decode(a.banjie,'N',trunc(sysdate, 'dd') - trunc(a.bujiaogaozhisj, 'dd'),trunc(a.bujiaoshoulisj, 'dd') - trunc(a.bujiaogaozhisj, 'dd')) bjtimes ";
      sql_where =
          "a.XKSXBH=b.ID and a.xksxxxbh=b.items and  a.version = b.version and a.DSRWCLZT='1' and a.BUJIAOGAOZHI='Y' and a.SFBLSJ='N'";
      if (pQueryForm.getSptype() == null) {
        sql_where = sql_where + " AND B.spare4 IN (1,2,3)";
      } else {
        sql_where = sql_where + " AND B.spare4 IN (" + pQueryForm.getSptype() + ")";
      }

      // 查询数据SQL语句
      //            String msSql = "select
      // a.DQCLZT,a.BLZT,a.bljg,a.YXTYWBH,a.XMMC,to_char(a.shoulisj,'yyyy-mm-dd')
      // shoulisj,a.ssgzr,a.YWLSH,a.XKSXBH,a.XKSXXXBH,b.ITEMNAME bname,b.department DEPARTID from
      // t_JC_XZXK_busiindex a,t_JC_XZXK_permissionitemsys b where 1=1 "; // 主查询语句
      sql_order = "order by SHOULISJ desc,bujiaogaozhisj desc"; // 排序语句
      // 查询子条件
      String msTemp = pQueryForm.getYXTYWBH(); // 原业务流水号
      if (msTemp != null && msTemp.length() > 0) {
        sql_where += " and a.YXTYWBH = '" + msTemp + "'";
      }
      msTemp = pQueryForm.getXMMC(); // 申请单位
      if (msTemp != null && msTemp.length() > 0) {
        sql_where += " and a.XMMC like '%" + msTemp + "%'";
      }
      msTemp = pQueryForm.getDepartment(); // 许可实施机关
      if (msTemp != null && msTemp.length() > 0) {
        sql_where += " and a.departid = '" + msTemp + "'";
      }
      msTemp = pQueryForm.getBJGZZT(); // 补交告知状态
      if (msTemp != null && msTemp.length() > 0) {
        if (msTemp.equals("1")) {
          sql_where +=
              " and  a.SFBJGZCS is not null and a.SFBJGZCS ='N' and ((a.banjie = 'N' and trunc(sysdate, 'dd') -trunc(a.bujiaogaozhisj, 'dd')>=60) or (a.bujiaoshouli = 'Y' and trunc(a.bujiaoshoulisj, 'dd') -trunc(a.bujiaogaozhisj, 'dd')>=60)) ";
        } else {
          sql_where += " and  a.SFBJGZCS is not null and a.SFBJGZCS ='" + msTemp + "'";
        }
      }
      msTemp = pQueryForm.getPermission(); // 许可事项
      if (msTemp != null && msTemp.length() > 0) {
        sql_where += " and (b.id||b.items) = '" + msTemp + "'";
      }

      msTemp = pQueryForm.getBusi_area(); // 业务范围
      if (msTemp == null || msTemp.equals("0")) { // 查询当前业务
        sql_select = new String[] {sql_selectCol};
        sql_from = new String[] {"t_JC_XZXK_busiindex a,t_JC_XZXK_permissionitemsys b"};
      } else {
        sql_select = new String[] {sql_selectCol, sql_selectCol};
        sql_from =
            new String[] {
              "t_JC_XZXK_busiindex a,t_JC_XZXK_permissionitemsys b",
              "h_JC_XZXK_busiindex a,t_JC_XZXK_permissionitemsys b"
            };
        if (!msTemp.equals("9")) { // 不是查询所有业务,则用该时间段对 TJSJ 做查询
          String[] sql_timeArea = Common.getDataArea(pQueryForm.getBusi_area());
          sql_where = sql_where + " AND a.tjsj >= to_date(" + sql_timeArea[0] + ",'YYYYMM')";
          sql_where = sql_where + " AND a.tjsj <= to_date(" + sql_timeArea[1] + ",'YYYYMM')";
        }
      }

      msTemp = pQueryForm.getSetTime1(); // 办结日期,起

      if (msTemp != null && !msTemp.equals("")) {
        sql_where += " and a.BUJIAOGAOZHISJ>=TO_DATE('" + msTemp + "','YYYY-MM-DD') ";
      }
      msTemp = pQueryForm.getSetTime2(); // 办结日期,止
      if (msTemp != null && !msTemp.equals("")) {
        sql_where += " and  a.BUJIAOGAOZHISJ<TO_DATE('" + msTemp + "','YYYY-MM-DD')+1 ";
      }
      msTemp = pQueryForm.getYc(); // 是否已查看标志
      if (msTemp != null && msTemp.equals("N")) {
        sql_where += " and (a.YCCHECK is null or a.YCCHECK='N') ";
      }
      CDataPage dataPage = new CDataPage();
      dataPage.setSql_select(sql_select); // 设置查询语句
      dataPage.setSql_from(sql_from);
      dataPage.setSql_where(sql_where);
      dataPage.setSql_order(sql_order); // 设置排序语句
      dataPage.setFormName("forms[0]");
      dataPage.setPageRowCount(CConstants.PAGE_ROW_COUNT);
      dataPage.makeSqlWithSqlPart();
      dataPage.init(request);
      request.setAttribute(CConstants.DATA_PAGE_OBJECT, dataPage);
      TreeMap tmDepartName0 = new TreeMap(); // 添加许可办理状态表到对应的FORM
      tmDepartName0 = CCodeMap.getMapByType("监察补交告知状态");
      aWebForm.setLxStatusList(tmDepartName0);
    } catch (Exception e) {
      throw new CDealException("根据输入条件进行查询时失败。", e);
    }
  }