예제 #1
0
  public String execute(HttpServletRequest request, ActionForm form) throws Exception {

    /** **** Service API 초기화 ***** */
    PlatformRequest pReq = new PlatformRequest(request, Config.props.get("ENCODING"));
    /** Web Server에서 XML수신 및 Parsing * */
    pReq.receiveData();
    /** 변수 획득 * */
    vl = pReq.getVariableList();

    ReportDAO rDAO = new ReportDAO();
    ReportEntity rEntity = null;

    StringBuilder sQuery = new StringBuilder();
    StringBuilder sWhere = new StringBuilder();
    StringBuilder gWhere = new StringBuilder();

    sQuery.append(
        " SELECT MAX(SC.SIDO_NM) AS ORG_NM, '-' AS ITEM_NM, SUM(QTT) AS QTT,'-' AS PDT,  \n");
    sQuery.append(
        "        '-' AS INSTAL_DT, SUM(ESTAB_AOM) AS ESTAB_AOM,'-' AS REMARK ,CE.SIDO_CODE   \n");
    sQuery.append("   FROM PT_C_RES_CHARGE_EQU CE, PT_SIDO_CODE SC       \n");
    sWhere.append("  WHERE CE.SIDO_CODE = SC.AREA_CODE   \n");
    gWhere.append(" GROUP BY CE.SIDO_CODE  \n");
    rEntity = rDAO.select(sQuery.toString() + sWhere.toString() + gWhere.toString());

    KJFMi.ReEnt2Ds(dl, rEntity, "output");

    request.setAttribute("dl", dl);

    return next;
  }
