コード例 #1
0
 /**
  * 所有的Servlet都必须实现的方法。
  *
  * @param req HttpServletRequest
  * @param res HttpServletResponse
  * @throws ServletException
  * @throws IOException
  */
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsAssetsCheckHeaderDTO.class.getName());
     AmsAssetsCheckHeaderDTO dto = (AmsAssetsCheckHeaderDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     AssetsOptProducer optProducer = new AssetsOptProducer(user, conn);
     String costOpt =
         optProducer.getCostCenterOption(dto.getOrganizationId(), dto.getCostCenterCode());
     dto.setCostCenterOpt(costOpt);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.CHECK_RESULT_RPT_5;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new CheckResultModelFive(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.setPageSize(22);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.CHECK_RESULT_RPT_5;
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }
コード例 #2
0
  /**
   * @param req HttpServletRequest
   * @param res HttpServletResponse
   * @throws ServletException
   * @throws IOException
   */
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    Connection conn = null;
    try {
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(EamDhCheckLineDTO.class.getName());
      EamDhCheckLineDTO dto = (EamDhCheckLineDTO) req2DTO.getDTO(req);
      String action = dto.getAct();
      conn = getDBConnection(req);
      if (action.equals("")) {
        req.setAttribute(QueryConstant.QUERY_DTO, dto);
        forwardURL = LvecURLs.INS_CONFIRM_PAGE;
      } else if (action.equals(DzyhActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new OrderLineConfirmModel(user, dto);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setDTOClassName(EamDhCheckLineDTO.class.getName());
        pageDAO.setCalPattern(LINE_PATTERN);

        CheckBoxProp checkProp = new CheckBoxProp("subCheck");
        checkProp.addDbField("HEADER_ID");
        checkProp.addDbField("BARCODE");
        checkProp.addDbField("CATALOG_VALUE_ID");
        checkProp.addDbField("RESPONSIBILITY_USER");
        checkProp.addDbField("RESPONSIBILITY_DEPT");
        checkProp.addDbField("ORDER_NO");

        pageDAO.setWebCheckProp(checkProp);
        pageDAO.produceWebData();

        req.setAttribute(QueryConstant.QUERY_DTO, dto);
        forwardURL = LvecURLs.INS_CONFIRM_PAGE;
      } else if (action.equals(DzyhActionConstant.CONFIRM_ACTION)) { // 确认
        if (user.getEmployeeNumber().equals("")) {
          message = getMessage(LvecMessageKeys.NO_EMPLOYEE_NUMBER);
          message.setIsError(true);
          message.setNeedBack(true);
          forwardURL = MessageConstant.MSG_PRC_SERVLET;
        } else {
          RequestParser parser = new RequestParser();
          CheckBoxProp checkProp = new CheckBoxProp("subCheck");
          checkProp.setIgnoreOtherField(true);
          parser.setCheckBoxProp(checkProp);
          parser.transData(req);

          req2DTO.setIgnoreFields(EamCheckTaskDTO.class);
          req2DTO.addIgnoreField("itemName");
          //					req2DTO.addIgnoreField("orderNo");

          DTOSet orderLines = req2DTO.getDTOSet(parser);
          InstruConfirmDAO confirmDAO = new InstruConfirmDAO(user, dto, conn);

          confirmDAO.ConfirmInstrument(orderLines);
          message = confirmDAO.getMessage();
          forwardURL = LvecURLs.INS_CONFIRM_SERVLET;
          forwardURL += "?act=" + DzyhActionConstant.QUERY_ACTION;
        }
      } else {
        message = getMessage(MsgKeyConstant.INVALID_REQ);
        message.setIsError(true);
        forwardURL = MessageConstant.MSG_PRC_SERVLET;
      }
    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.DTO_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (UploadException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (StrException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DataHandleException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.SQL_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      if (!forwardURL.equals("")) {
        ServletForwarder forwarder = new ServletForwarder(req, res);
        forwarder.forwardView(forwardURL);
      }
    }
  }
コード例 #3
0
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    Connection conn = null;
    try {
      conn = getDBConnection(req);
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(AmsAssetsCJYCDTO.class.getName());
      AmsAssetsCJYCDTO dtoParameter = (AmsAssetsCJYCDTO) req2DTO.getDTO(req);
      AmsAssetsQJCJYCDAO dao = new AmsAssetsQJCJYCDAO(user, dtoParameter, conn);
      ServletConfigDTO sevletConfig = SessionUtil.getServletConfigDTO(req);
      dtoParameter.setFaCategory1(SinoConfig.getFaCat1Mis());
      dtoParameter.setFaCategory2(SinoConfig.getFaCat2Mis());
      dtoParameter.setFaCategory3(SinoConfig.getFaCat3Mis());

      String action = req.getParameter("act");
      action = StrUtil.nullToString(action);
      OptionProducer op = new OptionProducer(user, conn);
      int organizationId = StrUtil.strToInt(dtoParameter.getBookTypeCode());
      String companySelect = op.getAllOrganization(organizationId, true);
      req.setAttribute("OU", companySelect);
      String monthOption = op.getFromMonthOption(dtoParameter.getFromMonth());
      String tomonthOption = op.getFromMonthOption(dtoParameter.getToMonth());
      String bookTypeCode = dtoParameter.getBookTypeCode();
      String bookSelect = op.getAllBookTypeName(bookTypeCode, true);
      String catSegment1 = dtoParameter.getCatSegment1();
      String catSegment1Servlet = op.getUseField(catSegment1, true);
      req.setAttribute("CATSEGMENT1", catSegment1Servlet);
      req.setAttribute("BOOK_TYPE_CODE", bookSelect);
      req.setAttribute("FROM_MONTH_OPTION", monthOption);
      req.setAttribute("TO_MONTH_OPTION", tomonthOption);
      req.setAttribute("AMSBJTRANSNOHDTO", dtoParameter);
      if (action.equals("")) {
        forwardURL = "/newasset/assetsQJCJYC.jsp";
      } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new AmsAssetsQJCJYCModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setCalPattern(LINE_PATTERN);
        pageDAO.setCountPages(false);
        pageDAO.produceWebData();
        req.setAttribute("AMSBJTRANSNOHDTO", dtoParameter);
        forwardURL = "/newasset/assetsQJCJYC.jsp";
      } else if (action.equals(AssetsActionConstant.EXPORT_ACTION)) {
        File file = dao.exportFile();
        WebFileDownload fileDown = new WebFileDownload(req, res);
        fileDown.setFilePath(file.getAbsolutePath());
        fileDown.download();
        file.delete();
      }
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(AssetsMessageKeys.DTO_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (WebFileDownException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DataTransException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.COMMON_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
    }
  }
コード例 #4
0
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    String action = req.getParameter("act");
    action = StrUtil.nullToString(action);
    Connection conn = null;
    try {
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      EamSyschronizeDTO dtoParameter = null; // 声明DTO
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(EamSyschronizeDTO.class.getName());
      dtoParameter = (EamSyschronizeDTO) req2DTO.getDTO(req);
      conn = getDBConnection(req);
      TransStatusDAO eamNewLocusDAO = new TransStatusDAO(user, dtoParameter, conn);
      ServletConfigDTO servletConfig = getServletConfig(req);
      if (action.equals("")) {
        forwardURL = URLDefineList.TRANS_QUERY;
      } else if (action.equals(WebActionConstant.QUERY_ACTION)) { // 查询操作
        BaseSQLProducer sqlProducer = new TransStatusQueryModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setServletConfig(servletConfig);
        pageDAO.setCalPattern(LINE_PATTERN);
        pageDAO.produceWebData();
        req.setAttribute(WebAttrConstant.SYSCHRONIZE_DTO, dtoParameter);
        forwardURL = URLDefineList.TRANS_QUERY;
      } else if (action.equals(WebActionConstant.EXPORT_ACTION)) { // 导出Excel
        File file = eamNewLocusDAO.getExportFile();
        WebFileDownload fileDown = new WebFileDownload(req, res);
        fileDown.setFilePath(file.getAbsolutePath());
        fileDown.download();
        file.delete();
      } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
        eamNewLocusDAO.setDTOClassName(EamSyschronizeDTO.class.getName());
        String batchId = req.getParameter("id");
        dtoParameter.setBatchId(batchId);
        eamNewLocusDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        //   EamSyschronizeDTO dto = (EamSyschronizeDTO)eamNewLocusDAO.getDataByForeignKey(
        // batchId);
        //    if(dto == null){
        //	dto = new EamSyschronizeDTO();
        //		message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
        //		message.setIsError(true);
        //	   	}  else{
        //                      dto = new EamSyschronizeDTO();
        //                    EamSyschronizeDTO orderDTO = new EamSyschronizeDTO();
        //                    orderDTO.setBatchId(dtoParameter.getBatchId());
        //                    TransStatusDAO orderDAO = new TransStatusDAO(user, orderDTO, conn);
        //                    orderDAO.setDTOClassName(EamSyschronizeDTO.class.getName());
        //                    orderDAO.setCalPattern(LINE_PATTERN);
        DTOSet orders = (DTOSet) eamNewLocusDAO.getDataByForeignKey(batchId);
        req.setAttribute("DTOSET", orders);
        //   }
        //  req.setAttribute(WebAttrConstant.SYSCHRONIZE_DTO, dto);
        forwardURL = "/synchronize/StatusDetail.jsp";
      } else if (action.equals("show")) {
        eamNewLocusDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        String logId = req.getParameter("logId");
        RowSet rs = eamNewLocusDAO.getLog(logId);
        req.setAttribute("DATA", rs);
        forwardURL = "/synchronize/logInfo.jsp";
      }

    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.DTO_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (WebFileDownException e) {
      e.printLog();
    } catch (DataTransException e) {
      e.printLog();
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
      // 根据实际情况修改页面跳转代码。
    }
  }
コード例 #5
0
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsVendorInfoDTO.class.getName());
     AmsVendorInfoDTO dto = (AmsVendorInfoDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     SpareVendorDAO rptDAO = new SpareVendorDAO(user, dto, conn);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_QUERY;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new SpareVendorModel(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_QUERY;
     } else if (action.equals(WebActionConstant.NEW_ACTION)) {
       String VendorId = rptDAO.getVendorId();
       dto.setVendorId(VendorId);
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.SPARE_VENDOR_INFO;
     } else if (action.equals(WebActionConstant.CREATE_ACTION)) {
       rptDAO.setServletConfig(getServletConfig(req));
       rptDAO.createData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals(WebActionConstant.UPDATE_ACTION)) {
       rptDAO.setServletConfig(getServletConfig(req));
       rptDAO.updateData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals(AssetsActionConstant.DETAIL_ACTION)) {
       rptDAO.setDTOClassName(AmsVendorInfoDTO.class.getName());
       AmsVendorInfoDTO ridDto = (AmsVendorInfoDTO) rptDAO.getDataByPrimaryKey();
       if (ridDto == null) {
         dto = new AmsVendorInfoDTO();
         message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
         message.setIsError(true);
       }
       req.setAttribute(QueryConstant.QUERY_DTO, ridDto);
       forwardURL = AssetsURLList.SPARE_VENDOR_INFO;
     } else if (action.equals(WebActionConstant.DELETE_ACTION)) {
       rptDAO.deleteData();
       message = rptDAO.getMessage();
       forwardURL = AssetsURLList.SPARE_VENDOR_SERVLET;
     } else if (action.equals("verifyworkNo")) {
       String vendorName = req.getParameter("vendorName");
       boolean success = rptDAO.doVerify(vendorName);
       PrintWriter out = res.getWriter();
       if (success) {
         out.print("Y");
       }
       out.flush();
       out.close();
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DataHandleException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (SQLModelException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (ContainerException e) {
     e.printStackTrace();
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }
コード例 #6
0
ファイル: BjdbdyServlet.java プロジェクト: starMagic/CQEAM
  public void performTask(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    String forwardURL = "";
    Message message = SessionUtil.getMessage(req);
    String action = StrUtil.nullToString(req.getParameter("act"));
    Connection conn = null;
    try {
      SfUserDTO user = (SfUserDTO) SessionUtil.getUserAccount(req);
      AmsItemAllocateHDTO dtoParameter = null;
      Request2DTO req2DTO = new Request2DTO();
      req2DTO.setDTOClassName(AmsItemAllocateHDTO.class.getName());
      dtoParameter = (AmsItemAllocateHDTO) req2DTO.getDTO(req);
      conn = getDBConnection(req);
      OptionProducer optProducer = new OptionProducer(user, conn);
      if (action.equals("")) {
        String orderStatus =
            optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus());
        req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus);
        String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo());
        req.setAttribute(WebAttrConstant.INV_OPTION, invOption);
        forwardURL = "/nm/spare2/bjdbdy.jsp";
      } else if (action.equals(WebActionConstant.QUERY_ACTION)) {
        BaseSQLProducer sqlProducer = new BjdbdyModel(user, dtoParameter);
        PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
        pageDAO.setCalPattern(CalendarConstant.LINE_PATTERN);
        pageDAO.produceWebData();
        String orderStatus =
            optProducer.getDictOption("SPARE_ORDER_STATUS", dtoParameter.getTransStatus());
        req.setAttribute(WebAttrConstant.TRANS_STATUS, orderStatus);
        String invOption = optProducer.getInvOption(dtoParameter.getFromObjectNo());
        req.setAttribute(WebAttrConstant.INV_OPTION, invOption);
        forwardURL = "/nm/spare2/bjdbdy.jsp";
      } else if (action.equals(WebActionConstant.DETAIL_ACTION)) {
        BjswjyckDAO itemTransHDAO = new BjswjyckDAO(user, dtoParameter, conn);
        itemTransHDAO.setDTOClassName(AmsItemAllocateHDTO.class.getName());
        AmsItemAllocateHDTO amsItemTransH =
            (AmsItemAllocateHDTO) itemTransHDAO.getDataByPrimaryKey();
        if (amsItemTransH == null) {
          amsItemTransH = new AmsItemAllocateHDTO();
          message = getMessage(MsgKeyConstant.DATA_NOT_EXIST);
          message.setIsError(true);
        }
        req.setAttribute("AIT_HEADER", amsItemTransH);
        String freightDate = req.getParameter("freightDate");
        WebPageView wpv = new WebPageView(req, conn);
        wpv.setPrintProp(true);
        BaseSQLProducer sqlProducer = new BjswjyckModel(user, dtoParameter);
        wpv.produceWebData(sqlProducer.getDataByForeignKeyModel(dtoParameter.getTransId()));

        forwardURL = "/nm/spare2/bjdbdyDetail.jsp";
      } else {
        message = getMessage(MsgKeyConstant.INVALID_REQ);
        message.setIsError(true);
        forwardURL = MessageConstant.MSG_PRC_SERVLET;
      }
    } catch (PoolPassivateException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.POOL_PASSIVATE_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (DTOException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.DTO_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (QueryException ex) {
      ex.printLog();
      message = getMessage(MsgKeyConstant.QUERY_ERROR);
      message.setIsError(true);
      message.setNeedBack(true);
      forwardURL = MessageConstant.MSG_PRC_SERVLET;
    } catch (SQLModelException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    } finally {
      DBManager.closeDBConnection(conn);
      setHandleMessage(req, message);
      ServletForwarder forwarder = new ServletForwarder(req, res);
      forwarder.forwardView(forwardURL);
    }
  }
コード例 #7
0
 public void performTask(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
   String forwardURL = "";
   Message message = SessionUtil.getMessage(req);
   Connection conn = null;
   try {
     SfUserDTO user = (SfUserDTO) getUserAccount(req);
     Request2DTO req2DTO = new Request2DTO();
     req2DTO.setDTOClassName(AmsAssetsCheckHeaderDTO.class.getName());
     AmsAssetsCheckHeaderDTO dto = (AmsAssetsCheckHeaderDTO) req2DTO.getDTO(req);
     String action = dto.getAct();
     conn = getDBConnection(req);
     NewAssetsReportDeptDAO rptDAO = new NewAssetsReportDeptDAO(user, dto, conn);
     if (action.equals("")) {
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.NEW_FA_REPORT_DEPT;
     } else if (action.equals(AssetsActionConstant.QUERY_ACTION)) {
       BaseSQLProducer sqlProducer = new NewAssetsReportDeptModel(user, dto);
       PageQueryDAO pageDAO = new PageQueryDAO(req, conn, sqlProducer);
       pageDAO.setPageSize(23);
       pageDAO.setCalPattern(LINE_PATTERN);
       pageDAO.produceWebData();
       req.setAttribute(QueryConstant.QUERY_DTO, dto);
       forwardURL = AssetsURLList.NEW_FA_REPORT_DEPT;
     } else if (action.equals(AssetsActionConstant.EXPORT_ACTION)) {
       File file = rptDAO.getExportFile();
       WebFileDownload fileDown = new WebFileDownload(req, res);
       fileDown.setFilePath(file.getAbsolutePath());
       fileDown.download();
       file.delete();
     } else {
       message = getMessage(MsgKeyConstant.INVALID_REQ);
       message.setIsError(true);
       forwardURL = MessageConstant.MSG_PRC_SERVLET;
     }
   } catch (PoolPassivateException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.POOL_PASSIVATE_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DTOException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.DTO_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (QueryException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.QUERY_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (WebFileDownException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } catch (DataTransException ex) {
     ex.printLog();
     message = getMessage(AssetsMessageKeys.COMMON_ERROR);
     message.setIsError(true);
     forwardURL = MessageConstant.MSG_PRC_SERVLET;
   } finally {
     closeDBConnection(conn);
     setHandleMessage(req, message);
     if (!StrUtil.isEmpty(forwardURL)) {
       ServletForwarder forwarder = new ServletForwarder(req, res);
       forwarder.forwardView(forwardURL);
     }
   }
 }