예제 #2
0
  public String execute(HttpServletRequest request, ActionForm form) throws Exception {

    /** **** Service API 초기화 ***** */
    PlatformRequest pReq = new PlatformRequest(request, Config.props.get("ENCODING"));
    /** Web Server에서 XML수신 및 Parsing * */
    pReq.receiveData();
    /** 변수 획득 * */
    vl = pReq.getVariableList();

    ReportDAO rDAO = new ReportDAO();
    ReportEntity rEntity = null;

    String scDATE = vl.getValueAsString("scDATE");
    String scDATE1 = vl.getValueAsString("scDATE1");
    String scDATE2 = vl.getValueAsString("scDATE2");
    String scCOM_NAME = vl.getValueAsString("scCOM_NAME");
    String scRECV_NUM = vl.getValueAsString("scRECV_NUM");
    String scMOT_STE = vl.getValueAsString("scMOT_STE");
    String scDISPO_CONT = vl.getValueAsString("scDISPO_CONT");
    String scSIDO_CODE = vl.getValueAsString("scSIDO_CODE");
    String scWRT_NUM = vl.getValueAsString("scWRT_NUM");

    StringBuilder sQuery = new StringBuilder();
    StringBuilder sWhere = new StringBuilder();

    /*
    sQuery.append(" SELECT  '0' AS CHECKER, PT_C.NAME, PT_M.*, ");
    sQuery.append(" DECODE(DISPO_CONT, 'M00001', '등록취소', 'M00002', '영업정지', 'M00003', '과태료처분', ");
    sQuery.append(" 'M00004', '시정명령', 'M00005', '형사고발', 'M00006', '경고조치', ' ') AS TMPDISPO_CONT, ");
    sQuery.append(" DECODE(MOT_STE, 'C00001', '최초등록', 'C00002', '내부건의', 'C00003', '처분완료', '') AS TMPMOT_STE, ");
    sQuery.append(" DECODE(D_PER_CODE, 'REQ001', '정보통신공사협회', 'REQ002', '공제조합', 'REQ003', '지방자치단체', '') AS TMPD_PER_CODE ");

    sQuery.append(" FROM    PT_R_COMPANY_MASTER PT_C INNER JOIN PT_M_MASTER PT_M	");
    sQuery.append(" ON RTRIM(PT_C.TMP_WRT_NUM) = PT_M.TMP_WRT_NUM	");
    */
    sQuery.append(" SELECT  '0' AS CHECKER, PT_C.NAME, PT_M.*, ");

    sQuery.append(
        " PT_C1.CODE_NAME AS TMPD_PER_CODE,   DECODE(PT_M.DISPO_CONT2,'',PT_C2.CODE_NAME,PT_C2.CODE_NAME ||' 및 '||PT_C2_2.CODE_NAME)  AS TMPDISPO_CONT, PT_C3.CODE_NAME AS TMPMOT_STE, PT_C4.CODE_NAME AS VIOL_CONT ");
    sQuery.append(" FROM    (PT_R_COMPANY_MASTER PT_C INNER JOIN PT_M_MASTER PT_M ");
    sQuery.append(" ON RTRIM(PT_C.TMP_WRT_NUM) = PT_M.TMP_WRT_NUM) ");
    sQuery.append(" LEFT JOIN (SELECT P_CODE, CODE, CODE_NAME FROM PT_COM_CODE ");
    sQuery.append(" WHERE P_CODE = 'PTMREQ' )PT_C1 ON PT_M.D_PER_CODE = PT_C1.CODE ");
    sQuery.append(" LEFT JOIN (SELECT P_CODE, CODE, CODE_NAME FROM PT_COM_CODE ");
    sQuery.append(" WHERE P_CODE = 'PTMPRO' )PT_C2 ON PT_M.DISPO_CONT = PT_C2.CODE ");
    sQuery.append(" LEFT JOIN (SELECT P_CODE, CODE, CODE_NAME FROM PT_COM_CODE ");
    sQuery.append(" WHERE P_CODE = 'PTMPRO' )PT_C2_2 ON PT_M.DISPO_CONT2 = PT_C2_2.CODE ");
    sQuery.append(" LEFT JOIN (SELECT P_CODE, CODE, CODE_NAME FROM PT_COM_CODE ");
    sQuery.append(" WHERE P_CODE = 'PTMSTE' )PT_C3 ON PT_M.MOT_STE = PT_C3.CODE ");
    sQuery.append(" LEFT JOIN (SELECT P_CODE, CODE, CODE_NAME FROM PT_COM_CODE ");
    sQuery.append(" WHERE P_CODE = 'PTMCONT' )PT_C4 ON PT_M.VIOL_CONT_CODE = PT_C4.CODE ");

    sWhere.append(" WHERE 	1 = 1 ");

    if (!KJFUtil.isEmpty(vl.getValueAsString("scDATE"))) {
      sWhere.append(" AND		(PT_M." + scDATE + " BETWEEN '" + scDATE1 + "' AND '" + scDATE2 + "') ");
    }

    if (!KJFUtil.isEmpty(scWRT_NUM))
      sWhere.append(" AND     PT_M.WRT_NUM LIKE '%" + scWRT_NUM + "%' ");

    if (!KJFUtil.isEmpty(scRECV_NUM))
      sWhere.append(" AND     PT_M.RECV_NUM = '" + scRECV_NUM + "' ");
    if (!KJFUtil.isEmpty(scMOT_STE) && !scMOT_STE.equalsIgnoreCase("ALL"))
      sWhere.append(" AND     PT_M.MOT_STE = '" + scMOT_STE + "' ");
    if (scDISPO_CONT.length() > 0 && !scDISPO_CONT.equalsIgnoreCase("ALL"))
      sWhere.append(" AND     PT_M.DISPO_CONT = '" + scDISPO_CONT + "' ");
    if (!KJFUtil.isEmpty(scCOM_NAME))
      sWhere.append(" AND     PT_C.NAME LIKE '%" + scCOM_NAME + "%' ");

    if (!KJFUtil.isEmpty(vl.getValueAsString("scSIDO_CODE"))) {
      sWhere.append(" AND     PT_M.SIDO_CODE = '" + scSIDO_CODE + "' ");
    }

    rEntity = rDAO.select(sQuery.toString() + sWhere.toString());

    KJFMi.ReEnt2Ds(dl, rEntity, "output");
    request.setAttribute("dl", dl);

    return next;
  }
  public String execute(HttpServletRequest request, ActionForm form) throws Exception {

    /** **** Service API 초기화 ***** */
    PlatformRequest pReq = new PlatformRequest(request, Config.props.get("ENCODING"));
    /** Web Server에서 XML수신 및 Parsing * */
    pReq.receiveData();
    /** 변수 획득 * */
    vl = pReq.getVariableList();

    String scDOC_CLASS = vl.getValueAsString("scDOC_CLASS");
    String scSIDO_CODE = vl.getValueAsString("scSIDO_CODE");

    ReportDAO rDAO = new ReportDAO();
    ReportEntity rMasterEntity = null;

    // 코드성 데이타 인 경우 항상 필드가 2개만 존재해야 함
    StringBuilder sQuery = new StringBuilder();
    StringBuilder sWhere = new StringBuilder();

    // Deficit Codes Table
    sQuery.append(" SELECT DOC_NUM1, DOC_NUM2, DOC_NUM3, DOC_NUM4 ");
    sQuery.append(" FROM PT_R_DOC_NUM ");

    // 이 메서드는 RECV_NUM 생성 외 다른 목적으로 사용되지 않음.

    // 모든 공사업관리에 대해 접수번호를 자동생성한다.
    // 시도코드+yyyy+xxxx (bsbs20109999). 12자리
    scDOC_CLASS = "RECV_NUM";

    sWhere.append(" WHERE 1=1 ");
    sWhere.append(" AND DOC_CLASS = '" + scDOC_CLASS + "' ");
    sWhere.append(" AND SD_CODE = '" + scSIDO_CODE + "' ");

    rMasterEntity = rDAO.select(sQuery.toString() + sWhere.toString());
    sQuery.delete(0, sQuery.length());

    if (rMasterEntity.getRowCnt() > 0) {
      // 연도 + 일련번호 체크
      String docNum2 = rMasterEntity.getValue(0, "DOC_NUM2");
      if (docNum2 == null || !docNum2.matches("^\\d{8}$")) {
        // 난감한데?
      }
      String preYear = docNum2.substring(0, 4);
      String preSeq = docNum2.substring(4, 8);

      String newYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
      String newSeq;

      if (preYear.equals(newYear)) {
        newSeq = KJFUtil.f_code_make(String.valueOf(Integer.parseInt(preSeq, 10) + 1), 4);
      } else {
        newSeq = "0001";
      }

      docNum2 = newYear + newSeq;

      // 레코드를 삭제하고 넣으려했더니 구현이 안되어있다. 해당 메서드 찾는게 더 귀찮다. 새로 만들기.
      Dataset ds = new Dataset("output");
      ds.addColumn("DOC_NUM1", ColumnInfo.CY_COLINFO_STRING, 20);
      ds.addColumn("DOC_NUM2", ColumnInfo.CY_COLINFO_STRING, 20);
      ds.addColumn("DOC_NUM3", ColumnInfo.CY_COLINFO_STRING, 20);
      ds.addColumn("DOC_NUM4", ColumnInfo.CY_COLINFO_STRING, 20);

      ds.appendRow();
      ds.setColumn(0, "DOC_NUM1", scSIDO_CODE);
      ds.setColumn(0, "DOC_NUM2", docNum2);
      ds.setColumn(0, "DOC_NUM3", "");
      ds.setColumn(0, "DOC_NUM4", "");

      dl.addDataset(ds);

      sQuery.append(" UPDATE PT_R_DOC_NUM SET DOC_NUM2 = '" + docNum2 + "'");
      rDAO = new ReportDAO();
      rDAO.execute(sQuery.toString() + sWhere.toString());
    } else {

      String newYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
      String newSeq = "0001";

      String docNum2 = newYear + newSeq;

      sQuery.append(" INSERT INTO PT_R_DOC_NUM (DOC_CLASS,SD_CODE,SGG_CODE,DOC_NUM1,DOC_NUM2) ");
      sQuery.append(
          " VALUES('"
              + scDOC_CLASS
              + "', '"
              + scSIDO_CODE
              + "', '"
              + scSIDO_CODE
              + "', '"
              + scSIDO_CODE
              + "', '"
              + docNum2
              + "') ");
      rDAO = new ReportDAO();
      rDAO.execute(sQuery.toString());
      ArrayList arrField = new ArrayList();
      arrField.add(scSIDO_CODE);
      arrField.add(docNum2);
      arrField.add(null);
      arrField.add(null);
      rMasterEntity.addRow(arrField);
      KJFMi.ReEnt2Ds(dl, rMasterEntity, "output");
    }

    request.setAttribute("dl", dl);

    return next;
  }